Skip to content

Commit 5fa9a94

Browse files
committedDec 12, 2021
fixed ehr.system_id representation
1 parent c2d4964 commit 5fa9a94

File tree

4 files changed

+6
-26
lines changed

4 files changed

+6
-26
lines changed
 

‎src/main/groovy/com/cabolabs/openehr/formats/OpenEhrJsonParser.groovy

+1-4
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,12 @@ class OpenEhrJsonParser {
4141

4242
def ehr = new Ehr()
4343

44-
ehr.system_id = map.system_id // NOTE: this is HIER_OBJECT_ID in newer specs, we might need to check the type, though in RM 1.0.2 this is a string
44+
ehr.system_id = this.parseHIER_OBJECT_ID(map.system_id)
4545

4646
ehr.ehr_id = this.parseHIER_OBJECT_ID(map.ehr_id)
4747

4848
ehr.time_created = this.parseDV_DATE_TIME(map.time_created)
4949

50-
// TODO
51-
//ehr.ehr_status = this.parseEhrStatus(map.ehr_status)
52-
5350
ehr.ehr_status = this.parseOBJECT_REF(map.ehr_status)
5451

5552
// the references to versioned objects are not parsed, for instance, this is the right parsing for a rest EHR response

‎src/main/groovy/com/cabolabs/openehr/rm_1_0_2/ehr/Ehr.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import com.cabolabs.openehr.rm_1_0_2.support.identification.ObjectRef
1313
*/
1414
class Ehr {
1515

16-
String system_id
16+
HierObjectId system_id
1717
HierObjectId ehr_id
1818
DvDateTime time_created
1919
ObjectRef ehr_status

‎src/main/groovy/com/cabolabs/openehr/rm_1_0_2/support/identification/HierObjectId.groovy

-19
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,4 @@ package com.cabolabs.openehr.rm_1_0_2.support.identification
22

33
class HierObjectId extends UIDBasedId {
44

5-
UID getObjectId()
6-
{
7-
// TODO
8-
}
9-
10-
VersionTreeId getVersionTreeId()
11-
{
12-
// TODO
13-
}
14-
15-
UID getCreatingSystemId()
16-
{
17-
// TODO
18-
}
19-
20-
boolean isBranch()
21-
{
22-
// TODO
23-
}
245
}

‎src/test/groovy/com/cabolabs/openehr/opt/OpenEhrJsonParserTest.groovy

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ class OpenEhrJsonParserTest extends GroovyTestCase {
4141
// NOTE: in RM 1.0.2 system_id is a string, in newer specs it is a HIER_OBJECT_ID
4242
def json_ehr = $/
4343
{
44-
"system_id": "d60e2348-b083-48ce-93b9-916cef1d3a5a",
44+
"system_id": {
45+
"value": "d60e2348-b083-48ce-93b9-916cef1d3a5a"
46+
},
4547
"ehr_id": {
4648
"value": "7d44b88c-4199-4bad-97dc-d78268e01398"
4749
},
@@ -62,7 +64,7 @@ class OpenEhrJsonParserTest extends GroovyTestCase {
6264
def parser = new OpenEhrJsonParser()
6365
Ehr ehr = parser.parseEhr(json_ehr)
6466

65-
assert ehr.system_id == "d60e2348-b083-48ce-93b9-916cef1d3a5a"
67+
assert ehr.system_id.value == "d60e2348-b083-48ce-93b9-916cef1d3a5a"
6668

6769
assert ehr.ehr_status.id.value == "8849182c-82ad-4088-a07f-48ead4180515::openEHRSys.example.com::1"
6870
assert ehr.ehr_status.type == "EHR_STATUS"

0 commit comments

Comments
 (0)