示例#1
0
def admin_patient_view() -> List[Patient]:
    """
    Returns the admin patient view (i.e., all patients).

    :return: A list of patients
    """
    return crud.read_all(Patient)
示例#2
0
def admin_referral_view() -> List[Referral]:
    """
    Returns the Admin referral view (i.e., all referrals).

    :return: All referrals in the database
    """
    return crud.read_all(Referral)
 def get():
     facilities = crud.read_all(HealthFacility)
     if util.query_param_bool(request, "simplified"):
         # If responding to a "simplified" request, only return the names of the
         # facilities and no other information
         return [f.healthFacilityName for f in facilities]
     else:
         # Otherwise, return all information about the health facilities
         return [marshal.marshal(f) for f in facilities]
示例#4
0
def admin_referral_view(**kwargs) -> List[Referral]:
    """
    Returns the Admin referral view (i.e., all referrals).

    :return: All referrals in the database
    """
    if not kwargs:
        return crud.read_all(Referral)
    else:
        # getting information for Referral table (Admin view)
        return crud.read_all_admin_view(Referral, **kwargs)
示例#5
0
def admin_patient_view(**kwargs) -> List[Patient]:
    """
    Returns the admin patient view (i.e., all patients).

    :return: A list of patients (filtered based on the parameters)
    """
    if not kwargs:
        # getting all the patient + readings + followups + urine tests
        return crud.read_all(Patient)
    else:
        # getting information for patient table (Admin view)
        return crud.read_all_admin_view(Patient, **kwargs)
def has_association_by_id(patient_id: str = None,
                          facility_name: str = None,
                          user_id: int = None) -> bool:
    """
    Returns true if the supplied models are associated with one another.

    :param patient_id: A patient id
    :param facility_name: A facility name
    :param user_id: A user id
    :return: True if there is an association between the objects, otherwise False
    """
    kw = dict()
    if patient_id:
        kw["patientId"] = patient_id
    if facility_name:
        kw["healthFacilityName"] = facility_name
    if user_id:
        kw["userId"] = user_id
    if not kw:
        raise TypeError("at least one keyword argument is required")
    return crud.read_all(PatientAssociations, **kw) != []
示例#7
0
 def get():
     follow_ups = crud.read_all(FollowUp)
     return [marshal.marshal(f) for f in follow_ups]