Data publishing

Data search index

The DataStore smart contract is used to store medical record data.

The data is recorded in an anonymized and encrypted form so that it is not possible to link the data set to specific individuals.

ipEHR Stat - the service tracks smart contract data and uses it to build a tree. The service provides REST API to perform AQL queries and retrieve the required data.

AQL

AQL queries are used to search and filter data.

Archetype Query Language (AQL) is a declarative query language developed specifically for expressing queries used for searching and retrieving the clinical data found in archetype-based EHRs.

You can find a detailed description of the AQL specification on the openEHR website: https://specifications.openehr.org/releases/QUERY/latest/AQL.html

Query example: Get the latest 5 abnormal blood pressure values that were recorded in a health encounter for a specific patient.

SELECT
    obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude AS systolic,
    obs/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude AS diastlic,
    c/context/start_time AS date_time
FROM
    EHR [ehr_id/value=$ehrUid]
        CONTAINS COMPOSITION c [openEHR-EHR-COMPOSITION.encounter.v1]
            CONTAINS OBSERVATION obs [openEHR-EHR-OBSERVATION.blood_pressure.v1]
WHERE
    obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude >= 140 OR
    obs/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude >= 90
ORDER BY
    c/context/start_time DESC
LIMIT 5

On receipt of a request, the IPEHR gateway interprets the request into a set of conditions, which is used to search the DataSearch index structure and returns the result to the requestor as specific values or as links to documents containing the requested data.

At this stage, the AQL functionality is partially implemented. The implementation of a full-fledged AQL query interpreter will be done in the following steps.

FeatureImplementation

EHR documents data parsing

+

EHR data Tree index design

+

EHR data Tree index in-memory

+

AQL requests parsing

+

AQL processing on IPEHR-gateway

+

Select primitives

+

Select values

+

Select values with WHERE

+

Selevt values with WHERE EXISTS

+

Select values with WHERE AND

+

Select values with WHERE OR

+

Select values with WHERE NOT

+

Select values with WHERE AND (OR)

+

Select values and int value

+

Select multiple columns

+

Select with filter by EHR id

+

Select with filter by EHR id and obs. version

+

Select with $parametes

+

PROCESSOR

Select field

+

Select field with path_predicate

+

Select field[...]/value

+

Select o/field[...]/value1/value2 with alisas

+

Select primitive

+

LIMIT

limit

+

offset

+

Public statistics

ipEHR Oracle - subproject that contains all contracts and scripts for publishing and interacting with the oracle. Set of contracts for providing access to statistics on the blockchain, based on Ether and Chainlink, along with storage contracts and example contracts.

There is several types of statistical data delivery: direct delivery on request and request of data on a schedule.

  • Direct delivery. Is implemented as a task in Chainlink that receives requests from outside by listening to the Oracle contract. When the Consumer contract sends a request for the statistical data to Oracle, the job collects a small fee in Chainlink tokens and returns the result from the statistics server. For this case, we have an open API for statistics and documented schema of job for Chainlink. The contract for this request is not a library but a sample contract in which we request statistical data via Oracle from the certain job of Chainlink

  • Scheduled delivery. It consists of two contracts and the schema of a Chainlink job. This job automatically requests statistical data within the specified interval and sends it to a storage contract. All other external contracts can request statistical data from the storage contract. The implementation includes two contracts. The first is the storage itself. We publish it and pay for its updates. The second is the contract of a Consumer. It is a sample of a simple contract that requests statistical data from storage.

Also, a set of scripts was written for the provided contracts to simplify interaction and testing, with which you can publish and call contracts as well as view some of the Chainlink statuses and replenish its balance.

Last updated