MeasurementsResource

Builds, saves and reads measurement Observations.

  • Stable unknown
  • Release candidate since 0.1.0-rc.4
  • Development since 0.1.0-dev.24+fa54770
public final class MeasurementsResource

Builds, saves and reads measurement Observations. Get it from Ovok.measurements().

Methods

save

public MeasurementsResource.SaveObservationsResult save(
        Map<String, ?> parameters) throws IOException, InterruptedException

Builds Observations from measurement values and saves them in one FHIR transaction.

Parameters:

  • parameters: the measurement values; patientId names the patient, otherwise the signed-in user's patient is used

Returns: the save status and the FHIR transaction response

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public MeasurementsResource.SaveObservationsResult save(
        Map<String, ?> parameters,
        SaveObservationsOptions options) throws IOException, InterruptedException

Builds Observations from measurement values and saves them in one FHIR transaction.

Parameters:

  • parameters: the measurement values; patientId names the patient, otherwise the signed-in user's patient is used
  • options: save options; null uses the defaults

Returns: the save status and the FHIR transaction response

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

saveObservations

public MeasurementsResource.SaveObservationsResult saveObservations(
        List<JsonNode> observations) throws IOException, InterruptedException

Saves Observations in one FHIR transaction.

Parameters:

  • observations: the Observations to save

Returns: the save status and the FHIR transaction response

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public MeasurementsResource.SaveObservationsResult saveObservations(
        List<JsonNode> observations,
        SaveObservationsOptions options) throws IOException, InterruptedException

Saves Observations in one FHIR transaction.

Parameters:

  • observations: the Observations to save
  • options: save options; null uses the defaults

Returns: the save status and the FHIR transaction response

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
  • OvokConflictException: if the signed-in account changes during the save

build

public List<JsonNode> build(Map<String, ?> parameters)

Builds Observations from measurement values without sending them.

Parameters:

  • parameters: the measurement values; patientId names the patient, otherwise the signed-in user's patient is used

Returns: the Observations

Throws:

latest

public JsonNode latest(Map<String, ?> parameters) throws IOException, InterruptedException

Reads the latest Observation per code (GET /fhir/Observation/$lastn).

Parameters:

  • parameters: patientId or me: true, codes, and an optional date lower bound

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode latest(
        Map<String, ?> parameters,
        RequestOptions options) throws IOException, InterruptedException

Reads the latest Observation per code (GET /fhir/Observation/$lastn).

Parameters:

  • parameters: patientId or me: true, codes, and an optional date lower bound
  • options: per-request options, such as the timeout

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

lastForPatient

public JsonNode lastForPatient(
        String patientId,
        Map<String, ?> query) throws IOException, InterruptedException

Reads a patient's last observations (GET /patient/{patientId}/observation).

Parameters:

  • patientId: the patient ID
  • query: query parameters, sent as given

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode lastForPatient(
        String patientId,
        Map<String, ?> query,
        RequestOptions options) throws IOException, InterruptedException

Reads a patient's last observations (GET /patient/{patientId}/observation).

Parameters:

  • patientId: the patient ID
  • query: query parameters, sent as given
  • options: per-request options, such as the timeout

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

codesFor

public String codesFor(List<String> measurementTypes)

Returns the comma-separated LOINC codes for measurement types.

Parameters:

  • measurementTypes: the measurement type names

Returns: the codes, joined with commas

MeasurementsResource.SaveObservationsResult

public static record SaveObservationsResult(String status, JsonNode response)

Result of saving Observations.

Components:

  • status: the save status, saved
  • response: the FHIR transaction response

Last updated on

On this page