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: 10009
>>
Background:
14
* url baseUrl
0
03:40:31.354 baseUrl: https://hapi.fhir.org/baseR4 03:40:31.354 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5019
03:40:31.355 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 03:40:36.373 response time in milliseconds: 5018 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Thu, 16 Apr 2026 03:40:36 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: vfWxWODo9bucOuUn 1 < Last-Modified: Thu, 16 Apr 2026 03:40:36 GMT { "resourceType": "Bundle", "id": "a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88", "meta": { "lastUpdated": "2026-04-16T03:40:36.318+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=a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88&_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
03:40:36.375 Resolved observationId: 131289234
26
Given path 'Observation', observationId
0
27
When method GET
4986
03:40:36.376 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 03:40:41.361 response time in milliseconds: 4984 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Thu, 16 Apr 2026 03:40:41 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: N4OyM48qRxDCDbuT 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')
1
03:40:41.363 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: 9999
>>
Background:
14
* url baseUrl
0
03:40:32.352 baseUrl: https://hapi.fhir.org/baseR4 03:40:32.352 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5011
03:40:32.353 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 03:40:37.363 response time in milliseconds: 5009 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Thu, 16 Apr 2026 03:40:37 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: CVASrFQR3l2RT5YJ 1 < Last-Modified: Thu, 16 Apr 2026 03:40:36 GMT { "resourceType": "Bundle", "id": "a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88", "meta": { "lastUpdated": "2026-04-16T03:40:36.318+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=a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88&_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
03:40:37.364 Resolved observationId: 131289234
36
Given path 'Observation', observationId
0
37
When method GET
4985
03:40:37.365 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 03:40:42.349 response time in milliseconds: 4984 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Thu, 16 Apr 2026 03:40:42 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: APbeBR7sC0Km7rHR 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
03:40:42.351 status: final
Scenario: [3:42] TC-OBS-003 | REQ-OBS-003 code.coding has system and code
ms: 9993
>>
Background:
14
* url baseUrl
0
03:40:33.359 baseUrl: https://hapi.fhir.org/baseR4 03:40:33.359 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5002
03:40:33.360 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 03:40:38.361 response time in milliseconds: 5000 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Thu, 16 Apr 2026 03:40:38 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: yjaZj89qXaPOz6cL 1 < Last-Modified: Thu, 16 Apr 2026 03:40:36 GMT { "resourceType": "Bundle", "id": "a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88", "meta": { "lastUpdated": "2026-04-16T03:40:36.318+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=a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88&_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
03:40:38.362 Resolved observationId: 131289234
43
Given path 'Observation', observationId
0
44
When method GET
4988
03:40:38.363 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 03:40:43.350 response time in milliseconds: 4986 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Thu, 16 Apr 2026 03:40:43 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: REciXkg1yLID6UIa 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)
1
03:40:43.352 code system: http://loinc.org
51
* karate.log('code code: ' + response.code.coding[0].code)
0
03:40:43.352 code code: 29463-7
Scenario: [4:53] TC-OBS-004 | REQ-OBS-004 valueQuantity has value and unit (conditional)
ms: 14997
>>
Background:
14
* url baseUrl
0
03:40:35.356 baseUrl: https://hapi.fhir.org/baseR4 03:40:35.356 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5008
03:40:35.357 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 03:40:40.364 response time in milliseconds: 5007 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Thu, 16 Apr 2026 03:40:40 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: sUrziFIFDtOGXQ8U 1 < Last-Modified: Thu, 16 Apr 2026 03:40:36 GMT { "resourceType": "Bundle", "id": "a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88", "meta": { "lastUpdated": "2026-04-16T03:40:36.318+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=a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88&_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
03:40:40.366 Resolved observationId: 131289234
54
Given path 'Observation'
0
55
And params ({ 'value-quantity': 'gt0', '_count': '1' })
0
56
When method GET
5034
03:40:40.367 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 03:40:45.400 response time in milliseconds: 5032 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Thu, 16 Apr 2026 03:40:45 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: EN9QDZKPdAm729sv 2 < Last-Modified: Thu, 16 Apr 2026 03:40:45 GMT { "resourceType": "Bundle", "id": "489155df-c87e-4f3c-882b-fa552255c140", "meta": { "lastUpdated": "2026-04-16T03:40:45.318+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=489155df-c87e-4f3c-882b-fa552255c140&_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 })
4953
>>
observation.assert-value-quantity
4950
7
Given url baseUrl
0
8
And path 'Observation', vqId
0
9
When method GET
4945
03:40:45.405 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 03:40:50.349 response time in milliseconds: 4943 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Thu, 16 Apr 2026 03:40:50 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: f5fR67qTvdj58L6f 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)
4
03:40:50.354 valueQuantity.value: 0.0037566
15
* karate.log('valueQuantity.unit: ' + response.valueQuantity.unit)
0
03:40:50.354 valueQuantity.unit: pg/mL
Scenario: [5:63] TC-OBS-005 | REQ-OBS-005 subject references Patient
ms: 10002
>>
Background:
14
* url baseUrl
0
03:40:39.353 baseUrl: https://hapi.fhir.org/baseR4 03:40:39.353 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5009
03:40:39.355 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 03:40:44.362 response time in milliseconds: 5007 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Thu, 16 Apr 2026 03:40:44 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: YKy06BQbifgcOFKY 1 < Last-Modified: Thu, 16 Apr 2026 03:40:36 GMT { "resourceType": "Bundle", "id": "a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88", "meta": { "lastUpdated": "2026-04-16T03:40:36.318+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=a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88&_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
03:40:44.363 Resolved observationId: 131289234
64
Given path 'Observation', observationId
0
65
When method GET
4991
03:40:44.364 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 03:40:49.354 response time in milliseconds: 4990 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Thu, 16 Apr 2026 03:40:49 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: 0rSg8WjaEYIryV63 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
03:40:49.356 subject reference: Patient/131289233
Scenario: [6:72] TC-OBS-006 | REQ-OBS-006 | REQ-GEN-002a meta.lastUpdated is present
ms: 9985
>>
Background:
14
* url baseUrl
0
03:40:41.365 baseUrl: https://hapi.fhir.org/baseR4 03:40:41.365 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
4996
03:40:41.366 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 03:40:46.361 response time in milliseconds: 4995 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Thu, 16 Apr 2026 03:40:46 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: 0qmvkMnIQge5kgal 1 < Last-Modified: Thu, 16 Apr 2026 03:40:36 GMT { "resourceType": "Bundle", "id": "a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88", "meta": { "lastUpdated": "2026-04-16T03:40:36.318+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=a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88&_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
03:40:46.362 Resolved observationId: 131289234
73
Given path 'Observation', observationId
0
74
When method GET
4987
03:40:46.363 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 03:40:51.350 response time in milliseconds: 4986 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Thu, 16 Apr 2026 03:40:51 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: 5bGHbQMwk3zWP6Iv 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)
0
03:40:51.351 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
03:40:42.353 baseUrl: https://hapi.fhir.org/baseR4 03:40:42.353 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5010
03:40:42.354 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 03:40:47.363 response time in milliseconds: 5008 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Thu, 16 Apr 2026 03:40:47 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: 6jUKooclcwVxZ7OF 1 < Last-Modified: Thu, 16 Apr 2026 03:40:36 GMT { "resourceType": "Bundle", "id": "a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88", "meta": { "lastUpdated": "2026-04-16T03:40:36.318+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=a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88&_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
03:40:47.364 Resolved observationId: 131289234
80
Given path 'Observation', 'INVALID-ID-99999'
0
81
When method GET
4990
03:40:47.365 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 03:40:52.354 response time in milliseconds: 4988 2 < 404 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Thu, 16 Apr 2026 03:40:52 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: EJbzTEgzLtDqV4Gi { "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]'
0
85
* karate.log('404 severity: ' + response.issue[0].severity)
0
03:40:52.355 404 severity: error
86
* karate.log('404 code: ' + response.issue[0].code)
0
03:40:52.356 404 code: processing
Scenario: [8:88] TC-OBS-008 | REQ-GEN-001 captured observation-read.json exists for HL7 Validator
ms: 5011
>>
Background:
14
* url baseUrl
0
03:40:43.355 baseUrl: https://hapi.fhir.org/baseR4 03:40:43.355 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
5009
03:40:43.355 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 03:40:48.364 response time in milliseconds: 5007 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Thu, 16 Apr 2026 03:40:48 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: m4N2AIlIvPO0s23Z 1 < Last-Modified: Thu, 16 Apr 2026 03:40:36 GMT { "resourceType": "Bundle", "id": "a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88", "meta": { "lastUpdated": "2026-04-16T03:40:36.318+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=a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88&_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
03:40:48.364 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: 9982
>>
Background:
14
* url baseUrl
0
03:40:48.368 baseUrl: https://hapi.fhir.org/baseR4 03:40:48.368 fhirVersion: 4.0.1
15
Given path 'Observation'
0
16
And params ({ 'subject:missing': 'false', '_count': '1' })
0
17
When method GET
4994
03:40:48.369 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 03:40:53.362 response time in milliseconds: 4993 1 < 200 1 < Server: nginx/1.24.0 (Ubuntu) 1 < Date: Thu, 16 Apr 2026 03:40:53 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: HkRuEhtVvox6BCoA 1 < Last-Modified: Thu, 16 Apr 2026 03:40:36 GMT { "resourceType": "Bundle", "id": "a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88", "meta": { "lastUpdated": "2026-04-16T03:40:36.318+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=a4be3325-72f1-4ddd-bb1d-4dd7e29b2f88&_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
03:40:53.363 Resolved observationId: 131289234
94
Given path 'Observation', observationId
0
95
When method GET
4986
03:40:53.364 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 03:40:58.349 response time in milliseconds: 4985 2 < 200 2 < Server: nginx/1.24.0 (Ubuntu) 2 < Date: Thu, 16 Apr 2026 03:40:58 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: kGNfSZXWaqfRXAAm 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
03:40:58.350 meta.versionId: 2