Skip to main content

Inserting openEHR Data

Inserting openEHR data with SQL INSERT statement:

INSERT INTO create_composition (ehr_id, content) VALUES ("ehr-1", {
"archetype_node_id": "openEHR-EHR-COMPOSITION.encounter.v1",
"name": {"value": "Vital Signs"},
"uid": {"_type": "OBJECT_VERSION_ID", "value": "8849182c::openEHRSys.example.com::1"},
"archetype_details": {
"archetype_id": {"value": "openEHR-EHR-COMPOSITION.encounter.v1"},
"template_id": {"value": "Example.v1::c7ec861c-c413-39ff-9965-a198ebf44747"},
"rm_version": "1.0.2"
},
"language": {"terminology_id": {"value": "ISO_639-1"}, "code_string": "en"},
"content": [{"_type": "COMPOSITION"}]
})

Data is inserted into the create_composition table. A trigger on this table will automatically process and store the composition data into RM Document Types and edges.

Structure of the create_composition table follows the openEHR REST API:

FieldTypeRequiredDefaultAllowed values
ehr_idSTRINGMandatory
preferSTRINGOptionalreturn=minimalreturn=(representation|minimal|identifier)
acceptSTRINGOptionalapplication/jsonapplication/(json|xml)
content_typeSTRINGOptionalapplication/jsonapplication/(json|xml)
openehr_item_tagARRAYOptional-
openehr_version_item_tagARRAYOptional-
contentJSONMandatory
http_status_codeSTRINGset by server
responseJSONset by server