Ali2206 commited on
Commit
29a3b26
·
verified ·
1 Parent(s): 943bcdc

Update api/routes/patients.py

Browse files
Files changed (1) hide show
  1. api/routes/patients.py +7 -9
api/routes/patients.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  from fastapi import APIRouter, HTTPException, Depends, Query, status, Body
2
  from db.mongo import patients_collection
3
  from core.security import get_current_user
@@ -338,17 +340,16 @@ async def import_patients(
338
  detail=f"Import failed: {str(e)}"
339
  )
340
 
341
- @router.get("/", response_model=List[dict])
342
  async def list_patients(
343
  search: Optional[str] = Query(None),
344
  min_notes: int = Query(0, ge=0),
345
  min_conditions: int = Query(0, ge=0),
346
  limit: int = Query(100, ge=1, le=500),
347
- skip: int = Query(0, ge=0),
348
- current_user: dict = Depends(get_current_user)
349
  ):
350
  logger.info(f"Listing patients with search: {search}, limit: {limit}, skip: {skip}")
351
- query = {}
352
 
353
  if search:
354
  query["$or"] = [
@@ -411,11 +412,8 @@ async def list_patients(
411
  detail=f"Failed to retrieve patients: {str(e)}"
412
  )
413
 
414
- @router.get("/{patient_id}", response_model=dict)
415
- async def get_patient(
416
- patient_id: str,
417
- current_user: dict = Depends(get_current_user)
418
- ):
419
  logger.info(f"Retrieving patient: {patient_id}")
420
  try:
421
  patient = await patients_collection.find_one({
 
1
+
2
+
3
  from fastapi import APIRouter, HTTPException, Depends, Query, status, Body
4
  from db.mongo import patients_collection
5
  from core.security import get_current_user
 
340
  detail=f"Import failed: {str(e)}"
341
  )
342
 
343
+ @router.get("/patients", response_model=List[dict])
344
  async def list_patients(
345
  search: Optional[str] = Query(None),
346
  min_notes: int = Query(0, ge=0),
347
  min_conditions: int = Query(0, ge=0),
348
  limit: int = Query(100, ge=1, le=500),
349
+ skip: int = Query(0, ge=0)
 
350
  ):
351
  logger.info(f"Listing patients with search: {search}, limit: {limit}, skip: {skip}")
352
+ query = {"source": "synthea"}
353
 
354
  if search:
355
  query["$or"] = [
 
412
  detail=f"Failed to retrieve patients: {str(e)}"
413
  )
414
 
415
+ @router.get("/patients/{patient_id}", response_model=dict)
416
+ async def get_patient(patient_id: str):
 
 
 
417
  logger.info(f"Retrieving patient: {patient_id}")
418
  try:
419
  patient = await patients_collection.find_one({