Spaces:
Sleeping
Sleeping
Update api/routes.py
Browse files- api/routes.py +14 -0
api/routes.py
CHANGED
|
@@ -169,3 +169,17 @@ async def fetch_and_store_patients_from_fhir():
|
|
| 169 |
|
| 170 |
except Exception as e:
|
| 171 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
except Exception as e:
|
| 171 |
raise HTTPException(status_code=500, detail=str(e))
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
@router.get("/ehr/fhir-patients")
|
| 175 |
+
async def list_fhir_patients():
|
| 176 |
+
cursor = patients_collection.find({"fhir_id": {"$exists": True}})
|
| 177 |
+
patients = []
|
| 178 |
+
async for p in cursor:
|
| 179 |
+
patients.append({
|
| 180 |
+
"id": str(p["_id"]),
|
| 181 |
+
"full_name": p.get("full_name"),
|
| 182 |
+
"gender": p.get("gender"),
|
| 183 |
+
"date_of_birth": p.get("date_of_birth"),
|
| 184 |
+
})
|
| 185 |
+
return patients
|