(self, patient, case)
return sum(weights())
Return the sum of weighted properties to give an OpenMRS
        patient a score of how well they match a CommCare case.
Return the sum of weighted properties to give an OpenMRS
        patient a score of how well they match a CommCare case.
Return the sum of weighted properties to give an OpenMRS patient a score of how well they match a CommCare case .
def get_score(self, patient, case):
        """
        Return the sum of weighted properties to give an OpenMRS
        patient a score of how well they match a CommCare case.
        """
        def weights():
            for property_weight in self.property_weights:
                prop = property_weight['case_property']
                jsonpath, value_source_dict = self._property_map[prop]
                weight = property_weight['weight']

                matches = jsonpath.find(patient)
                for match in matches:
                    patient_value = match.value
                    case_value = case.get_case_property(prop)
                    match_type = property_weight['match_type']
                    match_params = property_weight['match_params']
                    match_function = partial(MATCH_FUNCTIONS[match_type], *match_params)
                    is_equivalent = match_function(deserialize(value_source_dict, patient_value), case_value)
                    yield weight if is_equivalent else 0

        return sum(weights())
def get_score ( self , patient , case ) : def weights ( ) : for property_weight in self . property_weights : prop = property_weight [ 'case_property' ] jsonpath , value_source_dict = self . _property_map [ prop ] weight = property_weight [ 'weight' ] matches = jsonpath . find ( patient ) for match in matches : patient_value = match . value case_value = case . get_case_property ( prop ) match_type = property_weight [ 'match_type' ] match_params = property_weight [ 'match_params' ] match_function = partial ( MATCH_FUNCTIONS [ match_type ] , * match_params ) is_equivalent = match_function ( deserialize ( value_source_dict , patient_value ) , case_value ) yield weight if is_equivalent else 0 return sum ( weights ( ) )