Beispiel #1
0
 def test_add_enumerated_item(self):
     eni1 = ODM.EnumeratedItem(CodedValue="HGB", OrderNumber=1)
     eni1.Alias = [ODM.Alias(Context="nci:ExtCodeID", Name="C64848")]
     self.cl.EnumeratedItem.append(eni1)
     eni2 = ODM.EnumeratedItem(CodedValue="VITB12", OrderNumber=2)
     eni2.Alias = [ODM.Alias(Context="nci:ExtCodeID", Name="C64817")]
     self.cl.EnumeratedItem.append(eni2)
     eni3 = ODM.EnumeratedItem(CodedValue="GLUC", OrderNumber=3)
     eni3.Alias = [ODM.Alias(Context="nci:ExtCodeID", Name="C41376")]
     self.cl.EnumeratedItem.append(eni3)
     ei_dict = self.cl.to_dict()
     print(ei_dict)
     self.assertDictEqual(ei_dict, self.expected_eni_dict())
Beispiel #2
0
 def test_to_dict(self):
     attrs = self._set_attributes()
     eni = ODM.EnumeratedItem(**attrs)
     eni.Alias.append(ODM.Alias(Context="nci:ExtCodeID", Name="C64848"))
     eni_dict = eni.to_dict()
     self.assertEqual(eni_dict["CodedValue"], "HGB")
     self.assertDictEqual(eni_dict, self.expected_dict())
Beispiel #3
0
 def test_to_xml(self):
     attrs = self._set_attributes()
     eni = ODM.EnumeratedItem(**attrs)
     eni.Alias.append(ODM.Alias(Context="nci:ExtCodeID", Name="C64848"))
     eni_xml = eni.to_xml()
     self.assertEqual(eni_xml.attrib["CodedValue"], "HGB")
     alias_elem = eni_xml.find("Alias")
     self.assertEqual(alias_elem.attrib["Name"], "C64848")
Beispiel #4
0
 def test_to_dict(self):
     attrs = self._set_attributes()
     cl = ODM.CodeList(**attrs)
     eni = ODM.EnumeratedItem(CodedValue="HGB", OrderNumber=1)
     eni.Alias = [ODM.Alias(Context="nci:ExtCodeID", Name="C64848")]
     cl.EnumeratedItem.append(eni)
     eni.Alias.append(ODM.Alias(Context="nci:ExtCodeID", Name="C65047"))
     cl_dict = cl.to_dict()
     self.assertDictEqual(cl_dict, self.expected_json_dict())
Beispiel #5
0
 def test_to_xml(self):
     attrs = self._set_attributes()
     cl = ODM.CodeList(**attrs)
     eni = ODM.EnumeratedItem(CodedValue="HGB", OrderNumber=1)
     eni.Alias = [ODM.Alias(Context="nci:ExtCodeID", Name="C64848")]
     cl.EnumeratedItem.append(eni)
     eni.Alias.append(ODM.Alias(Context="nci:ExtCodeID", Name="C65047"))
     cl_xml = cl.to_xml()
     self.assertEqual(cl_xml.attrib["OID"], "ODM.CL.LBTESTCD")
     ei = cl_xml.find("EnumeratedItem")
     self.assertEqual(ei.attrib["CodedValue"], "HGB")
Beispiel #6
0
 def test_CodeList(self):
     attrs = {
         "OID": "ODM.CL.LBTESTCD",
         "Name": "Laboratory Test Code",
         "DataType": "text"
     }
     cl = ODM.CodeList(**attrs)
     eni = ODM.EnumeratedItem(CodedValue="HGB", OrderNumber=1)
     eni.Alias = [ODM.Alias(Context="nci:ExtCodeID", Name="C64848")]
     cl.EnumeratedItem.append(eni)
     eni.Alias.append(ODM.Alias(Context="nci:ExtCodeID", Name="C65047"))
     cl_dict = cl.to_dict()
     print(cl_dict)
     is_valid = self.validator.verify_conformance(cl_dict, "CodeList")
     self.assertTrue(is_valid)
Beispiel #7
0
 def setUp(self) -> None:
     attrs = self._set_attributes()
     self.eni = ODM.EnumeratedItem(**attrs)