Esempio n. 1
0
async def create_form(
    form: Form, current_doctor: UserInDB = Depends(get_current_active_user)):
    try:
        Doctor(**current_doctor.dict()).create_form(form)
    except ValidationError as e:
        logger.exception(e)
        raise HTTPException(status_code=500,
                            detail=f"Form Structure could not be created")
    except Exception as e:
        logger.exception(e)
Esempio n. 2
0
async def create_model(
        file: UploadFile = File(...),
        current_doctor: UserInDB = Depends(get_current_active_user)):
    try:
        Doctor(**current_doctor.dict()).create_model(file)
    except ValidationError as e:
        logger.exception(e)
        raise HTTPException(status_code=500,
                            detail=f"Model could not be created")
    except Exception as e:
        logger.exception(e)
Esempio n. 3
0
async def prediction(file: UploadFile = File(...),
                     current_doctor: UserInDB = Depends(
                         get_current_active_user)) -> List[int]:
    try:
        prediction = Doctor(**current_doctor.dict()).prediction(file)
    except ValidationError as e:
        logger.exception(e)
        raise HTTPException(status_code=500,
                            detail=f"Alforithm could not be executed")
    except Exception as e:
        logger.exception(e)
    prediction_list: List[int] = prediction.tolist()
    return prediction_list
Esempio n. 4
0
async def delete_patient(
    id_patient: str,
    current_doctor: UserInDB = Depends(get_current_active_user)):
    print(id_patient)
    try:
        patient = Doctor(**current_doctor.dict()).delete(id_patient)
        logger.debug(patient)
    except ValidationError as e:
        logger.exception(e)
        raise HTTPException(status_code=500,
                            detail=f"Patient could not be deleted")
    except Exception as e:
        logger.exception(e)
Esempio n. 5
0
async def see_form(
        current_doctor: UserInDB = Depends(get_current_active_user)):
    form = None
    try:
        form = Doctor(**current_doctor.dict()).get_data_structure()
    except ValidationError as e:
        logger.exception(e)
        raise HTTPException(status_code=500,
                            detail=f"Form Structure doesn`t exist")
    except Exception as e:
        logger.exception(e)

    return form
Esempio n. 6
0
async def patients(
    id_patient, current_doctor: UserInDB = Depends(get_current_active_user)):
    patient = None
    # print(id_patient)
    try:
        patient = Doctor(**current_doctor.dict()).search_by_id(id_patient)
    except Exception as e:
        logger.exception(e)

    if not patient:
        raise HTTPException(status_code=404,
                            detail=f"No patients found for current user")

    return patient.clinical_information
Esempio n. 7
0
async def patients(current_doctor: UserInDB = Depends(
    get_current_active_user)) -> List[Patients]:
    # print("Devuelvo todos los pacientes")
    patients = []
    try:
        patients = Doctor(**current_doctor.dict()).all_patients()

    except Exception as e:
        logger.exception(e)

    # if not patients:
    # raise HTTPException(status_code=404, detail=f"No patients found for current user")

    return patients
Esempio n. 8
0
async def register(
    patient: dict, current_doctor: UserInDB = Depends(get_current_active_user)
) -> Patients:
    try:
        patient = Doctor(**current_doctor.dict()).new_patient(
            patient, current_doctor.dict())
        logger.debug(patient)
    except ValidationError as e:
        logger.exception(e)
        raise HTTPException(status_code=500,
                            detail=f"Patient could not be created")
    except Exception as e:
        logger.exception(e)

    return patient