Skip to content

Commit 7fa1cbb

Browse files
author
Grahame Grieve
committed
Add test case for .slice() in FHIRPath
1 parent 1e2c816 commit 7fa1cbb

File tree

3 files changed

+90
-11
lines changed

3 files changed

+90
-11
lines changed

validator/manifest.json

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20695,17 +20695,6 @@
2069520695
"ClinicalDocument.component.structuredBody.component[6].section.component[1].section.entry[0].observation.targetSiteCode[0].qualifier[0].name"
2069620696
]
2069720697
},
20698-
{
20699-
"severity": "information",
20700-
"code": "code-invalid",
20701-
"details": {
20702-
"text": "Binding has no source, so can''t be checked"
20703-
},
20704-
"diagnostics": "[755,34]",
20705-
"expression": [
20706-
"ClinicalDocument.component.structuredBody.component[6].section.component[1].section.entry[0].observation.entryRelationship[0].regionOfInterest.code"
20707-
]
20708-
},
2070920698
{
2071020699
"severity": "error",
2071120700
"code": "structure",
@@ -34429,6 +34418,34 @@
3442934418
}
3443034419
}
3443134420
},
34421+
{
34422+
"name": "slice-instance",
34423+
"file": "slice-instance.json",
34424+
"description": "Checking .slice() in constraints",
34425+
"version": "5.0",
34426+
"java": {
34427+
"outcome": {
34428+
"resourceType": "OperationOutcome"
34429+
}
34430+
},
34431+
"profile" : {
34432+
"source" : "slice-profile.json",
34433+
"java": {
34434+
"outcome": {
34435+
"resourceType" : "OperationOutcome",
34436+
"issue" : [{
34437+
"severity" : "error",
34438+
"code" : "invariant",
34439+
"details" : {
34440+
"text" : "Constraint failed: spt-1: 'Phone numbers must have a use'"
34441+
},
34442+
"diagnostics" : "[11,4]",
34443+
"expression" : ["Patient.telecom[2]"]
34444+
}]
34445+
}
34446+
}
34447+
}
34448+
},
3443234449
{
3443334450
"name": "zzz",
3443434451
"file": "zzz.json",

validator/slice-instance.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"resourceType" : "Patient",
3+
"id" : "slice-instance",
4+
"telecom" : [{
5+
"system" : "phone",
6+
"value" : "+1 555 111 1111",
7+
"use" : "home"
8+
}, {
9+
"system" : "email",
10+
"value" : "one@one.com"
11+
}, {
12+
"system" : "phone",
13+
"value" : "+1 555 222 2222"
14+
}, {
15+
"system" : "email",
16+
"value" : "two@two.com",
17+
"use" : "home"
18+
}]
19+
}

validator/slice-profile.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"resourceType": "StructureDefinition",
3+
"id": "slice-profile",
4+
"url": "http://hl7.org/fhir/test/StructureDefinition/slice-profile",
5+
"name": "SliceTestProfile",
6+
"status": "draft",
7+
"fhirVersion": "5.0.0",
8+
"kind": "resource",
9+
"abstract": false,
10+
"type": "Patient",
11+
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
12+
"derivation": "constraint",
13+
"differential": {
14+
"element": [{
15+
"path" : "Patient.telecom",
16+
"slicing" : {
17+
"discriminator" : [{
18+
"type" : "value",
19+
"path" : "system"
20+
}],
21+
"rules" : "open"
22+
},
23+
"constraint" : [{
24+
"key" : "spt-1",
25+
"severity" : "error",
26+
"human" : "Phone numbers must have a use",
27+
"expression" : "slice(%profile, 'phone').all(use.exists())"
28+
}]
29+
},{
30+
"path" : "Patient.telecom",
31+
"sliceName" : "phone"
32+
},{
33+
"path" : "Patient.telecom.system",
34+
"fixedCode" : "phone"
35+
},{
36+
"path" : "Patient.telecom",
37+
"sliceName" : "email"
38+
},{
39+
"path" : "Patient.telecom.system",
40+
"fixedCode" : "email"
41+
}]
42+
}
43+
}

0 commit comments

Comments
 (0)