Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Using$ now() in Mapping throws an error #556

Open
vesnushka opened this issue Mar 20, 2023 · 0 comments
Open

[BUG] Using$ now() in Mapping throws an error #556

vesnushka opened this issue Mar 20, 2023 · 0 comments
Labels

Comments

@vesnushka
Copy link

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:

  1. 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
  1. $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
  1. 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
@vesnushka vesnushka added the bug label Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant