- Create ehr #1 and Save ehr_id as
{ehr_id_1}
- Get ehr_status for ehr #1 with
{ehr_id_1}
and save id as{ehr_status_id_1}
- Get ehr_status for ehr #1 with
- Create ehr #2 and Save ehr_id as
{ehr_id_2}
- Get ehr_status for ehr #2 with
{ehr_id_2}
and save id as{ehr_status_id_2}
- Get ehr_status for ehr #2 with
- Delete ehr #2 with
{ehr_id_2}
- Create ehr #3 and Save ehr_id as
{ehr_id_3}
- Get ehr_status for ehr #3 with
{ehr_id_3}
and save id as {ehr_status_id_3}
- Get ehr_status for ehr #3 with
- Update ehr status #3 with {ehr_status_id_3} set
subject
"subject": { "external_ref": { "id": { "_type": "GENERIC_ID", "value": "ext_id_42", "scheme": "id_scheme" }, "namespace": "examples", "type": "PERSON" } }
- Run Query
SELECT cv/uid/value, cv/commit_audit/time_committed/value, cv/commit_audit/change_type/value, cv/commit_audit/change_type/defining_code/code_string, cv/commit_audit/change_type/defining_code/preferred_term, cv/commit_audit/change_type/defining_code/terminology_id/value, s/subject/external_ref/id/value FROM VERSION cv[LATEST_VERSION] CONTAINS EHR_STATUS s ORDER BY cv/commit_audit/time_committed ASC
- Check result
[ [ "ae6432e3-aa7a-41c6-93b6-0589071502c9::local.ehrbase.org::1", "2024-03-04T09:07:23.894303+01:00", "creation", "249", "creation", "openehr", null ], [ "cf6a6118-7e25-4837-b99c-0fa134fa4396::local.ehrbase.org::2", "2024-03-04T09:11:01.225664+01:00", "modification", "251", "modification", "openehr", "ext_id_42" ] ]
Contributions for all 2 ehr_status objects.
- Run Query
SELECT cv/uid/value, cv/contribution/id/value, cv/commit_audit/time_committed/value FROM VERSION cv[LATEST_VERSION] CONTAINS EHR_STATUS s ORDER BY cv/commit_audit/time_committed ASC
- Obtain contribution ids
- row[0]
{ehr_id_1}
cv/uid/value as{ehr_status_id_1}
and cv/contribution/id/value as {contrib_id_1} - row[1]
{ehr_id_2}
cv/uid/value as{ehr_status_id_2}
and cv/contribution/id/value as {contrib_id_2}
- row[0]
- Verify contributions exist and valid
GET rest/openehr/v1/ehr/{ehr_id_1}/contribution/{contrib_id_1}
versions/value =={ehr_status_id_1}
GET rest/openehr/v1/ehr/{ehr_id_2}/contribution/{contrib_id_2}
versions/value =={ehr_status_id_2}
SELECT
{path}
FROM VERSION cv[LATEST_VERSION]
CONTAINS EHR_STATUS s
{where}
{order_by}
{path} | {where} | {order_by} | result |
---|---|---|---|
cv/uid/value | WHERE {path} = '{ehr_status_id_3} ' |
ORDER BY {path} DESC | {ehr_status_id_3} |
cv/commit_audit/system_id | WHERE {path} = 'local.ehrbase.org' | ["local.ehrbase.org"], ["local.ehrbase.org"] | |
cv/commit_audit/change_type | ./version/status.version.latest.change_type.json | ||
cv/commit_audit/change_type/value | WHERE {path} = 'modification' | ORDER BY {path} | modification |
cv/commit_audit/change_type/defining_code/code_string | WHERE {path} = '249' | ORDER BY {path} ASC | 249 |
cv/commit_audit/change_type/defining_code/preferred_term | WHERE {path} = 'creation' | ORDER BY {path} DESC | creation |
cv/commit_audit/change_type/defining_code/terminology_id/value | ["openehr"], ["openehr"] |
- Upload
persistent_minimal.opt
if not exist - Upload
conformance_ehrbase.de.v0.opt
if not exist - Create ehr #1 as
{ehr_id_1}
- Create composition #1.1 via contribution with commit audit using
minimal_persistent.contribution.json
andversions[0].id.value
as{comp_id_1_1}
- Create composition #1.2
persistent_minimal.en.v1__full.json
as{comp_id_1_2}
- Update composition #1.2 with
{comp_id_1_2}
at0001/at0002/at0003/at0004/value = "Updated Text for version 2"
to version 2 - Update composition #1.2 with
{comp_id_1_2}
at0001/at0002/at0003/at0004/value = "Updated Text for version 3"
to version 3 - Create composition #1.3
persistent_minimal.en.v1__full.json
as{comp_id_1_3}
- Update composition #1.3 with
{comp_id_1_3}
at0001/at0002/at0003/at0004/value = "Updated Text for version 2"
to version 2 - Create composition #1.4
persistent_minimal.en.v1__full.json
as{comp_id_1_4}
- Delete composition #1.4 with
{comp_id_1_4}
- Create composition #1.5
conformance_ehrbase.de.v0_max.json
as{comp_id_1_5}
- Create composition #1.1 via contribution with commit audit using
- Create ehr #2 as
{ehr_id_2}
- Create composition #2.1
persistent_minimal.en.v1__full.json
as{comp_id_2_1}
- Delete composition #2.2 with
{comp_id_2_1}
- Delete ehr #2
- Create composition #2.1
- Create ehr #3 as
{ehr_id_3}
- Get ehr_status for ehr #3 with
{ehr_id_3}
and save id as{ehr_status_id_3}
- Get ehr_status for ehr #3 with
- Update ehr #3 with
{ehr_status_id_3}
to version 2 setsubject
"subject": { "external_ref": { "id": { "_type": "GENERIC_ID", "value": "ext_id_42", "scheme": "id_scheme" }, "namespace": "examples", "type": "PERSON" } }
- Create composition #3.1
persistent_minimal.en.v1__full.json
as{comp_id_3_1}
- Update composition #3.1 with
{comp_id_3_1}
at0001/at0002/at0003/at0004/value = "ehr 3 composition version 2"
to version 2 - Create composition #3.2
conformance_ehrbase.de.v0_max.json
as{comp_id_3_2}
- Create composition #3.1
Fixture dataset is now (ordered by time_committed ASC)
[ehr #1 / composition #1.1]::local.ehrbase.org::1 (openEHR-EHR-COMPOSITION.persistent_minimal.v1)
[ehr #1 / composition #1.2]::local.ehrbase.org::3 (openEHR-EHR-COMPOSITION.persistent_minimal.v1)
[ehr #1 / composition #1.3]::local.ehrbase.org::2 (openEHR-EHR-COMPOSITION.persistent_minimal.v1)
[ehr #1 / composition #1.4]::local.ehrbase.org::1 (openEHR-EHR-COMPOSITION.conformance_composition_.v0)
[ehr #2 / DELETED]
[ehr #3 / composition #3.1]::local.ehrbase.org::2 (openEHR-EHR-COMPOSITION.persistent_minimal.v1)
[ehr #3 / composition #3.2]::local.ehrbase.org::1 (openEHR-EHR-COMPOSITION.conformance_composition_.v0)
- Run Query
SELECT e/ehr_id/value, c/archetype_details/template_id/value, cv/uid/value, cv/commit_audit/time_committed/value FROM EHR e CONTAINS VERSION cv[LATEST_VERSION] CONTAINS COMPOSITION c ORDER BY cv/commit_audit/time_committed
- Check result
[ [ {ehr_id_1}, "persistent_minimal.en.v1", {comp_id_1_1}, "2024-03-04T13:24:38.335587+01:00" ], [ {ehr_id_1}, "persistent_minimal.en.v1", {comp_id_1_2}", "2024-03-04T13:29:27.973907+01:00" ], [ {ehr_id_1}, "persistent_minimal.en.v1", {comp_id_1_3}, "2024-03-04T13:30:54.757872+01:00" ], [ {ehr_id_1}, "conformance-ehrbase.de.v0", {comp_id_1_5}, "2024-03-04T13:33:11.637201+01:00" ], [ {ehr_id_3}, "persistent_minimal.en.v1", {comp_id_3_1}, "2024-03-04T13:43:27.198659+01:00" ], [ {ehr_id_3}, "conformance-ehrbase.de.v0", {como_id_3_2}, "2024-03-04T13:48:27.589896+01:00" ] ]
Contributions for the 2 compositions created for template openEHR-EHR-COMPOSITION.conformance_composition_.v0
.
- Run Query
SELECT cv/uid/value, cv/contribution/id/value, cv/commit_audit/time_committed/value FROM VERSION cv[LATEST_VERSION] CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.conformance_composition_.v0] ORDER BY cv/commit_audit/time_committed ASC
- Obtain contribution ids
- row[0]
{ehr_id_1}
cv/uid/value as{comp_id_1_5}
and cv/contribution/id/value as {contrib_id_1} - row[1]
{ehr_id_3}
cv/uid/value as {como_id_3_2} and cv/contribution/id/value as {contrib_id_2}
- row[0]
- Verify contributions exist and valid
GET rest/openehr/v1/ehr/{ehr_id_1}/contribution/{comp_id_1_5}
versions/value =={comp_id_1_5}
GET rest/openehr/v1/ehr/{ehr_id_3}/contribution/{como_id_3_2}
versions/value == {como_id_3_2}
Run tests for path value on compositions for template openEHR-EHR-COMPOSITION.persistent_minimal.v1
.
SELECT
{path}
FROM VERSION cv[LATEST_VERSION]
CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.persistent_minimal.v1]
{where}
{order_by}
{path} | {where} | {order_by} | result |
---|---|---|---|
cv/uid/value | WHERE {path} = '{comp_id_1_2} ' |
ORDER BY {path} | {comp_id_1_2} |
cv/commit_audit/system_id | WHERE cv/commit_audit/system_id > 'local.' | ["local.ehrbase.org"], ["local.ehrbase.org"], ["local.ehrbase.org"], ["local.ehrbase.org"] | |
cv/commit_audit/change_type | ./version/composition.version.latest.change_type.json | ||
cv/commit_audit/change_type/value | WHERE {path} = 'creation' | ORDER BY {path} | creation |
cv/commit_audit/change_type/defining_code/code_string | WHERE {path} = '251' | ORDER BY {path} DESC | ["251"], ["251"], ["251"] |
cv/commit_audit/change_type/defining_code/preferred_term | WHERE {path} = 'creation' | ORDER BY {path} | creation |
cv/commit_audit/change_type/defining_code/terminology_id/value | WHERE {path} > 'open' | ["openehr"], ["openehr"], ["openehr"], ["openehr"] | |
cv/uid/value, cv/commit_audit/description | WHERE cv/uid/value = '{comp_id_1_1} ' |
./version/composition.version.latest.commit_audit.json | |
cv/commit_audit/description/value | WHERE {path} = '<optional audit description>' | ORDER BY {path} ASC | optional audit description |
Use the same fixture set as in VERSION[LATEST_VERSION] CONTAINS COMPOSITION
- Run Query
SELECT e/ehr_id/value, o/archetype_details/template_id/value, o/archetype_details/archetype_id/value, cv/uid/value, cv/commit_audit/time_committed/value, o/data[at0001]/events[at0002]/data[at0003]/items[at0004]/value/value FROM EHR e CONTAINS VERSION cv[LATEST_VERSION] CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.minimal.v1] ORDER BY cv/commit_audit/time_committed LIMIT 2 OFFSET 1
- Check result
[ [ {ehr_id_1}, "persistent_minimal.en.v1", "openEHR-EHR-OBSERVATION.minimal.v1", {comp_id_1_2}, "2024-03-04T13:29:27.973907+01:00", "Updated Text for version 3" ], [ {ehr_id_1}, "persistent_minimal.en.v1", "openEHR-EHR-OBSERVATION.minimal.v1", {comp_id_1_3}, "2024-03-04T13:30:54.757872+01:00", "Updated Text for version 2" ] ]
Contributions for the 42 compositions created for observation openEHR-EHR-OBSERVATION.minimal.v1
.
- Run Query
SELECT e/ehr_id/value, cv/uid/value, cv/contribution/id/value, cv/commit_audit/time_committed/value FROM EHR e CONTAINS VERSION cv[LATEST_VERSION] CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.minimal.v1] ORDER BY cv/commit_audit/time_committed ASC
- Obtain contribution ids
- row[0]
{ehr_id_1}
cv/uid/value as{comp_id_1_1}
and cv/contribution/id/value as {contrib_id_1} - row[1]
{ehr_id_1}
cv/uid/value as{comp_id_1_2}
and cv/contribution/id/value as {contrib_id_2} - row[2]
{ehr_id_1}
cv/uid/value as{comp_id_1_3}
and cv/contribution/id/value as {contrib_id_3} - row[2] {ehr_id_3} cv/uid/value as
{comp_id_3_1}
and cv/contribution/id/value as {contrib_id_4}
- row[0]
- Verify contributions exist and valid
GET rest/openehr/v1/ehr/{ehr_id_1}/contribution/{contrib_id_1}
versions/value =={comp_id_1_1}
GET rest/openehr/v1/ehr/{ehr_id_1}/contribution/{contrib_id_2}
versions/value =={comp_id_1_2}
GET rest/openehr/v1/ehr/{ehr_id_1}/contribution/{contrib_id_3}
versions/value =={comp_id_1_3}
GET rest/openehr/v1/ehr/{ehr_id_3}/contribution/{contrib_id_4}
versions/value =={comp_id_3_1}
Run tests for path value on compositions for template openEHR-EHR-COMPOSITION.persistent_minimal.v1
.
SELECT
{path}
FROM VERSION cv[LATEST_VERSION]
CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.minimal.v1]
{where}
{order_by}
{path} | {where} | {order_by} | result |
---|---|---|---|
cv/uid/value | WHERE {path} = '{comp_id_3_1} ' |
ORDER BY {path} | {comp_id_3_1} |
cv/commit_audit/system_id | WHERE cv/commit_audit/system_id > 'local.' | ["local.ehrbase.org"], ["local.ehrbase.org"], ["local.ehrbase.org"], ["local.ehrbase.org"] | |
cv/commit_audit/change_type | WHERE cv/commit_audit/change_type/value = 'creation' | ./version/observation.version.latest.change_type.json | |
cv/commit_audit/change_type/value | WHERE {path} = 'creation' | ORDER BY {path} DESC | creation |
cv/commit_audit/change_type/defining_code/code_string | WHERE {path} = '249' | ORDER BY {path} ASC | 249 |
cv/commit_audit/change_type/defining_code/preferred_term | WHERE {path} = 'creation' | ORDER BY {path} | creation |
cv/commit_audit/change_type/defining_code/terminology_id/value | WHERE {path} > 'open' | ["openehr"], ["openehr"], ["openehr"], ["openehr"] | |
cv/uid/value, cv/commit_audit/description | WHERE cv/uid/value = '{comp_id_1_1} ' |
./version/composition.version.latest.commit_audit.json | |
cv/commit_audit/description/value | WHERE {path} = '<optional audit description>' | ORDER BY {path} DESC | optional audit description |