Create EHR with id
Create a new EHR with the specified ehr_id identifier.
The value of the ehr_id unique identifier MUST be valid HIER_OBJECT_ID value.
It is strongly RECOMMENDED that an UUID always be used for this.
An EHR_STATUS resource needs to be always created and committed in the new EHR. This resource MAY be also supplied by the client as the request body. If not supplied, a default EHR_STATUS will be used by the service with following attributes:
is_queryable: trueis_modifiable: truesubject: a PARTY_SELF object
All other required EHR attributes and resources will be automatically created as needed by the EHR creation semantics.
The optional cadasto-person-uid request header links the new EHR to an existing
Demographic PERSON in the same contribution.
See the Cadasto demographic link guide.
- Type: stringehr
_id requiredEHR identifier taken from EHR.ehr_id.value.
- Type: stringPrefer
RFC 7240 preference header. Multiple tokens may be sent in a single header as a comma-separated list (e.g.
Prefer: return=representation, include_item_tags) or as repeated headers. Cadasto recognises the following tokens:Token Where it applies Effect return=representationwrite endpoints Return the full updated resource in the response body. return=minimal(default on writes)write endpoints Empty response body. include_item_tags(Cadasto extension)read endpoints, and write endpoints when the request does not already carry an openehr-item-tagheaderEmit the openehr-item-tagresponse header with the current tags. On writes that shipopenehr-item-tagin the request, the token is implied — the response always echoes the tags. Omitted by default on reads. See the ITEM_TAG guide for details.The
Preference-Appliedresponse header echoes the tokens the server actually honoured (return=, plusinclude_item_tags/resolve_refswhen applied). - Type: string Format: uuidcadasto
-person -uid Links the EHR being created (or updated via EHR_STATUS) to an existing PERSON in the Demographic API. The link is written in the same contribution as the EHR/EHR_STATUS write.
Cadasto extension: this header is not part of the openEHR ITS-REST specification. Standard openEHR clients can continue to use
EHR_STATUS.subject.external_refandGET /ehr?subject_id=…&subject_namespace=…instead; the two mechanisms are independent and can coexist. See the Cadasto demographic link guide.Value must be a bare PERSON UID in the HIER_OBJECT_ID form (no
::<system>::<version>suffix). Versioned forms are rejected with400 Bad Request.On
PUT /ehr/{ehr_id}/ehr_statusthe link is append-only — an EHR that already has a link cannot be re-linked via this header and the request is rejected with409 Conflict.
An EHR_STATUS resource MAY be also supplied by the client as the request body.
An EHR_STATUS resource
- Type: stringarchetype
_node _id required - Type: booleanis
_modifiable required - Type: booleanis
_queryable required - namerequired
- _typeDiscriminatorenumconst:DV_TEXTrequiredvalues
- D
V _ T E X T
- valueType: stringrequired
- encodingType: object ·
- formattingType: string
- hyperlink
- languageType: object ·
- mappingsType: array object[] ·
- subjectrequired
- _typeDiscriminatorenumconst:PARTY_SELFrequiredvalues
- P
A R T Y _ S E L F
- externalType: object ·
_ref Identifier for parties in a demographic or identity service.
- Type: string_type
- Type: object ·archetype
_details - Type: object ·feeder
_audit - Type: array object[] ·links
- other
_details - _typeDiscriminatorType: string
- archetypeType: string
_node _id required - itemType: object ·required
- namerequired
- archetypeType: object ·
_details - feederType: object ·
_audit - linksType: array object[] ·
- uid
- application/json
- 400
400 Bad Requestis returned when the request URL or body (if provided) could not be parsed or has invalid content. - 409
409 ConflictUnable to create a new EHR due to a conflict. Possible causes:- The supplied
ehr_idis already used by an existing EHR. - The supplied
cadasto-person-uidalready points to another EHR.
- The supplied
- 422
422 Unprocessable Entityis returned when the suppliedcadasto-person-uiddoes not resolve to an existing PERSON in the Demographic API, or resolves to a non-PERSON actor (Organisation, Agent, Group, Role).
curl https://cataniamc.prod.cadasto.com/openehr/v1/ehr/7d44b88c-4199-4bad-97dc-d78268e01398 \
--request PUT \
--header 'Content-Type: application/json' \
--data '{
"archetype_node_id": "openEHR-EHR-EHR_STATUS.generic.v1",
"name": {
"value": "EHR status"
},
"subject": {
"_type": "PARTY_SELF"
},
"is_queryable": true,
"is_modifiable": true
}'
{
"system_id": {
"value": "9624982A-9F42-41A5-9318-AE13D5F5031F"
},
"ehr_id": {
"value": "7d44b88c-4199-4bad-97dc-d78268e01398"
},
"ehr_status": {
"id": {
"_type": "OBJECT_VERSION_ID",
"value": "8849182c-82ad-4088-a07f-48ead4180515::cataniamc.prod.cadasto.com::1"
},
"namespace": "local",
"type": "EHR_STATUS"
},
"ehr_access": {
"id": {
"_type": "OBJECT_VERSION_ID",
"value": "59a8d0ac-140e-4feb-b2d6-af99f8e68af8::cataniamc.prod.cadasto.com::1"
},
"namespace": "local",
"type": "EHR_ACCESS"
},
"time_created": {
"value": "2015-01-20T19:30:22.765+01:00"
}
}