Ejemplo n.º 1
0
    def testHasSourceCodeSystem_withValidCodeSystem_returnsTrue(self):
        """Test has_source_code_system when source_code_system is present."""
        birth_sex_valueset = uscore_codes_pb2.BirthSexValueSet()
        female_value_descriptor = (
            birth_sex_valueset.Value.DESCRIPTOR.values_by_number[
                birth_sex_valueset.Value.F])
        self.assertTrue(
            annotation_utils.has_source_code_system(female_value_descriptor))

        male_value_descriptor = (birth_sex_valueset.Value.DESCRIPTOR.
                                 values_by_number[birth_sex_valueset.Value.M])
        self.assertTrue(
            annotation_utils.has_source_code_system(male_value_descriptor))

        unk_value_descriptor = (birth_sex_valueset.Value.DESCRIPTOR.
                                values_by_number[birth_sex_valueset.Value.UNK])
        self.assertTrue(
            annotation_utils.has_source_code_system(unk_value_descriptor))
Ejemplo n.º 2
0
    def testGetSourceCodeSystem_withValidCodeSystem_returnsValue(self):
        """Test get_source_code_system when source_code_system is present."""
        birth_sex_valueset = uscore_codes_pb2.BirthSexValueSet()
        female_value_descriptor = (
            birth_sex_valueset.Value.DESCRIPTOR.values_by_number[
                birth_sex_valueset.Value.F])
        self.assertEqual(
            annotation_utils.get_source_code_system(female_value_descriptor),
            'http://terminology.hl7.org/CodeSystem/v3-AdministrativeGender')

        male_value_descriptor = (birth_sex_valueset.Value.DESCRIPTOR.
                                 values_by_number[birth_sex_valueset.Value.M])
        self.assertEqual(
            annotation_utils.get_source_code_system(male_value_descriptor),
            'http://terminology.hl7.org/CodeSystem/v3-AdministrativeGender')

        unk_value_descriptor = (birth_sex_valueset.Value.DESCRIPTOR.
                                values_by_number[birth_sex_valueset.Value.UNK])
        self.assertEqual(
            annotation_utils.get_source_code_system(unk_value_descriptor),
            'http://terminology.hl7.org/CodeSystem/v3-NullFlavor')