| | |
| | |
| | |
| | import json |
| | import os |
| | from dotenv import load_dotenv |
| |
|
| | from modules.db import SheamiDB |
| |
|
| | if __name__ == "__main__": |
| | load_dotenv(override=True) |
| | db = SheamiDB(os.getenv("DB_URI")) |
| |
|
| | |
| | user = db.get_user_by_email("doctor1@sheami.com") |
| | if user: |
| | user_id = str(user["_id"]) |
| | data = db.get_user_full_data(user_id) |
| | print("data = ",json.dumps(data,indent=1)) |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | print(data) |
| | else: |
| | |
| | user_id = db.add_user("doctor1@sheami.com", "Dr. Smith") |
| |
|
| | |
| | patient_id = db.add_patient(user_id, "John Doe", "1980-05-20", "male") |
| |
|
| | |
| | parsed_data = { |
| | "tests": [ |
| | {"name": "Hemoglobin", "value": 13.5, "unit": "g/dL", "reference_range": "13.0-17.0"}, |
| | {"name": "Cholesterol", "value": 210, "unit": "mg/dL", "reference_range": "<200"} |
| | ] |
| | } |
| | report_id = db.add_report(patient_id, "bloodwork_july.pdf", parsed_data) |
| |
|
| | |
| | db.add_or_update_trend(patient_id, "Hemoglobin", [ |
| | {"date": "2025-05-01", "value": 13.2}, |
| | {"date": "2025-07-01", "value": 13.5}, |
| | {"date": "2025-08-19", "value": 13.8} |
| | ]) |
| |
|
| | |
| | final_report_id = db.add_final_report( |
| | patient_id, |
| | "Hemoglobin stable, cholesterol slightly high.", |
| | ["Maintain healthy diet", "Check cholesterol in 3 months"], |
| | [ |
| | {"test_name": "Hemoglobin", "latest_value": 13.8, "direction": "stable"}, |
| | {"test_name": "Cholesterol", "latest_value": 210, "direction": "increasing"} |
| | ] |
| | ) |
| |
|
| | print("User ID:", user_id) |
| | print("Patient ID:", patient_id) |
| | print("Report ID:", report_id) |
| | print("Final Report ID:", final_report_id) |
| |
|