There are some non FHIR functions available for your convenience.

Storing configuration

Writing a configuration object

Each plugin may store a configuration JSON on the server. This piece of information may only be read by the plugin itself and is updateable. To store a configuration call:

POST /v1/plugins_api/config/set

Pass these parameters as JSON body:

{
  "authToken" : The authentication token you got
  "config" : A JSON object you want to store as your configration
}

You will receive an empty status 200 response.

Reading a configuration object

To read a configutation object previously stored, call:

POST /v1/plugins_api/config/get

with this JSON body:

{
  "authToken" : The authentication token you got
}

As response you will receive your configuration JSON back. If no configuration has been stored you will receive an empty status 200 response.

Counting records

If the app needs an overview about how many records are there, what formats or groups they belong to and/or how old they are a summary query may help. Please note that on larger data sets a summary query will be executed much faster than a regular query.

For a summary query call this endpoint:

POST /v1/records/summary

The request needs a JSON body with these parameters:

{
     "authToken": the token from the authentication request,
     "summarize" : the level of grouping required,
     "properties" : a key-value map with restrictions. (May be empty) 
}

Possible values for summarize parameter are:

  • ALL - returns one entry summarizing everything
  • GROUP - returns one entry for each semantical group
  • FORMAT - returns one entry for each FHIR resource type used
  • CONTENT - returns one entry for each content type (coding) used
  • SINGLE - returns one entry for each different type of record

Each key in the properties map restricts the returned records by one criteria. Each values in the properties map may be either a single value or an array of multiple values. In the array case each record must match one entry in the array to qualify for the query. Possible keys for properties are: (only those listed that are currently supported)

  • format - (string) the technical format of the record (FHIR resource type)
  • content - (string) the semantical format of the record (main coding used in a resource)
  • group - (string) the group of the record may be one of the given groups or a child of those.
  • app - (string) the app that created the record

The response to the query is an array of information objects looking like that:

 [
   {
      "count" : 10000,
      "oldest" : 1442491494782,
      "newest" : 1442491882705,
      "calculated" : 1447336206527,
      "formats" : ["measurements"],
      "contents" : ["food/water"],
      "groups" : ["nutrition"],
      "apps" : ["abc1234"],
      "newestRecord" : "midata:/55faadeae4b0b22590969f44"
   },
   {
      "count" : 101,
      "oldest" : 1442491223087,
      "newest" : 1442491287684,
      "calculated" : 1447336206862,
      "formats" : ["measurements"],
      "contents" : ["activities/fairly-active","activities/more-active"],
      "apps" : ["abc123"],
      "groups": ["movement"],
      "newestRecord" : "midata:/55faab97e4b0b2259096744a"
   }
 ]

The grouping of records into summary objects depend on the “summarize” parameter. In the example they are summarized by “GROUP”. The meaning of the fields are:

  • count - The number of records
  • oldest - timestamp of the oldest record
  • newest - timestamp of the newest record
  • calculated - calculation timestamp (internally used)
  • formats - list of different FHIR resource types summarized in this entry
  • contents - list of different “contents” (codings) of the records summarized in this entry
  • groups - list of different semantical “groups” of the records summarized in this entry
  • newestRecord - id of newest record in this group. May be used to fetch it in a separate query