Summary| Tags| Feature: observation/observation.feature| Observation Resource Validation
Scenario: [1:25] TC-OBS-001 | REQ-OBS-001 GET /Observation/{id} returns 200 and resourceType = Observation
ms: 10001
>>
Background:
14
* url baseUrl
0
21:55:50.229 baseUrl: https://hapi.fhir.org/baseR4 21:55:50.229 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5023
21:55:50.231 request: 1 > GET https://hapi.fhir.org/baseR4/Observation?subject%3Amissing=false&_count=1 1 > Host: hapi.fhir.org 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 1 > Accept-Encoding: gzip,deflate 21:55:55.252 response time in milliseconds: 5021 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Tue, 21 Apr 2026 21:55:55 GMT 1 < Content-Type: application/fhir+json;charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 1 < X-Request-ID: Oi5gk52Q25BpYFzY 1 < Last-Modified: Tue, 21 Apr 2026 21:55:55 GMT { "resourceType": "Bundle", "id": "f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1", "meta": { "lastUpdated": "2026-04-21T21:55:55.202+00:00" }, "type": "searchset", "link": [ { "relation": "self", "url": "https://hapi.fhir.org/baseR4/Observation?_count=1&subject%3Amissing=false" }, { "relation": "next", "url": "https://hapi.fhir.org/baseR4?_getpages=f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset" } ], "entry": [ { "fullUrl": "https://hapi.fhir.org/baseR4/Observation/131289234", "resource": { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }, "search": { "mode": "match" } } ] }
18
Then status 200
0
19
* def hasEntry = response.entry != null && response.entry.length > 0
0
20
* match hasEntry == true
0
21
* def observationId = response.entry[0].resource.id
0
22
* match response.entry[0].resource.resourceType == 'Observation'
0
23
* karate.log('Resolved observationId: ' + observationId)
0
21:55:55.254 Resolved observationId: 131289234
26
Given path 'Observation', observationId
0
27
When method GET
4974
21:55:55.255 request: 2 > GET https://hapi.fhir.org/baseR4/Observation/131289234 2 > Host: hapi.fhir.org 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 2 > Accept-Encoding: gzip,deflate 21:56:00.228 response time in milliseconds: 4972 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Tue, 21 Apr 2026 21:56:00 GMT 2 < Content-Type: application/fhir+json;charset=utf-8 2 < Transfer-Encoding: chunked 2 < Connection: keep-alive 2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 2 < ETag: W/"2" 2 < X-Request-ID: vUGC7fJoNWFMgYEL 2 < Content-Location: https://hapi.fhir.org/baseR4/Observation/131289234/_history/2 2 < Last-Modified: Thu, 26 Feb 2026 18:06:09 GMT { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }
28
Then status 200
0
29
And assert responseTime < 10000
0
30
And match responseHeaders['Content-Type'][0] contains 'application/fhir+json'
0
31
And match responseHeaders['ETag'][0] == '#present'
0
32
And match response.resourceType == 'Observation'
0
33
* karate.write(response, 'responses/observation/observation-read.json')
2
21:56:00.231 write to file: target/responses/observation/observation-read.json
Scenario: [2:35] TC-OBS-002 | REQ-OBS-002 status is a valid ObservationStatus value
ms: 9998
>>
Background:
14
* url baseUrl
0
21:55:51.226 baseUrl: https://hapi.fhir.org/baseR4 21:55:51.226 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5011
21:55:51.227 request: 1 > GET https://hapi.fhir.org/baseR4/Observation?subject%3Amissing=false&_count=1 1 > Host: hapi.fhir.org 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 1 > Accept-Encoding: gzip,deflate 21:55:56.238 response time in milliseconds: 5010 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Tue, 21 Apr 2026 21:55:56 GMT 1 < Content-Type: application/fhir+json;charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Cache: HIT from https://hapi.fhir.org/baseR4 1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 1 < X-Request-ID: WngskCoZhP1vcjPT 1 < Last-Modified: Tue, 21 Apr 2026 21:55:55 GMT { "resourceType": "Bundle", "id": "f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1", "meta": { "lastUpdated": "2026-04-21T21:55:55.202+00:00" }, "type": "searchset", "link": [ { "relation": "self", "url": "https://hapi.fhir.org/baseR4/Observation?_count=1&subject%3Amissing=false" }, { "relation": "next", "url": "https://hapi.fhir.org/baseR4?_getpages=f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset" } ], "entry": [ { "fullUrl": "https://hapi.fhir.org/baseR4/Observation/131289234", "resource": { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }, "search": { "mode": "match" } } ] }
18
Then status 200
0
19
* def hasEntry = response.entry != null && response.entry.length > 0
0
20
* match hasEntry == true
0
21
* def observationId = response.entry[0].resource.id
0
22
* match response.entry[0].resource.resourceType == 'Observation'
0
23
* karate.log('Resolved observationId: ' + observationId)
0
21:55:56.239 Resolved observationId: 131289234
36
Given path 'Observation', observationId
0
37
When method GET
4984
21:55:56.240 request: 2 > GET https://hapi.fhir.org/baseR4/Observation/131289234 2 > Host: hapi.fhir.org 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 2 > Accept-Encoding: gzip,deflate 21:56:01.223 response time in milliseconds: 4983 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Tue, 21 Apr 2026 21:56:01 GMT 2 < Content-Type: application/fhir+json;charset=utf-8 2 < Transfer-Encoding: chunked 2 < Connection: keep-alive 2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 2 < ETag: W/"2" 2 < X-Request-ID: SZs2oKFgiRVqyRJp 2 < Content-Location: https://hapi.fhir.org/baseR4/Observation/131289234/_history/2 2 < Last-Modified: Thu, 26 Feb 2026 18:06:09 GMT { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }
38
Then status 200
0
39
And match response.status == '#regex (registered|preliminary|final|amended|corrected|cancelled|entered-in-error|unknown)'
0
40
* karate.log('status: ' + response.status)
0
21:56:01.224 status: final
Scenario: [3:42] TC-OBS-003 | REQ-OBS-003 code.coding has system and code
ms: 9987
>>
Background:
14
* url baseUrl
0
21:55:52.238 baseUrl: https://hapi.fhir.org/baseR4 21:55:52.238 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5002
21:55:52.239 request: 1 > GET https://hapi.fhir.org/baseR4/Observation?subject%3Amissing=false&_count=1 1 > Host: hapi.fhir.org 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 1 > Accept-Encoding: gzip,deflate 21:55:57.240 response time in milliseconds: 5000 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Tue, 21 Apr 2026 21:55:57 GMT 1 < Content-Type: application/fhir+json;charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Cache: HIT from https://hapi.fhir.org/baseR4 1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 1 < X-Request-ID: JC2hqdV5Pbv4L3Qb 1 < Last-Modified: Tue, 21 Apr 2026 21:55:55 GMT { "resourceType": "Bundle", "id": "f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1", "meta": { "lastUpdated": "2026-04-21T21:55:55.202+00:00" }, "type": "searchset", "link": [ { "relation": "self", "url": "https://hapi.fhir.org/baseR4/Observation?_count=1&subject%3Amissing=false" }, { "relation": "next", "url": "https://hapi.fhir.org/baseR4?_getpages=f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset" } ], "entry": [ { "fullUrl": "https://hapi.fhir.org/baseR4/Observation/131289234", "resource": { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }, "search": { "mode": "match" } } ] }
18
Then status 200
0
19
* def hasEntry = response.entry != null && response.entry.length > 0
0
20
* match hasEntry == true
0
21
* def observationId = response.entry[0].resource.id
0
22
* match response.entry[0].resource.resourceType == 'Observation'
0
23
* karate.log('Resolved observationId: ' + observationId)
0
21:55:57.241 Resolved observationId: 131289234
43
Given path 'Observation', observationId
0
44
When method GET
4982
21:55:57.242 request: 2 > GET https://hapi.fhir.org/baseR4/Observation/131289234 2 > Host: hapi.fhir.org 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 2 > Accept-Encoding: gzip,deflate 21:56:02.223 response time in milliseconds: 4980 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Tue, 21 Apr 2026 21:56:02 GMT 2 < Content-Type: application/fhir+json;charset=utf-8 2 < Transfer-Encoding: chunked 2 < Connection: keep-alive 2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 2 < ETag: W/"2" 2 < X-Request-ID: vlyiS3Ssmz9Fx0En 2 < Content-Location: https://hapi.fhir.org/baseR4/Observation/131289234/_history/2 2 < Last-Modified: Thu, 26 Feb 2026 18:06:09 GMT { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }
45
Then status 200
0
46
And match response.code == '#present'
0
47
And match response.code.coding == '#[_ > 0]'
1
48
And match response.code.coding[0].system == '#present'
0
49
And match response.code.coding[0].code == '#present'
0
50
* karate.log('code system: ' + response.code.coding[0].system)
0
21:56:02.225 code system: http://loinc.org
51
* karate.log('code code: ' + response.code.coding[0].code)
0
21:56:02.225 code code: 29463-7
Scenario: [4:53] TC-OBS-004 | REQ-OBS-004 valueQuantity has value and unit (conditional)
ms: 15001
>>
Background:
14
* url baseUrl
0
21:55:54.231 baseUrl: https://hapi.fhir.org/baseR4 21:55:54.231 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5008
21:55:54.232 request: 1 > GET https://hapi.fhir.org/baseR4/Observation?subject%3Amissing=false&_count=1 1 > Host: hapi.fhir.org 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 1 > Accept-Encoding: gzip,deflate 21:55:59.239 response time in milliseconds: 5006 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Tue, 21 Apr 2026 21:55:59 GMT 1 < Content-Type: application/fhir+json;charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Cache: HIT from https://hapi.fhir.org/baseR4 1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 1 < X-Request-ID: w5sve4DG4ur6ktHI 1 < Last-Modified: Tue, 21 Apr 2026 21:55:55 GMT { "resourceType": "Bundle", "id": "f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1", "meta": { "lastUpdated": "2026-04-21T21:55:55.202+00:00" }, "type": "searchset", "link": [ { "relation": "self", "url": "https://hapi.fhir.org/baseR4/Observation?_count=1&subject%3Amissing=false" }, { "relation": "next", "url": "https://hapi.fhir.org/baseR4?_getpages=f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset" } ], "entry": [ { "fullUrl": "https://hapi.fhir.org/baseR4/Observation/131289234", "resource": { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }, "search": { "mode": "match" } } ] }
18
Then status 200
0
19
* def hasEntry = response.entry != null && response.entry.length > 0
0
20
* match hasEntry == true
0
21
* def observationId = response.entry[0].resource.id
0
22
* match response.entry[0].resource.resourceType == 'Observation'
0
23
* karate.log('Resolved observationId: ' + observationId)
0
21:55:59.240 Resolved observationId: 131289234
54
Given path 'Observation'
0
55
And params ({ 'value-quantity': 'gt0', '_count': '1' })
0
56
When method GET
5035
21:55:59.242 request: 2 > GET https://hapi.fhir.org/baseR4/Observation?value-quantity=gt0&_count=1 2 > Host: hapi.fhir.org 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 2 > Accept-Encoding: gzip,deflate 21:56:04.276 response time in milliseconds: 5033 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Tue, 21 Apr 2026 21:56:04 GMT 2 < Content-Type: application/fhir+json;charset=utf-8 2 < Transfer-Encoding: chunked 2 < Connection: keep-alive 2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 2 < X-Request-ID: 0T67QM5J0YQd3yWP 2 < Last-Modified: Tue, 21 Apr 2026 21:56:04 GMT { "resourceType": "Bundle", "id": "03ecdd88-0606-4c36-b810-f9af1ce0f21b", "meta": { "lastUpdated": "2026-04-21T21:56:04.202+00:00" }, "type": "searchset", "link": [ { "relation": "self", "url": "https://hapi.fhir.org/baseR4/Observation?_count=1&value-quantity=gt0" }, { "relation": "next", "url": "https://hapi.fhir.org/baseR4?_getpages=03ecdd88-0606-4c36-b810-f9af1ce0f21b&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset" } ], "entry": [ { "fullUrl": "https://hapi.fhir.org/baseR4/Observation/131448423", "resource": { "resourceType": "Observation", "id": "131448423", "meta": { "versionId": "1", "lastUpdated": "2026-03-22T06:03:32.940+00:00", "source": "#HhYxWEeAj93a8Rp9" }, "status": "final", "category": [ { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/observation-category", "code": "laboratory", "display": "Laboratory" } ] } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "89579-7", "display": "Troponin I.cardiac [Mass/volume] in Serum or Plasma by High sensitivity method" } ], "text": "Troponin I.cardiac [Mass/volume] in Serum or Plasma by High sensitivity method" }, "subject": { "reference": "Patient/131445867" }, "encounter": { "reference": "Encounter/131446293" }, "effectiveDateTime": "2024-03-18T02:38:26-05:00", "issued": "2024-03-18T02:38:26.284-05:00", "valueQuantity": { "value": 0.0037566, "unit": "pg/mL", "system": "http://unitsofmeasure.org", "code": "pg/mL" } }, "search": { "mode": "match" } } ] }
57
Then status 200
0
58
* def hasEntry = response.entry != null && response.entry.length > 0
0
59
* if (!hasEntry) karate.log('TC-OBS-004: SKIP — no Observation with valueQuantity found on server')
0
60
* def vqId = hasEntry ? response.entry[0].resource.id : null
0
61
* if (hasEntry) karate.call('classpath:observation/assert-value-quantity.feature', { vqId: vqId, baseUrl: baseUrl })
4956
>>
observation.assert-value-quantity
4951
7
Given url baseUrl
0
8
And path 'Observation', vqId
0
9
When method GET
4945
21:56:04.282 request: 1 > GET https://hapi.fhir.org/baseR4/Observation/131448423 1 > Host: hapi.fhir.org 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 1 > Accept-Encoding: gzip,deflate 21:56:09.226 response time in milliseconds: 4943 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Tue, 21 Apr 2026 21:56:09 GMT 1 < Content-Type: application/fhir+json;charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 1 < ETag: W/"1" 1 < X-Request-ID: si9Mp8firSC0OmP0 1 < Content-Location: https://hapi.fhir.org/baseR4/Observation/131448423/_history/1 1 < Last-Modified: Sun, 22 Mar 2026 06:03:32 GMT { "resourceType": "Observation", "id": "131448423", "meta": { "versionId": "1", "lastUpdated": "2026-03-22T06:03:32.940+00:00", "source": "#HhYxWEeAj93a8Rp9" }, "status": "final", "category": [ { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/observation-category", "code": "laboratory", "display": "Laboratory" } ] } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "89579-7", "display": "Troponin I.cardiac [Mass/volume] in Serum or Plasma by High sensitivity method" } ], "text": "Troponin I.cardiac [Mass/volume] in Serum or Plasma by High sensitivity method" }, "subject": { "reference": "Patient/131445867" }, "encounter": { "reference": "Encounter/131446293" }, "effectiveDateTime": "2024-03-18T02:38:26-05:00", "issued": "2024-03-18T02:38:26.284-05:00", "valueQuantity": { "value": 0.0037566, "unit": "pg/mL", "system": "http://unitsofmeasure.org", "code": "pg/mL" } }
10
Then status 200
0
11
And match response.valueQuantity == '#present'
0
12
And match response.valueQuantity.value == '#number'
0
13
And match response.valueQuantity.unit == '#string'
0
14
* karate.log('valueQuantity.value: ' + response.valueQuantity.value)
5
21:56:09.232 valueQuantity.value: 0.0037566
15
* karate.log('valueQuantity.unit: ' + response.valueQuantity.unit)
0
21:56:09.232 valueQuantity.unit: pg/mL
Scenario: [5:63] TC-OBS-005 | REQ-OBS-005 subject references Patient
ms: 9999
>>
Background:
14
* url baseUrl
0
21:55:58.226 baseUrl: https://hapi.fhir.org/baseR4 21:55:58.226 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5012
21:55:58.227 request: 1 > GET https://hapi.fhir.org/baseR4/Observation?subject%3Amissing=false&_count=1 1 > Host: hapi.fhir.org 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 1 > Accept-Encoding: gzip,deflate 21:56:03.238 response time in milliseconds: 5010 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Tue, 21 Apr 2026 21:56:03 GMT 1 < Content-Type: application/fhir+json;charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Cache: HIT from https://hapi.fhir.org/baseR4 1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 1 < X-Request-ID: I9xAmsxPYHECBGTP 1 < Last-Modified: Tue, 21 Apr 2026 21:55:55 GMT { "resourceType": "Bundle", "id": "f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1", "meta": { "lastUpdated": "2026-04-21T21:55:55.202+00:00" }, "type": "searchset", "link": [ { "relation": "self", "url": "https://hapi.fhir.org/baseR4/Observation?_count=1&subject%3Amissing=false" }, { "relation": "next", "url": "https://hapi.fhir.org/baseR4?_getpages=f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset" } ], "entry": [ { "fullUrl": "https://hapi.fhir.org/baseR4/Observation/131289234", "resource": { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }, "search": { "mode": "match" } } ] }
18
Then status 200
0
19
* def hasEntry = response.entry != null && response.entry.length > 0
0
20
* match hasEntry == true
0
21
* def observationId = response.entry[0].resource.id
0
22
* match response.entry[0].resource.resourceType == 'Observation'
0
23
* karate.log('Resolved observationId: ' + observationId)
1
21:56:03.239 Resolved observationId: 131289234
64
Given path 'Observation', observationId
0
65
When method GET
4984
21:56:03.240 request: 2 > GET https://hapi.fhir.org/baseR4/Observation/131289234 2 > Host: hapi.fhir.org 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 2 > Accept-Encoding: gzip,deflate 21:56:08.223 response time in milliseconds: 4983 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Tue, 21 Apr 2026 21:56:08 GMT 2 < Content-Type: application/fhir+json;charset=utf-8 2 < Transfer-Encoding: chunked 2 < Connection: keep-alive 2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 2 < ETag: W/"2" 2 < X-Request-ID: OUju0Qg2hg9cgN8r 2 < Content-Location: https://hapi.fhir.org/baseR4/Observation/131289234/_history/2 2 < Last-Modified: Thu, 26 Feb 2026 18:06:09 GMT { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }
66
Then status 200
0
67
And match response.subject == '#present'
0
68
And match response.subject.reference == '#string'
0
69
And match response.subject.reference == '#regex .*Patient.*'
0
70
* karate.log('subject reference: ' + response.subject.reference)
0
21:56:08.225 subject reference: Patient/131289233
Scenario: [6:72] TC-OBS-006 | REQ-OBS-006 | REQ-GEN-002a meta.lastUpdated is present
ms: 9991
>>
Background:
14
* url baseUrl
0
21:56:00.234 baseUrl: https://hapi.fhir.org/baseR4 21:56:00.234 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5003
21:56:00.235 request: 1 > GET https://hapi.fhir.org/baseR4/Observation?subject%3Amissing=false&_count=1 1 > Host: hapi.fhir.org 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 1 > Accept-Encoding: gzip,deflate 21:56:05.237 response time in milliseconds: 5001 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Tue, 21 Apr 2026 21:56:05 GMT 1 < Content-Type: application/fhir+json;charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Cache: HIT from https://hapi.fhir.org/baseR4 1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 1 < X-Request-ID: N4mR7KlJvnhqnumR 1 < Last-Modified: Tue, 21 Apr 2026 21:55:55 GMT { "resourceType": "Bundle", "id": "f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1", "meta": { "lastUpdated": "2026-04-21T21:55:55.202+00:00" }, "type": "searchset", "link": [ { "relation": "self", "url": "https://hapi.fhir.org/baseR4/Observation?_count=1&subject%3Amissing=false" }, { "relation": "next", "url": "https://hapi.fhir.org/baseR4?_getpages=f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset" } ], "entry": [ { "fullUrl": "https://hapi.fhir.org/baseR4/Observation/131289234", "resource": { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }, "search": { "mode": "match" } } ] }
18
Then status 200
0
19
* def hasEntry = response.entry != null && response.entry.length > 0
0
20
* match hasEntry == true
0
21
* def observationId = response.entry[0].resource.id
0
22
* match response.entry[0].resource.resourceType == 'Observation'
0
23
* karate.log('Resolved observationId: ' + observationId)
0
21:56:05.238 Resolved observationId: 131289234
73
Given path 'Observation', observationId
0
74
When method GET
4986
21:56:05.239 request: 2 > GET https://hapi.fhir.org/baseR4/Observation/131289234 2 > Host: hapi.fhir.org 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 2 > Accept-Encoding: gzip,deflate 21:56:10.224 response time in milliseconds: 4984 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Tue, 21 Apr 2026 21:56:10 GMT 2 < Content-Type: application/fhir+json;charset=utf-8 2 < Transfer-Encoding: chunked 2 < Connection: keep-alive 2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 2 < ETag: W/"2" 2 < X-Request-ID: 5UymvxX84D4ESF9i 2 < Content-Location: https://hapi.fhir.org/baseR4/Observation/131289234/_history/2 2 < Last-Modified: Thu, 26 Feb 2026 18:06:09 GMT { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }
75
Then status 200
0
76
And match response.meta.lastUpdated == '#present'
0
77
* karate.log('meta.lastUpdated: ' + response.meta.lastUpdated)
1
21:56:10.225 meta.lastUpdated: 2026-02-26T18:06:09.535+00:00
Scenario: [7:79] TC-OBS-007 | REQ-OBS-007 | REQ-OO-001 non-existent ID returns 404 and OperationOutcome
ms: 10002
>>
Background:
14
* url baseUrl
0
21:56:01.227 baseUrl: https://hapi.fhir.org/baseR4 21:56:01.227 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5010
21:56:01.228 request: 1 > GET https://hapi.fhir.org/baseR4/Observation?subject%3Amissing=false&_count=1 1 > Host: hapi.fhir.org 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 1 > Accept-Encoding: gzip,deflate 21:56:06.237 response time in milliseconds: 5009 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Tue, 21 Apr 2026 21:56:06 GMT 1 < Content-Type: application/fhir+json;charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Cache: HIT from https://hapi.fhir.org/baseR4 1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 1 < X-Request-ID: zFarOLLXzfviCSVJ 1 < Last-Modified: Tue, 21 Apr 2026 21:55:55 GMT { "resourceType": "Bundle", "id": "f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1", "meta": { "lastUpdated": "2026-04-21T21:55:55.202+00:00" }, "type": "searchset", "link": [ { "relation": "self", "url": "https://hapi.fhir.org/baseR4/Observation?_count=1&subject%3Amissing=false" }, { "relation": "next", "url": "https://hapi.fhir.org/baseR4?_getpages=f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset" } ], "entry": [ { "fullUrl": "https://hapi.fhir.org/baseR4/Observation/131289234", "resource": { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }, "search": { "mode": "match" } } ] }
18
Then status 200
0
19
* def hasEntry = response.entry != null && response.entry.length > 0
0
20
* match hasEntry == true
0
21
* def observationId = response.entry[0].resource.id
0
22
* match response.entry[0].resource.resourceType == 'Observation'
0
23
* karate.log('Resolved observationId: ' + observationId)
0
21:56:06.238 Resolved observationId: 131289234
80
Given path 'Observation', 'INVALID-ID-99999'
0
81
When method GET
4989
21:56:06.239 request: 2 > GET https://hapi.fhir.org/baseR4/Observation/INVALID-ID-99999 2 > Host: hapi.fhir.org 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 2 > Accept-Encoding: gzip,deflate 21:56:11.227 response time in milliseconds: 4988 2 < 404 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Tue, 21 Apr 2026 21:56:11 GMT 2 < Content-Type: application/fhir+json;charset=utf-8 2 < Transfer-Encoding: chunked 2 < Connection: keep-alive 2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 2 < X-Request-ID: nfbTIkKUf4eJXNMp { "resourceType": "OperationOutcome", "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td>HAPI-2001: Resource Observation/INVALID-ID-99999 is not known</td></tr></table></div>" }, "issue": [ { "severity": "error", "code": "processing", "diagnostics": "HAPI-2001: Resource Observation/INVALID-ID-99999 is not known" } ] }
82
Then status 404
0
83
And match response.resourceType == 'OperationOutcome'
0
84
And match response.issue == '#[_ > 0]'
1
85
* karate.log('404 severity: ' + response.issue[0].severity)
1
21:56:11.229 404 severity: error
86
* karate.log('404 code: ' + response.issue[0].code)
0
21:56:11.230 404 code: processing
Scenario: [8:88] TC-OBS-008 | REQ-GEN-001 captured observation-read.json exists for HL7 Validator
ms: 5012
>>
Background:
14
* url baseUrl
0
21:56:02.227 baseUrl: https://hapi.fhir.org/baseR4 21:56:02.227 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5010
21:56:02.228 request: 1 > GET https://hapi.fhir.org/baseR4/Observation?subject%3Amissing=false&_count=1 1 > Host: hapi.fhir.org 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 1 > Accept-Encoding: gzip,deflate 21:56:07.237 response time in milliseconds: 5009 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Tue, 21 Apr 2026 21:56:07 GMT 1 < Content-Type: application/fhir+json;charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Cache: HIT from https://hapi.fhir.org/baseR4 1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 1 < X-Request-ID: saaWtMZ6wpRJ5est 1 < Last-Modified: Tue, 21 Apr 2026 21:55:55 GMT { "resourceType": "Bundle", "id": "f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1", "meta": { "lastUpdated": "2026-04-21T21:55:55.202+00:00" }, "type": "searchset", "link": [ { "relation": "self", "url": "https://hapi.fhir.org/baseR4/Observation?_count=1&subject%3Amissing=false" }, { "relation": "next", "url": "https://hapi.fhir.org/baseR4?_getpages=f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset" } ], "entry": [ { "fullUrl": "https://hapi.fhir.org/baseR4/Observation/131289234", "resource": { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }, "search": { "mode": "match" } } ] }
18
Then status 200
0
19
* def hasEntry = response.entry != null && response.entry.length > 0
0
20
* match hasEntry == true
0
21
* def observationId = response.entry[0].resource.id
0
22
* match response.entry[0].resource.resourceType == 'Observation'
0
23
* karate.log('Resolved observationId: ' + observationId)
0
21:56:07.238 Resolved observationId: 131289234
# karate.write() resolves paths under target/ when running under Maven
90
* def fileExists = java.nio.file.Files.exists(java.nio.file.Paths.get('target/responses/observation/observation-read.json'))
1
91
* assert fileExists == true
0
Scenario: [9:93] TC-OBS-009 | REQ-GEN-002b meta.versionId is present
ms: 9981
>>
Background:
14
* url baseUrl
0
21:56:07.242 baseUrl: https://hapi.fhir.org/baseR4 21:56:07.242 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
4996
21:56:07.243 request: 1 > GET https://hapi.fhir.org/baseR4/Observation?subject%3Amissing=false&_count=1 1 > Host: hapi.fhir.org 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 1 > Accept-Encoding: gzip,deflate 21:56:12.237 response time in milliseconds: 4994 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Tue, 21 Apr 2026 21:56:12 GMT 1 < Content-Type: application/fhir+json;charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Cache: HIT from https://hapi.fhir.org/baseR4 1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 1 < X-Request-ID: KN5z41PI4bIWqvxB 1 < Last-Modified: Tue, 21 Apr 2026 21:55:55 GMT { "resourceType": "Bundle", "id": "f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1", "meta": { "lastUpdated": "2026-04-21T21:55:55.202+00:00" }, "type": "searchset", "link": [ { "relation": "self", "url": "https://hapi.fhir.org/baseR4/Observation?_count=1&subject%3Amissing=false" }, { "relation": "next", "url": "https://hapi.fhir.org/baseR4?_getpages=f42ab73f-73c0-46f2-a2b2-27d2b21ca5f1&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset" } ], "entry": [ { "fullUrl": "https://hapi.fhir.org/baseR4/Observation/131289234", "resource": { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }, "search": { "mode": "match" } } ] }
18
Then status 200
0
19
* def hasEntry = response.entry != null && response.entry.length > 0
0
20
* match hasEntry == true
0
21
* def observationId = response.entry[0].resource.id
0
22
* match response.entry[0].resource.resourceType == 'Observation'
0
23
* karate.log('Resolved observationId: ' + observationId)
0
21:56:12.238 Resolved observationId: 131289234
94
Given path 'Observation', observationId
0
95
When method GET
4984
21:56:12.239 request: 2 > GET https://hapi.fhir.org/baseR4/Observation/131289234 2 > Host: hapi.fhir.org 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18) 2 > Accept-Encoding: gzip,deflate 21:56:17.222 response time in milliseconds: 4983 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Tue, 21 Apr 2026 21:56:17 GMT 2 < Content-Type: application/fhir+json;charset=utf-8 2 < Transfer-Encoding: chunked 2 < Connection: keep-alive 2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4) 2 < ETag: W/"2" 2 < X-Request-ID: pYzyQxsvPcc7TArV 2 < Content-Location: https://hapi.fhir.org/baseR4/Observation/131289234/_history/2 2 < Last-Modified: Thu, 26 Feb 2026 18:06:09 GMT { "resourceType": "Observation", "id": "131289234", "meta": { "versionId": "2", "lastUpdated": "2026-02-26T18:06:09.535+00:00", "source": "#HFJx5CCCm9qAIakp", "tag": [ { "system": "http://www.alpha.alp/use-case", "code": "EX20" } ] }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Observation: Body weight, 70 Kg</p></div>" }, "status": "final", "category": [ { "coding": [ { "system": "http://hl7.org/fhir/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Body weight" } ], "text": "Body weight" }, "subject": { "reference": "Patient/131289233" }, "effectiveDateTime": "2016-06-14", "performer": [ { "reference": "Patient/131289233" } ], "valueQuantity": { "value": 70, "unit": "Kg", "system": "http://unitsofmeasure.org", "code": "kg" } }
96
Then status 200
0
97
And match response.meta.versionId == '#present'
0
98
* karate.log('meta.versionId: ' + response.meta.versionId)
0
21:56:17.223 meta.versionId: 2