create_taiga_tasks.py 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import requests
  2. import urllib3
  3. import json
  4. urllib3.disable_warnings()
  5. TAIGA_USER = 'FrancoisLange'
  6. TAIGA_PASS = 'your_db_password_here'
  7. base_url = 'https://192.168.130.161/taiga/api/v1'
  8. project_id = 21
  9. # Mapping of User Story Ref to Task details
  10. TASKS_TO_CREATE = {
  11. 2: {
  12. "subject": "Configure Easy Cloning and Repository Footprint",
  13. "description": "**Changes**: Streamlined cloning requirements, configured basic dependencies in requirements.txt, and enabled local execution pathways.\n**Why**: Allows new developers or deployers to clone and stand up the stack in seconds in disconnected networks.\n**Commit Comment**: `TG-2: Repository initialized and cloned dependency footprint stabilized for local standalone setup.`"
  14. },
  15. 3: {
  16. "subject": "Implement Secure Local User Authentication & Login UI",
  17. "description": "**Changes**: Integrated bcrypt password hashing in `app.py`, created the user creation/login panels in Streamlit, and set up the `users` table schema in `init.sql`.\n**Why**: Restricts clinical telemetry and patient profiles to authorized clinicians, enforcing security baselines.\n**Commit Comment**: `TG-3: Implement secure local bcrypt hashing and Streamlit authentication gateway.`"
  18. },
  19. 4: {
  20. "subject": "Establish Strict Offline Database Constraints & Boundary Limits",
  21. "description": "**Changes**: Configured container networks to prevent external connections, routing LLM requests strictly to the local Ollama instance and database.\n**Why**: Guarantees zero data leakage for HIPAA/clinical compliance on personal medical profiles.\n**Commit Comment**: `TG-4: Set strict containerized boundary limits to ensure zero external calls for clinical profiling.`"
  22. },
  23. 9: {
  24. "subject": "Configure Ollama Local Orchestration for Llama3.2",
  25. "description": "**Changes**: Integrated the Ollama REST client into `app.py`, pulling `llama3.2:3b` in the background and managing inference queries locally.\n**Why**: Allows offline medical NLP evaluation without relying on commercial cloud-based LLM platforms.\n**Commit Comment**: `TG-9: Integrate Ollama connection pooling and lightweight model download scripts.`"
  26. },
  27. 10: {
  28. "subject": "Construct Interactive Clinical AI Chat Interface",
  29. "description": "**Changes**: Implemented Streamlit chat interface with custom session state tracking, injecting active dietitian medical profile details into the system prompt.\n**Why**: Enables practitioners to dynamically query nutrient databases via natural language conversation.\n**Commit Comment**: `TG-10: Deploy interactive dietetics chat panel with clinical history parsing.`"
  30. },
  31. 11: {
  32. "subject": "Deploy Local RAG-Driven Meal Planner Engine",
  33. "description": "**Changes**: Set up the `tab_planner` view, formulating a structured dietitian system prompt that enforces strict Markdown tables containing Calories and Protein.\n**Why**: Generates clinically safe, calorie-restricted meal options automatically tailored to patient illnesses/diets.\n**Commit Comment**: `TG-11: Integrate tabular meal planner executing local database subqueries.`"
  34. },
  35. 12: {
  36. "subject": "Integrate Local SearXNG Private Search Fallback",
  37. "description": "**Changes**: Integrated a SearXNG client querying `http://searxng:8080` to search the web if database nutrition data is absent.\n**Why**: Provides supplementary recipes while maintaining absolute user anonymity without commercial tracking search engines.\n**Commit Comment**: `TG-12: Integrate local anonymous SearXNG meta-search fallback.`"
  38. },
  39. 147: {
  40. "subject": "Create Comprehensive WSL2 Operator Runbook",
  41. "description": "**Changes**: Formulated explicit WSL2 mounting, Docker Desktop integration guides, and system configuration commands.\n**Why**: Assists administrators in deploying the Local Food AI environment securely on Windows-based enterprise hosts.\n**Commit Comment**: `TG-147: Finalize WSL2 operator guidelines and networking parameters.`"
  42. },
  43. 149: {
  44. "subject": "Establish Scrum Rituals Static Documentation",
  45. "description": "**Changes**: Generated Sprint Daily, Plan, Retro, and Review markdown pages in `docs/` summarizing the operational milestones.\n**Why**: Logs the continuous improvement metrics and velocity tracking required for capstone reviews.\n**Commit Comment**: `TG-149: Compile Scrum wiki index and daily operational logs.`"
  46. },
  47. 151: {
  48. "subject": "Apply Codebase Linter Refactoring and SQL Cleanup",
  49. "description": "**Changes**: Refactored `app.py` warnings logic, streamlined unit conversions, and optimized MySQL index parameters.\n**Why**: Stabilizes the production release candidate for zero-downtime deployment.\n**Commit Comment**: `TG-151: Apply final refactoring patches to Streamlit application components.`"
  50. },
  51. 153: {
  52. "subject": "Implement Resilient Subquery Optimizations & Layout UI",
  53. "description": "**Changes**: Restructured the UI tab layouts and implemented clinical subquery limiting to prevent Cartesian join overhead in database calls.\n**Why**: Reduces page load latency and handles high concurrent request volumes smoothly.\n**Commit Comment**: `TG-153: Optimize database joins and revamp UI theming using custom HSL values.`"
  54. },
  55. 155: {
  56. "subject": "Deploy SNMPv3 Encrypted Traps and Zabbix Templates",
  57. "description": "**Changes**: Configured custom SNMPv3 traps for `snmp_notifier.py` and provisioned dynamic Zabbix host alerts via the API.\n**Why**: Standardizes telemetry gathering and active error notification across multiple distributed nodes.\n**Commit Comment**: `TG-155: Configure SNMPv3 trap parameters and deploy full Zabbix alert dashboard.`"
  58. }
  59. }
  60. def main():
  61. auth_resp = requests.post(f'{base_url}/auth', json={'type': 'normal', 'username': TAIGA_USER, 'password': TAIGA_PASS}, verify=False)
  62. if auth_resp.status_code != 200:
  63. print("Auth failed!")
  64. return
  65. auth = auth_resp.json()
  66. headers = {'Authorization': f'Bearer {auth["auth_token"]}', 'Content-Type': 'application/json'}
  67. # Fetch User Stories to map ref to US ID
  68. print("Fetching user stories...")
  69. user_stories = requests.get(f'{base_url}/userstories?project={project_id}', headers=headers, verify=False).json()
  70. us_ref_to_id = {us['ref']: us['id'] for us in user_stories}
  71. # Fetch existing tasks to avoid duplicates
  72. print("Fetching existing tasks...")
  73. existing_tasks = requests.get(f'{base_url}/tasks?project={project_id}', headers=headers, verify=False).json()
  74. existing_subjects = {t['subject'] for t in existing_tasks}
  75. for ref, task_details in TASKS_TO_CREATE.items():
  76. if ref not in us_ref_to_id:
  77. print(f"User story US-{ref} not found!")
  78. continue
  79. us_id = us_ref_to_id[ref]
  80. subject = task_details['subject']
  81. description = task_details['description']
  82. if subject in existing_subjects:
  83. print(f"Task '{subject}' already exists. Skipping creation.")
  84. continue
  85. print(f"Creating task '{subject}' for US-{ref}...")
  86. task_payload = {
  87. "project": project_id,
  88. "user_story": us_id,
  89. "subject": subject,
  90. "description": description,
  91. "status": 104 # Closed
  92. }
  93. resp = requests.post(f'{base_url}/tasks', json=task_payload, headers=headers, verify=False)
  94. if resp.status_code == 201:
  95. print(f"Successfully created task for US-{ref}!")
  96. else:
  97. print(f"Failed to create task for US-{ref}: {resp.text}")
  98. print("\nTasks creation completed successfully!")
  99. if __name__ == '__main__':
  100. main()