[BUG] Using`$ now()` in Mapping throws an error
Opened this issue · 0 comments
vesnushka commented
Describe the bug
We faced en error in extracting the questionnaire due to the use of $ now()
in Mapping
Severity
Critical
Steps to reproduce the behavior:
- The Mapping example with
$ now()
Note: the use of variables is required to reproduce the error
body:
$let:
patientId: >-
$
fhirpath("QuestionnaireResponse.repeat(item).where(linkId='patientId').answer.value.string").0
$body:
type: transaction
entry:
- request:
url: /Observation
method: POST
resource:
code:
coding:
- code: 29463-7
system: http://loinc.org
display: Body weight
value:
Quantity:
unit: kg
value: 80
status: final
subject:
id: $ patientId
resourceType: Patient
effective:
dateTime: $ now()
resourceType: Observation
resourceType: Bundle
id: test-now-extract
resourceType: Mapping
$debug
returns correct result
POST /Mapping/test-now-extract/$debug
Content-Type: text/yaml
patientId: ede14f63-fffa-4ed0-aed8-b5b4f34f0055
Result:
type: transaction
entry:
- request:
url: /Observation
method: POST
resource:
code:
coding:
- code: 29463-7
system: http://loinc.org
display: Body weight
value:
Quantity:
unit: kg
value: 80
status: final
effective:
dateTime: 2023-03-20T14:35:59.726Z
resourceType: Observation
resourceType: Bundle
- But
$apply
returns the error
POST /Mapping/test-now-extract/$apply
Content-Type: text/yaml
patientId: ede14f63-fffa-4ed0-aed8-b5b4f34f0055
The answer
resourceType: OperationOutcome
...
text:
status: generated
div: >-
Transaction failed at entry[0]. Response status is 422. Response body is
{"resourceType":"OperationOutcome","text":{"status":"generated","div":"Invalid
resource"},"issue":[{"severity":"fatal","code":"invalid","expression":["Observation.effective.dateTime"],"diagnostics":"expected
type of string"}]}.
issue:
- severity: fatal
code: invalid
diagnostics: expected type of string
expression:
- Observation.effective.dateTime
Expected behavior
$apply should return FHIR dateTime with no error
Versions:
- Aidbox image version: v:2302.b6d04231