Example #1
0
def send_openmrs_visit(requests, info, form_config, person_uuid,
                       visit_datetime):
    create_visit(
        requests,
        person_uuid=person_uuid,
        visit_datetime=visit_datetime,
        values_for_concept={
            obs.concept: [obs.value.get_value(info)]
            for obs in form_config.openmrs_observations
            if obs.value.get_value(info)
        },
        encounter_type=form_config.openmrs_encounter_type,
        openmrs_form=form_config.openmrs_form,
        visit_type=form_config.openmrs_visit_type,
    )
Example #2
0
def send_openmrs_visit(requests, info, form_config, person_uuid, provider_uuid,
                       visit_datetime):
    create_visit(
        requests,
        person_uuid=person_uuid,
        provider_uuid=provider_uuid,
        visit_datetime=visit_datetime,
        values_for_concept={
            obs.concept: [obs.value.get_value(info)]
            for obs in form_config.openmrs_observations
            if obs.value.get_value(info)
        },
        encounter_type=form_config.openmrs_encounter_type,
        openmrs_form=form_config.openmrs_form,
        visit_type=form_config.openmrs_visit_type,
        # location_uuid=,  # location of case owner (CHW) > location[meta][openmrs_uuid]
    )
Example #3
0
def create_visits(requests, info, form_json, form_question_values, openmrs_config, person_uuid):
    provider_uuid = getattr(openmrs_config, 'openmrs_provider', None)
    info.form_question_values.update(form_question_values)
    for form_config in openmrs_config.form_configs:
        logger.debug('Send visit for form?', form_config, form_json)
        if form_config.xmlns == form_json['form']['@xmlns']:
            logger.debug('Yes')
            create_visit(
                requests,
                person_uuid=person_uuid,
                provider_uuid=provider_uuid,
                visit_datetime=string_to_utc_datetime(form_json['form']['meta']['timeEnd']),
                values_for_concept={obs.concept: [obs.value.get_value(info)]
                                    for obs in form_config.openmrs_observations
                                    if obs.value.get_value(info)},
                encounter_type=form_config.openmrs_encounter_type,
                openmrs_form=form_config.openmrs_form,
                visit_type=form_config.openmrs_visit_type,
                # location_uuid=,  # location of case owner (CHW) > location[meta][openmrs_uuid]
            )