Ejemplo n.º 1
0
    def setup_site_labs(self):
        """Sets up the site_lab global."""
        site_labs._registry = {}
        site_labs.loaded = False

        self.profile_aliquot_count = 3

        # create aliquots and their relationship
        a = AliquotType(name="aliquot_a", numeric_code="55", alpha_code="AA")
        b = AliquotType(name="aliquot_b", numeric_code="66", alpha_code="BB")
        a.add_derivatives(b)

        # set up processes
        process = Process(aliquot_type=b,
                          aliquot_count=self.profile_aliquot_count)
        processing_profile = ProcessingProfile(name="process", aliquot_type=a)
        processing_profile.add_processes(process)

        # create a panel
        self.panel = RequisitionPanel(name="panel",
                                      processing_profile=processing_profile)

        # lab profile
        self.lab_profile = LabProfile(name="lab_profile",
                                      requisition_model=self.requisition_model)
        self.lab_profile.add_panel(self.panel)

        # register with site
        site_labs.register(lab_profile=self.lab_profile)
Ejemplo n.º 2
0
 def test_assert_cannot_add_duplicate_process(self):
     a = AliquotType(name="aliquot_a", numeric_code="55", alpha_code="AA")
     b = AliquotType(name="aliquot_b", numeric_code="66", alpha_code="BB")
     a.add_derivatives(b)
     process = Process(aliquot_type=b, aliquot_count=3)
     processing_profile = ProcessingProfile(name="process", aliquot_type=a)
     processing_profile.add_processes(process)
     self.assertRaises(ProcessingProfileAlreadyAdded,
                       processing_profile.add_processes, process)
Ejemplo n.º 3
0
 def test_add_processing(self):
     a = AliquotType(name="aliquot_a", numeric_code="55", alpha_code="AA")
     b = AliquotType(name="aliquot_b", numeric_code="66", alpha_code="BB")
     a.add_derivatives(b)
     process = Process(aliquot_type=b, aliquot_count=3)
     processing_profile = ProcessingProfile(name="process", aliquot_type=a)
     processing_profile.add_processes(process)
     panel = RequisitionPanel(name="Viral Load",
                              processing_profile=processing_profile)
     lab_profile = LabProfile(
         name="profile", requisition_model="edc_lab.subjectrequisition")
     lab_profile.add_panel(panel)
Ejemplo n.º 4
0
 def test_panel_adds_processing_profile(self):
     a = AliquotType(name="aliquot_a", numeric_code="55", alpha_code="AA")
     b = AliquotType(name="aliquot_b", numeric_code="66", alpha_code="BB")
     a.add_derivatives(b)
     process = Process(aliquot_type=b, aliquot_count=3)
     processing_profile = ProcessingProfile(name="process", aliquot_type=a)
     processing_profile.add_processes(process)
     panel = RequisitionPanel(name="some panel",
                              processing_profile=processing_profile)
     lab_profile = LabProfile(
         name="profile", requisition_model="edc_lab.subjectrequisition")
     lab_profile.add_panel(panel)
     self.assertEqual(panel, lab_profile.panels.get(panel.name))
Ejemplo n.º 5
0
 def setUp(self):
     self.requisition_model = "edc_lab.subjectrequisition"
     a = AliquotType(name="aliquot_a", numeric_code="55", alpha_code="AA")
     b = AliquotType(name="aliquot_b", numeric_code="66", alpha_code="BB")
     a.add_derivatives(b)
     process = Process(aliquot_type=b, aliquot_count=3)
     processing_profile = ProcessingProfile(name="process", aliquot_type=a)
     processing_profile.add_processes(process)
     panel = RequisitionPanel(name="Viral Load", processing_profile=processing_profile)
     self.lab_profile = LabProfile(name="profile", requisition_model=self.requisition_model)
     self.lab_profile.add_panel(panel)
     site_labs._registry = {}
     site_labs.loaded = False
     site_labs.register(lab_profile=self.lab_profile)
