OpenMRSObservationService

public interface OpenMRSObservationService

Interface for handling observations on the OpenMRS server.

Methods

createObservation

Observation createObservation(String configName, Observation observation)

Creates the given observation on the OpenMRS server. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • observation – the observation to be created
Returns:

the created observation

createOrUpdateObservationFromJson

Observation createOrUpdateObservationFromJson(String configName, String observationUuid, String observationJson)

Creates the given observation on the OpenMRS server. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • observationUuid – the UUID of the observation
  • observationJson – the observation json to be created
Returns:

the created observation

deleteObservation

void deleteObservation(String configName, String uuid)

Deletes the observation with the given uuid from the OpenMRS server. If the observation with the given uuid doesn’t exist an error will be logged. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • uuid – the UUID of the observation

findObservation

Observation findObservation(String configName, String motechId, String conceptName)

Returns the latest observation of the concept with the given conceptName for a patient with the given motechId. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • motechId – the MOTECH ID of the patient
  • conceptName – the name of the observation concept
Returns:

the latest observation for the given concept name and patient MOTECH ID

findObservations

List<Observation> findObservations(String configName, String patientMotechId, String conceptName)

Returns a list of observations of the concept with the given conceptName for a patient with the given motechId. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • patientMotechId – the MOTECH ID of the patient
  • conceptName – the name of the observation concept
Returns:

the list of observations for the given concept name and patient MOTECH ID

getLatestObservationByEncounterUUIDAndConceptUUID

Observation getLatestObservationByEncounterUUIDAndConceptUUID(String configName, String encounterUUID, String conceptUUID)

Returns the latest observation with given encounterUUID and conceptUUID. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • encounterUUID – the UUID of the encounter
  • conceptUUID – the UUID of the concept
Returns:

the latest observation with the given patientUUID, conceptUUID and value, null if the observation doesn’t exist

getLatestObservationByEncounterUUIDConceptUUIDAndValue

Observation getLatestObservationByEncounterUUIDConceptUUIDAndValue(String configName, String encounterUUID, String conceptUUID, String value)

Returns the latest observation with given encounterUUID, conceptUUID and value. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • encounterUUID – the UUID of the encounter
  • conceptUUID – the UUID of the concept
  • value – the observation value
Returns:

the latest observation with the given patientUUID, conceptUUID and value, null if the observation doesn’t exist

getLatestObservationByPatientUUIDAndConceptUUID

Observation getLatestObservationByPatientUUIDAndConceptUUID(String configName, String patientUUID, String conceptUUID)

Returns the observation with given uuid. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • patientUUID – the UUID of the patient
  • conceptUUID – the UUID of the concept
Returns:

the latest observation with the given patientUUID and conceptUUID, null if the observation doesn’t exist

getLatestObservationByPatientUUIDConceptUUIDAndValue

Observation getLatestObservationByPatientUUIDConceptUUIDAndValue(String configName, String patientUUID, String conceptUUID, String value)

Returns the latest observation with given patientUUID, conceptUUID and value. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • patientUUID – the UUID of the patient
  • conceptUUID – the UUID of the concept
  • value – the observation value
Returns:

the latest observation with the given patientUUID, conceptUUID and value, null if the observation doesn’t exist

getObservationByUuid

Observation getObservationByUuid(String configName, String uuid)

Returns the observation with given uuid. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • uuid – the UUID of the observation
Returns:

the observation with the given UUID, null if the observation doesn’t exist

voidObservation

void voidObservation(String configName, Observation observation, String reason)

Voids the given observation with the given reason. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • observation – the observation to be voided
  • reason – the reason for voiding the observation
Throws: