(case, case_config, patient)
If we are confident of the patient matched to a case, save
    the patient's identifiers to the case.

    Raises DuplicateCaseMatch if external_id is about to be saved with a
        non-unique value.
If we are confident of the patient matched to a case, save
    the patient's identifiers to the case.
If we are confident of the patient matched to a case save the patient s identifiers to the case .
def save_match_ids(case, case_config, patient):
    """
    If we are confident of the patient matched to a case, save
    the patient's identifiers to the case.

    Raises DuplicateCaseMatch if external_id is about to be saved with a
        non-unique value.
    """
    def get_patient_id_type_uuids_values(patient_):
        yield PERSON_UUID_IDENTIFIER_TYPE_ID, patient_['uuid']
        for identifier in patient_['identifiers']:
            yield identifier['identifierType']['uuid'], identifier['identifier']

    case_config_ids = case_config['patient_identifiers']
    case_update = {}
    kwargs = {}
    for id_type_uuid, value in get_patient_id_type_uuids_values(patient):
        if id_type_uuid in case_config_ids:
            case_property = case_config_ids[id_type_uuid]['case_property']
            if case_property == 'external_id':
                check_duplicate_case_match(case, value)
                kwargs['external_id'] = value
            else:
                case_update[case_property] = value
    case_block = CaseBlock.deprecated_init(
        case_id=case.get_id,
        create=False,
        update=case_update,
        **kwargs
    )
    submit_case_blocks([case_block.as_text()], case.domain, xmlns=XMLNS_OPENMRS)
def save_match_ids ( case , case_config , patient ) : def get_patient_id_type_uuids_values ( patient_ ) : yield PERSON_UUID_IDENTIFIER_TYPE_ID , patient_ [ 'uuid' ] for identifier in patient_ [ 'identifiers' ] : yield identifier [ 'identifierType' ] [ 'uuid' ] , identifier [ 'identifier' ] case_config_ids = case_config [ 'patient_identifiers' ] case_update = { } kwargs = { } for id_type_uuid , value in get_patient_id_type_uuids_values ( patient ) : if id_type_uuid in case_config_ids : case_property = case_config_ids [ id_type_uuid ] [ 'case_property' ] if case_property == 'external_id' : check_duplicate_case_match ( case , value ) kwargs [ 'external_id' ] = value else : case_update [ case_property ] = value case_block = CaseBlock . deprecated_init ( case_id = case . get_id , create = False , update = case_update , * * kwargs ) submit_case_blocks ( [ case_block . as_text ( ) ] , case . domain , xmlns = XMLNS_OPENMRS )