(self)
return subtasks
Returns WorkflowTasks for creating visits, encounters and observations
Returns WorkflowTasks for creating visits, encounters and observations
Returns WorkflowTasks for creating visits encounters and observations
def run(self):
        """
        Returns WorkflowTasks for creating visits, encounters and observations
        """
        subtasks = []
        provider_uuid = getattr(self.openmrs_config, 'openmrs_provider', None)
        location_uuid = (
            get_ancestor_location_openmrs_uuid(self.info)
            or get_unknown_location_uuid(self.requests)  # If we don't
            # set a location, OpenMRS sets it to NULL. That's OK for
            # OpenMRS, but it breaks Bahmni. Bahmni has an "Unknown
            # Location". Use that, if it exists.
        )
        for form_config in self.openmrs_config.form_configs:
            if form_config.xmlns == self.form_json['form']['@xmlns']:
                start_datetime, stop_datetime = self._get_start_stop_datetime(form_config)
                subtasks.append(
                    CreateOptionalVisitTask(
                        self.requests,
                        person_uuid=self.person_uuid,
                        provider_uuid=provider_uuid,
                        start_datetime=start_datetime,
                        stop_datetime=stop_datetime,
                        values_for_concept=get_values_for_concept(form_config, self.info),
                        encounter_type=form_config.openmrs_encounter_type,
                        openmrs_form=form_config.openmrs_form,
                        visit_type=form_config.openmrs_visit_type,
                        location_uuid=location_uuid,
                    )
                )
        return subtasks
def run ( self ) : subtasks = [ ] provider_uuid = getattr ( self . openmrs_config , 'openmrs_provider' , None ) location_uuid = ( get_ancestor_location_openmrs_uuid ( self . info ) or get_unknown_location_uuid ( self . requests ) # If we don't # set a location, OpenMRS sets it to NULL. That's OK for # OpenMRS, but it breaks Bahmni. Bahmni has an "Unknown # Location". Use that, if it exists. ) for form_config in self . openmrs_config . form_configs : if form_config . xmlns == self . form_json [ 'form' ] [ '@xmlns' ] : start_datetime , stop_datetime = self . _get_start_stop_datetime ( form_config ) subtasks . append ( CreateOptionalVisitTask ( self . requests , person_uuid = self . person_uuid , provider_uuid = provider_uuid , start_datetime = start_datetime , stop_datetime = stop_datetime , values_for_concept = get_values_for_concept ( form_config , self . info ) , encounter_type = form_config . openmrs_encounter_type , openmrs_form = form_config . openmrs_form , visit_type = form_config . openmrs_visit_type , location_uuid = location_uuid , ) ) return subtasks