Ejemplo n.º 6
0
 def test_add_panel(self):
     """Assert same panel cannot be added twice."""
     a = AliquotType(name="aliquot_a", numeric_code="55", alpha_code="AA")
     b = AliquotType(name="aliquot_b", numeric_code="66", alpha_code="BB")
     a.add_derivatives(b)
     process = Process(aliquot_type=b, aliquot_count=3)
     processing_profile = ProcessingProfile(name="process", aliquot_type=a)
     processing_profile.add_processes(process)
     panel = RequisitionPanel(name="Viral Load",
                              processing_profile=processing_profile)
     lab_profile = LabProfile(
         name="profile", requisition_model="edc_lab.subjectrequisition")
     lab_profile.add_panel(panel)
     self.assertRaises(PanelAlreadyRegistered, lab_profile.add_panel, panel)
Ejemplo n.º 7
0
 def test_processing_ok(self):
     """Asserts CAN add process for aliquot B to a profile
     for aliquot A since B can be derived from A.
     """
     a = AliquotType(name="aliquot_a", numeric_code="55", alpha_code="AA")
     b = AliquotType(name="aliquot_b", numeric_code="66", alpha_code="BB")
     a.add_derivatives(b)
     process = Process(aliquot_type=b, aliquot_count=3)
     processing_profile = ProcessingProfile(name="process", aliquot_type=a)
     try:
         processing_profile.add_processes(process)
     except ProcessingProfileInvalidDerivative:
         self.fail(
             "ProcessingProfileInvalidDerivative unexpectedly raised.")
Ejemplo n.º 8
0
 def test_added_panel_knows_requisition_model(self):
     """Assert same panel cannot be added twice."""
     a = AliquotType(name="aliquot_a", numeric_code="55", alpha_code="AA")
     b = AliquotType(name="aliquot_b", numeric_code="66", alpha_code="BB")
     a.add_derivatives(b)
     process = Process(aliquot_type=b, aliquot_count=3)
     processing_profile = ProcessingProfile(name="process", aliquot_type=a)
     processing_profile.add_processes(process)
     panel = RequisitionPanel(name="Viral Load",
                              processing_profile=processing_profile)
     lab_profile = LabProfile(
         name="profile", requisition_model="edc_lab.subjectrequisition")
     lab_profile.add_panel(panel)
     panel = lab_profile.panels.get("Viral Load")
     self.assertEqual(panel.requisition_model, "edc_lab.subjectrequisition")
     self.assertEqual(panel.requisition_model_cls, SubjectRequisition)
Ejemplo n.º 9
0
    def get_panel_group():
        a = AliquotType(name="aliquot_a", numeric_code="55", alpha_code="AA")
        b = AliquotType(name="aliquot_b", numeric_code="66", alpha_code="BB")
        a.add_derivatives(b)
        process = Process(aliquot_type=b, aliquot_count=3)
        processing_profile = ProcessingProfile(name="process", aliquot_type=a)
        processing_profile.add_processes(process)
        rft_panel = RequisitionPanel(
            name="chemistry_rft",
            verbose_name="Chemistry: Renal Function Tests",
            abbreviation="RFT",
            processing_profile=processing_profile,
            utest_ids=["urea", "creatinine", "uric_acid", "egfr"],
        )

        lipids_panel = RequisitionPanel(
            name="chemistry_lipids",
            verbose_name="Chemistry: Lipids",
            abbreviation="LIPIDS",
            processing_profile=processing_profile,
            utest_ids=["ldl", "hdl", "trig"],
        )

        lft_panel = RequisitionPanel(
            name="chemistry_lft",
            verbose_name="Chemistry: Liver Function Tests",
            abbreviation="LFT",
            processing_profile=processing_profile,
            utest_ids=["ast", "alt", "alp", "amylase", "ggt", "albumin"],
        )

        return RequisitionPanelGroup(
            lft_panel,
            rft_panel,
            lipids_panel,
            name="chemistry",
            verbose_name="Chemistry: LFT, RFT, Lipids",
            reference_range_collection_name="default",
        )