Esempio n. 1
0
def enter_feedback(request):
    """
    Enter Clinic Feedback Forms
    """    
    def callback(xform, doc):
        return HttpResponseRedirect(reverse("landing_page")) 
    
    xform = get_xform_by_namespace("http://cidrz.org/bhoma/clinic_feedback")
    # TODO: generalize this better
    preloader_data = {"meta": {"clinic_id": settings.BHOMA_CLINIC_ID,
                               "user_id":   request.user.get_profile()._id,
                               "username":  request.user.username}}
    return xforms_views.play(request, xform.id, callback, preloader_data)
Esempio n. 2
0
def enter_mortality_register(request):
    """
    Enter community mortality register from neighborhood health committee members
    """   
    def callback(xform, doc):
        return HttpResponseRedirect(reverse("report_list"))  
    
    
    xform = get_xform_by_namespace("http://cidrz.org/bhoma/mortality_register")
    # TODO: generalize this better
    preloader_data = {"meta": {"clinic_id": settings.BHOMA_CLINIC_ID,
                               "user_id":   request.user.get_profile()._id,
                               "username":  request.user.username}}
    return xforms_views.play(request, xform.id, callback, preloader_data)
Esempio n. 3
0
def new_encounter(request, patient_id, encounter_slug):
    """A new encounter for a patient"""
    encounter_info = CLINIC_ENCOUNTERS[encounter_slug]
    
    def callback(xform, doc):
        if doc:
            new_form_workflow(doc, SENDER_CLINIC, patient_id)
        return HttpResponseRedirect(reverse("single_patient", args=(patient_id,)))  

    patient = CPatient.get(patient_id)

    xform = encounter_info.get_xform()
    # TODO: generalize this better
    preloader_tags = {"case": {"patient_id" : patient_id,
                               "age_years" : str(patient.age) if patient.age != None else '',
                               "dob": patient.birthdate.strftime('%Y-%m-%d') if patient.birthdate else '',
                               "gender" : patient.gender,
                               "bhoma_case_id" : "<uid>",
                               "case_id" : "<uid>"},
                      "meta": {"clinic_id": settings.BHOMA_CLINIC_ID,
                               "user_id":   request.user.get_profile()._id,
                               "username":  request.user.username}}
                               
    return xforms_views.play(request, xform.id, callback, preloader_tags)