예제 #1
0
 def setUp(self):
     self.case_config = OpenmrsCaseConfig.wrap({
         'patient_identifiers': {
             'uuid': {'doc_type': 'CaseProperty', 'case_property': 'openmrs_uuid'},
             'e2b97b70-1d5f-11e0-b929-000c29ad1d07': {'doc_type': 'CaseProperty', 'case_property': 'nid'}
         },
         'match_on_ids': ['uuid'],
         'person_properties': {
             'gender': {'doc_type': 'CaseProperty', 'case_property': 'sex'},
             'birthdate': {'doc_type': 'CaseProperty', 'case_property': 'dob'},
         },
         'person_preferred_name': {
             'givenName': {'doc_type': 'CaseProperty', 'case_property': 'first_name'},
             'familyName': {'doc_type': 'CaseProperty', 'case_property': 'last_name'},
         },
         'person_preferred_address': {
             'address1': {'doc_type': 'CaseProperty', 'case_property': 'address_1'},
             'address2': {'doc_type': 'CaseProperty', 'case_property': 'address_2'},
         },
         'person_attributes': {
             'c1f4239f-3f10-11e4-adec-0800271c1b75': {'doc_type': 'CaseProperty', 'case_property': 'caste'},
             'c1f455e7-3f10-11e4-adec-0800271c1b75': {
                 'doc_type': 'CasePropertyMap',
                 'case_property': 'class',
                 'value_map': {
                     'sc': 'c1fcd1c6-3f10-11e4-adec-0800271c1b75',
                     'general': 'c1fc20ab-3f10-11e4-adec-0800271c1b75',
                     'obc': 'c1fb51cc-3f10-11e4-adec-0800271c1b75',
                     'other_caste': 'c207073d-3f10-11e4-adec-0800271c1b75',
                     'st': 'c20478b6-3f10-11e4-adec-0800271c1b75'
                 }
             },
         },
     })
     self.finder = WeightedPropertyPatientFinder.wrap({
         'doc_type': 'WeightedPropertyPatientFinder',
         'searchable_properties': ['last_name'],
         'property_weights': [
             {
                 "case_property": "first_name",
                 "weight": 0.45,
                 "match_type": "levenshtein",
                 "match_params": [0.2]
             },
             {"case_property": "last_name", "weight": 0.45},
             {
                 "case_property": "dob",
                 "weight": 0.2,
                 "match_type": "days_diff",
                 "match_params": [364]
             },
             {"case_property": "address_2", "weight": 0.2},
         ],
     })
     self.finder._property_map = get_property_map(self.case_config)
예제 #2
0
 def setUp(self):
     self.case_config = OpenmrsCaseConfig.wrap({
         'patient_identifiers': {
             'uuid': {'doc_type': 'CaseProperty', 'case_property': 'openmrs_uuid'},
             'e2b97b70-1d5f-11e0-b929-000c29ad1d07': {'doc_type': 'CaseProperty', 'case_property': 'nid'}
         },
         'match_on_ids': ['uuid'],
         'person_properties': {
             'gender': {'doc_type': 'CaseProperty', 'case_property': 'sex'},
             'birthdate': {'doc_type': 'CaseProperty', 'case_property': 'dob'},
         },
         'person_preferred_name': {
             'givenName': {'doc_type': 'CaseProperty', 'case_property': 'first_name'},
             'familyName': {'doc_type': 'CaseProperty', 'case_property': 'last_name'},
         },
         'person_preferred_address': {
             'address1': {'doc_type': 'CaseProperty', 'case_property': 'address_1'},
             'address2': {'doc_type': 'CaseProperty', 'case_property': 'address_2'},
         },
         'person_attributes': {
             'c1f4239f-3f10-11e4-adec-0800271c1b75': {'doc_type': 'CaseProperty', 'case_property': 'caste'},
             'c1f455e7-3f10-11e4-adec-0800271c1b75': {
                 'doc_type': 'CasePropertyMap',
                 'case_property': 'class',
                 'value_map': {
                     'sc': 'c1fcd1c6-3f10-11e4-adec-0800271c1b75',
                     'general': 'c1fc20ab-3f10-11e4-adec-0800271c1b75',
                     'obc': 'c1fb51cc-3f10-11e4-adec-0800271c1b75',
                     'other_caste': 'c207073d-3f10-11e4-adec-0800271c1b75',
                     'st': 'c20478b6-3f10-11e4-adec-0800271c1b75'
                 }
             },
         },
     })
     self.finder = WeightedPropertyPatientFinder.wrap({
         'doc_type': 'WeightedPropertyPatientFinder',
         'searchable_properties': ['last_name'],
         'property_weights': [
             {
                 "case_property": "first_name",
                 "weight": 0.45,
                 "match_type": "levenshtein",
                 "match_params": [0.2]
             },
             {"case_property": "last_name", "weight": 0.45},
             {
                 "case_property": "dob",
                 "weight": 0.2,
                 "match_type": "days_diff",
                 "match_params": [364]
             },
             {"case_property": "address_2", "weight": 0.2},
         ],
     })
     self.finder._property_map = get_property_map(self.case_config)