diff --git a/app/api/routes/patient_encounter/delete_patient_encounter_uuid.py b/app/api/routes/patient_encounter/delete_patient_encounter_uuid.py index 7b9a78e..a300535 100644 --- a/app/api/routes/patient_encounter/delete_patient_encounter_uuid.py +++ b/app/api/routes/patient_encounter/delete_patient_encounter_uuid.py @@ -1,5 +1,4 @@ import logging -from typing import Any from uuid import UUID from fastapi import Depends, HTTPException, Response @@ -11,12 +10,10 @@ from api.main.auth import load_current_user from api.main.database import get_db from api.models.user import UserMedical as User -from api.models.patient_encounter import PatientEncounter from api.models.patient_encounter import ( get_patient_encounter_by_uuid, soft_delete_patient_encounter, ) -from api.schemas.patient_encounter import PatientEncounterSchema LOGGER = logging.getLogger(__name__) @@ -24,11 +21,10 @@ @router.delete( "/patient-encounter", status_code=204, - name="get-patient-encounter", + name="delete-patient-encounter", ) def delete_patient_encounter( uuid: UUID, - loaded_user: User = Depends(load_current_user), db: Session = Depends(get_db), ) -> Response: """ @@ -38,7 +34,7 @@ def delete_patient_encounter( encounter = get_patient_encounter_by_uuid(db, str(uuid)) except Exception as err: LOGGER.error(f"Server error while trying to find patient encounter: {err}") - return HTTPException( + raise HTTPException( status_code=500, detail="Unable to find that patient encounter at this time. Please try again later or contact support.", ) @@ -52,7 +48,7 @@ def delete_patient_encounter( soft_delete_patient_encounter(db, str(uuid)) except Exception as err: LOGGER.error(f"Server error while trying to delete patient encounter: {err}") - return HTTPException( + raise HTTPException( status_code=500, detail="Unable to delete patient encounter at this time. Please try again later or contact support.", ) diff --git a/app/api/routes/patient_encounter/get_latest_patient_encounter_rfid.py b/app/api/routes/patient_encounter/get_latest_patient_encounter_rfid.py index 5d639b0..6ecbecc 100644 --- a/app/api/routes/patient_encounter/get_latest_patient_encounter_rfid.py +++ b/app/api/routes/patient_encounter/get_latest_patient_encounter_rfid.py @@ -1,5 +1,4 @@ import logging -from uuid import UUID from typing import Any from fastapi import Depends, HTTPException @@ -25,9 +24,8 @@ ) def get_latest_patient_encounter_rfid( patient_rfid: str, - loaded_user: User = Depends(load_current_user), db: Session = Depends(get_db), -) -> Any: +) -> PatientEncounterResponseSchema: """ Retrieve a patient encounter from the database with the provided RFID. """ @@ -37,7 +35,7 @@ def get_latest_patient_encounter_rfid( LOGGER.error( f"Server error while trying to get patient encounter: {err}", ) - return HTTPException( + raise HTTPException( status_code=500, detail="Unable to get patient encounter at this time. Please try again later or contact support.", ) diff --git a/app/api/routes/patient_encounter/get_patient_encounter_uuid.py b/app/api/routes/patient_encounter/get_patient_encounter_uuid.py index 329d1a9..ecc8b09 100644 --- a/app/api/routes/patient_encounter/get_patient_encounter_uuid.py +++ b/app/api/routes/patient_encounter/get_patient_encounter_uuid.py @@ -25,9 +25,8 @@ ) def get_patient_encounter( uuid: UUID, - loaded_user: User = Depends(load_current_user), db: Session = Depends(get_db), -) -> Any: +) -> PatientEncounterResponseSchema: """ Retrieve a patient encounter from the database with the provided UUID. """ @@ -37,7 +36,7 @@ def get_patient_encounter( LOGGER.error( f"Server error while trying to get patient encounters: {err}", ) - return HTTPException( + raise HTTPException( status_code=500, detail="Unable to get patient encounters at this time. Please try again later or contact support.", ) diff --git a/app/api/routes/patient_encounter/get_patient_encounters.py b/app/api/routes/patient_encounter/get_patient_encounters.py index 35997a7..fd403e5 100644 --- a/app/api/routes/patient_encounter/get_patient_encounters.py +++ b/app/api/routes/patient_encounter/get_patient_encounters.py @@ -23,7 +23,6 @@ name="get-patient-encounters", ) def get_patient_encounters( - loaded_user: User = Depends(load_current_user), db: Session = Depends(get_db), arrival_date_min: Optional[str] = Query( None, description="The start date of the patient encounter(s) to retrieve." @@ -31,7 +30,7 @@ def get_patient_encounters( arrival_date_max: Optional[str] = Query( None, description="The end date of the patient encounter(s) to retrieve." ), -) -> Any: +) -> List[PatientEncounterResponseSchema]: """ Retrieve all patient encounters from the database and return a list of patient encounters. diff --git a/app/api/routes/patient_encounter/submit_patient_encounter.py b/app/api/routes/patient_encounter/submit_patient_encounter.py index 0183216..70db4df 100644 --- a/app/api/routes/patient_encounter/submit_patient_encounter.py +++ b/app/api/routes/patient_encounter/submit_patient_encounter.py @@ -29,7 +29,7 @@ def post_patient_encounter( data: PatientEncounterSchema, loaded_user: User = Depends(load_current_user), db: Session = Depends(get_db), -) -> Any: +) -> PatientEncounterResponseSchema: """ Create a new patient encounter. """ @@ -39,7 +39,7 @@ def post_patient_encounter( encounter = create_patient_encounter(db, new_encounter) except Exception as err: LOGGER.error(f"Server error while trying to create patient encounter: {err}") - return HTTPException( + raise HTTPException( status_code=500, detail="Unable to create patient encounter at this time. Please try again later or contact support.", ) diff --git a/app/api/routes/patient_encounter/update_patient_encounter.py b/app/api/routes/patient_encounter/update_patient_encounter.py index 7f94c5d..dd2c1ef 100644 --- a/app/api/routes/patient_encounter/update_patient_encounter.py +++ b/app/api/routes/patient_encounter/update_patient_encounter.py @@ -1,6 +1,5 @@ import logging from typing import Any -from uuid import UUID from fastapi import Depends, HTTPException @@ -30,9 +29,8 @@ ) def update_encounter( data: PatientEncounterResponseSchema, - loaded_user: User = Depends(load_current_user), db: Session = Depends(get_db), -) -> Any: +) -> PatientEncounterResponseSchema: """ Update a given patient encounter. In the event that a patient """ @@ -40,7 +38,7 @@ def update_encounter( encounter = get_patient_encounter_by_uuid(db, data.patient_encounter_uuid) except Exception as err: LOGGER.error(f"Server error while trying to retrieve patient encounter: {err}") - return HTTPException( + raise HTTPException( status_code=500, detail="Unable to retrieve patient encounter to update at this time. Please try again later or contact support.", ) @@ -57,7 +55,7 @@ def update_encounter( updated_encounter = update_patient_encounter(db, encounter, data_dict) except Exception as err: LOGGER.error(f"Server error while trying to update patient encounter: {err}") - return HTTPException( + raise HTTPException( status_code=500, detail="Unable to update patient encounter at this time. Please try again later or contact support.", )