Esempio n. 1
0
    def fire_for_record(self, repeat_record):
        form_json = json.loads(self.get_payload(repeat_record))

        trigger_case_infos = get_relevant_case_updates_from_form_json(
            self.domain, form_json, case_types=self.white_listed_case_types,
            extra_fields=[id_matcher.case_property
                          for id_matcher in self.openmrs_config.case_config.id_matchers])

        send_openmrs_data(Requests(self.url, self.username, self.password), form_json,
                          trigger_case_infos, self.openmrs_config)

        return repeat_record.handle_success(None)
Esempio n. 2
0
    def send_request(self, repeat_record, payload, verify=None):
        case_trigger_infos = get_relevant_case_updates_from_form_json(
            self.domain,
            payload,
            case_types=self.white_listed_case_types,
            extra_fields=[
                id_matcher.case_property
                for id_matcher in self.openmrs_config.case_config.id_matchers
            ])
        form_question_values = get_form_question_values(payload)

        return send_openmrs_data(
            Requests(self.url, self.username, self.password), payload,
            self.openmrs_config, case_trigger_infos, form_question_values)
Esempio n. 3
0
    def send_request(self, repeat_record, payload):
        value_sources = chain(
            six.itervalues(self.openmrs_config.case_config.patient_identifiers),
            six.itervalues(self.openmrs_config.case_config.person_properties),
            six.itervalues(self.openmrs_config.case_config.person_preferred_name),
            six.itervalues(self.openmrs_config.case_config.person_preferred_address),
            six.itervalues(self.openmrs_config.case_config.person_attributes),
        )
        case_trigger_infos = get_relevant_case_updates_from_form_json(
            self.domain, payload, case_types=self.white_listed_case_types,
            extra_fields=[vs.case_property for vs in value_sources if hasattr(vs, 'case_property')]
        )
        form_question_values = get_form_question_values(payload)

        return send_openmrs_data(
            self.requests,
            self.domain,
            payload,
            self.openmrs_config,
            case_trigger_infos,
            form_question_values
        )
Esempio n. 4
0
    def send_request(self, repeat_record, payload):
        value_sources = chain(
            six.itervalues(self.openmrs_config.case_config.patient_identifiers),
            six.itervalues(self.openmrs_config.case_config.person_properties),
            six.itervalues(self.openmrs_config.case_config.person_preferred_name),
            six.itervalues(self.openmrs_config.case_config.person_preferred_address),
            six.itervalues(self.openmrs_config.case_config.person_attributes),
        )
        case_trigger_infos = get_relevant_case_updates_from_form_json(
            self.domain, payload, case_types=self.white_listed_case_types,
            extra_fields=[vs.case_property for vs in value_sources if hasattr(vs, 'case_property')]
        )
        form_question_values = get_form_question_values(payload)

        return send_openmrs_data(
            self.requests,
            self.domain,
            payload,
            self.openmrs_config,
            case_trigger_infos,
            form_question_values
        )