Example #1
0
class BaseRequisitionRuleGroup(RuleGroup):
    """Ensures an RBD requisition if HIV result is POS."""
    rbd_for_pos = RequisitionRule(
        logic=Logic(
            predicate=func_rbd,
            consequence='new',
            alternative='not_required'),
        target_model=[('bcpp_lab', 'subjectrequisition')],
        target_requisition_panels=['Research Blood Draw'], )

    vl_for_pos = RequisitionRule(
        logic=Logic(
            predicate=func_vl,
            consequence='new',
            alternative='not_required'),
        target_model=[('bcpp_lab', 'subjectrequisition')],
        target_requisition_panels=['Viral Load'], )

    """Ensures a Microtube is not required for POS."""
    microtube_for_neg = RequisitionRule(
        logic=Logic(
            predicate=func_show_microtube,
            consequence='new',
            alternative='not_required'),
        target_model=[('bcpp_lab', 'subjectrequisition')],
        target_requisition_panels=['Microtube'], )

    pima_for_art_naive = ScheduledDataRule(
        logic=Logic(
            predicate=func_require_pima,
            consequence='new',
            alternative='not_required'),
        target_model=['pima'])

#     pimavl_for_art_naive = ScheduledDataRule(
#         logic=Logic(
#             predicate=func_art_naive,
#             consequence='new',
#             alternative='not_required'),
#         target_model=['pimavl'])

    hic = ScheduledDataRule(
        logic=Logic(
            predicate=func_show_hic_enrollment,
            consequence='new',
            alternative='not_required'),
        target_model=['hicenrollment'])

    class Meta:
        abstract = True
Example #2
0
class RequisitionRuleGroup1(BaseRequisitionRuleGroup):

    """Ensures an ELISA blood draw requisition if HIV result is IND."""
    elisa_for_ind = RequisitionRule(
        logic=Logic(
            predicate=func_hiv_indeterminate_today,
            consequence='new',
            alternative='not_required'),
        target_model=[('bcpp_lab', 'subjectrequisition')],
        target_requisition_panels=['ELISA', ], )

    """Ensures a venous blood draw requisition is required if insufficient
    volume in the capillary (microtube)."""
    venous_for_vol = RequisitionRule(
        logic=Logic(
            predicate=(('insufficient_vol', 'equals', 'Yes'), ('blood_draw_type', 'equals', 'venous', 'or'),),
            consequence='new',
            alternative='not_required'),
        target_model=[('bcpp_lab', 'subjectrequisition')],
        target_requisition_panels=['Venous (HIV)'], )

    serve_sti_form = ScheduledDataRule(
        logic=Logic(
            predicate=func_hiv_positive_today,
            consequence='new',
            alternative='not_required'),
        target_model=['sti'])

    elisa_result = ScheduledDataRule(
        logic=Logic(
            predicate=func_hiv_indeterminate_today,
            consequence='new',
            alternative='not_required'),
        target_model=['elisahivresult'])

    class Meta:
        app_label = 'bcpp_subject'
        source_fk = (SubjectVisit, 'subject_visit')
        source_model = HivResult
Example #3
0
class StoolSamplingRuleGroup(RuleGroup):

    no_sample_taken = RequisitionRule(
        logic=Logic(predicate=('sample_obtained', 'equals', 'No'),
                    consequence='not_required',
                    alternative='new'),
        target_model=[('mpepu_lab', 'infantrequisition')],
        target_requisition_panels=['Stool storage'],
    )

    class Meta:
        app_label = 'mpepu_infant'
        source_fk = (InfantVisit, 'infant_visit')
        source_model = InfantStoolCollection
Example #4
0
class FeedingChoiceRuleGroup(RuleGroup):

    maternal_feeding_choice = RequisitionRule(
        logic=Logic(predicate=('maternal_feeding_choice', 'equals', 'FF'),
                    consequence='not_required',
                    alternative='new'),
        target_model=[('mpepu_lab', 'infantrequisition')],
        target_requisition_panels=['DNA PCR'],
    )

    class Meta:
        app_label = 'mpepu_infant'
        source_fk = (InfantVisit, 'infant_visit')
        source_model = InfantEligibility
Example #5
0
class ViralLoadTrackingRequisitionRuleGroup(RuleGroup):

    initiation = RequisitionRule(
        logic=Logic(predicate=('is_drawn', 'equals', 'No'),
                    consequence='new',
                    alternative='not_required'),
        target_model=[('bcpp_lab', 'clinicrequisition')],
        target_requisition_panels=['Clinic Viral Load'],
    )

    class Meta:
        app_label = 'bcpp_clinic'
        source_fk = (ClinicVisit, 'clinic_visit')
        source_model = ViralLoadTracking
Example #6
0
class InitiationRequisitionRuleGroup(RuleGroup):

    initiation = RequisitionRule(
        logic=Logic(predicate=(('registration_type', 'equals', 'initiation'),
                               ('registration_type', 'equals', 'OTHER', 'or')),
                    consequence='new',
                    alternative='not_required'),
        target_model=[('bcpp_lab', 'clinicrequisition')],
        target_requisition_panels=['Clinic Viral Load'],
    )

    class Meta:
        app_label = 'bcpp_clinic'
        source_fk = (ClinicVisit, 'clinic_visit')
        source_model = Questionnaire
Example #7
0
class RegisteredSubjectRuleGroup(RuleGroup):

    gender_circumsion = ScheduledDataRule(
        logic=Logic(
            predicate=func_should_not_show_circumsition,
            consequence='not_required',
            alternative='new'),
        target_model=['circumcision', 'circumcised', 'uncircumcised'])

    gender_menopause = ScheduledDataRule(
        logic=Logic(
            predicate=is_gender_male,
            consequence='not_required',
            alternative='new'),
        target_model=['reproductivehealth', 'pregnancy', 'nonpregnancy'])

    known_pos_in_y1 = ScheduledDataRule(
        logic=Logic(
            predicate=func_known_pos_in_prev_year,
            consequence='not_required',
            alternative='new'),
        target_model=['hivtestreview', 'hivtested', 'hivtestinghistory', 'hivresultdocumentation', 'hivresult', 'hivuntested'])

    pima_art_naive_enrollment_req_ahs = ScheduledDataRule(
        logic=Logic(
            predicate=func_require_pima,
            consequence='new',
            alternative='not_required'),
        target_model=['pima'])

    hiv_linkage_to_care = ScheduledDataRule(
        logic=Logic(
            predicate=func_hiv_neg_linkage_to_care,
            consequence='not_required',
            alternative='new'),
        target_model=['hivlinkagetocare'])

    require_microtube = RequisitionRule(
        logic=Logic(
            predicate=func_show_microtube,
            consequence='new',
            alternative='not_required'),
        target_model=[('bcpp_lab', 'subjectrequisition')],
        target_requisition_panels=['Microtube'])

    vl_for_pos = RequisitionRule(
        logic=Logic(
            predicate=func_vl,
            consequence='new',
            alternative='not_required'),
        target_model=[('bcpp_lab', 'subjectrequisition')],
        target_requisition_panels=['Viral Load'], )

    rbd_for_pos = RequisitionRule(
        logic=Logic(
            predicate=func_rbd,
            consequence='new',
            alternative='not_required'),
        target_model=[('bcpp_lab', 'subjectrequisition')],
        target_requisition_panels=['Research Blood Draw'], )

    class Meta:
        app_label = 'bcpp_subject'
        source_fk = None
        source_model = RegisteredSubject