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:
| Field | Type | Required | Default | Allowed values |
|---|---|---|---|---|
ehr_id | STRING | Mandatory | — | — |
prefer | STRING | Optional | return=minimal | return=(representation|minimal|identifier) |
accept | STRING | Optional | application/json | application/(json|xml) |
content_type | STRING | Optional | application/json | application/(json|xml) |
openehr_item_tag | ARRAY | Optional | - | — |
openehr_version_item_tag | ARRAY | Optional | - | — |
content | JSON | Mandatory | — | — |
http_status_code | STRING | set by server | — | — |
response | JSON | set by server | — | — |