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

Profile validation fails even when constraint is satisfied #3753

Closed
rahul1 opened this issue Jan 19, 2024 · 2 comments · Fixed by #3782
Closed

Profile validation fails even when constraint is satisfied #3753

rahul1 opened this issue Jan 19, 2024 · 2 comments · Fixed by #3782
Assignees
Labels
bug Something isn't working fhir-datastore Related to the FHIR datastore, includes API and FHIR operations

Comments

@rahul1
Copy link
Member

rahul1 commented Jan 19, 2024

User Driven: https://discord.com/channels/905144809105260605/1194887284537954304/1194887284537954304

Repro

  1. Upload the following Structure definition to your project: test.fhir.json

  2. Try to save the following encounter: test-encounter.json

Actual Behavior

Receive the following error:
image

Expected Behavior

The Encounter has a valid identifier that satisfies the constraint, so we would expect to pass

@rahul1 rahul1 added bug Something isn't working fhir-datastore Related to the FHIR datastore, includes API and FHIR operations labels Jan 19, 2024
@rahul1 rahul1 added this to the January 31st, 2024 milestone Jan 19, 2024
@codyebberson
Copy link
Member

@mattwiller - My first instinct would be to test the identifier.where(a = 'x' and b = 'y') syntax in the fhirpath project directly

@codyebberson
Copy link
Member

Putting together a fix now. There is one issue in our schema validator, and I think perhaps one issue with the user's StructureDefinition.

First, in our schema validator, we're not currently validating "root" constraints (i.e., at the top level, on the Encounter element definition). So if you add a root constraint such as "identifier.where(system='http://example.com' and value='123').exists()", it would be ignored.

So, I assume the user may have tried to put that constraint on the Encounter.identifier element. In that case, the constraint expression should omit "identifier", and simply be "where(system='http://example.com' and value='123').exists()", because the context value is the identifier array, not the Encounter.

github-merge-queue bot pushed a commit that referenced this issue Jan 21, 2024
* Fixes #3753 - root constraint validation

* Fixed constraint bugs in core

* Fixed server tests

* More structure definition fixes

* Fixed structure definition

* Temp skip org-1 constraint
medplumbot added a commit that referenced this issue Jan 21, 2024
Fixes #3753 - root constraint validation (#3779)
Fixes #3614 - configurable agent log level (#3781)
Fixed validateDOMNesting warning (#3780)
Fixes #3775 - AsyncAutocomplete call onChange on remove (#3777)
Dependency upgrades (#3774)
Remove notice to contact `info@medplum.com` to enable open patient registration (#3776)
Move logger from server to core (#3773)
Create a task demo app (#3555)
Add docs for setting up CORS when self-hosting (#3752)
Export NotesDisplay from @medplum/react (#3759)
Fixes #3751 - restore AsyncAutocomplete props (#3758)
Add CodeSystem validate-code operation (#3705)
Update provider directory docs to administration section (#3747)
Avoid error on SearchPage while schema is being requested (#3757)
Fixes #3755 - allow embedding PDFs on external domains (#3756)
Fixes #3653 - Agent handle DICOM C-STORE (#3736)
ci(madge): add `madge` job for PRs against `medplum/test-actions` (#3745)
Handle websocket max payload exceeded (#3750)
Implement CodeSystem lookup operation (#3702)
Require super admin for CodeSystem import (#3739)
Add OTel documentation (#3738)
Better error on unique constraint violation (#3743)
Dependency upgrades (#3744)
feat(examples): add live chat example (#3713)
Move response utils to separate file (#3742)
Fix wrapping CodeSystem import handler (#3741)
Add lookup table to index CodeSystem codings (#3731)
github-merge-queue bot pushed a commit that referenced this issue Jan 21, 2024
Fixes #3753 - root constraint validation (#3779)
Fixes #3614 - configurable agent log level (#3781)
Fixed validateDOMNesting warning (#3780)
Fixes #3775 - AsyncAutocomplete call onChange on remove (#3777)
Dependency upgrades (#3774)
Remove notice to contact `info@medplum.com` to enable open patient registration (#3776)
Move logger from server to core (#3773)
Create a task demo app (#3555)
Add docs for setting up CORS when self-hosting (#3752)
Export NotesDisplay from @medplum/react (#3759)
Fixes #3751 - restore AsyncAutocomplete props (#3758)
Add CodeSystem validate-code operation (#3705)
Update provider directory docs to administration section (#3747)
Avoid error on SearchPage while schema is being requested (#3757)
Fixes #3755 - allow embedding PDFs on external domains (#3756)
Fixes #3653 - Agent handle DICOM C-STORE (#3736)
ci(madge): add `madge` job for PRs against `medplum/test-actions` (#3745)
Handle websocket max payload exceeded (#3750)
Implement CodeSystem lookup operation (#3702)
Require super admin for CodeSystem import (#3739)
Add OTel documentation (#3738)
Better error on unique constraint violation (#3743)
Dependency upgrades (#3744)
feat(examples): add live chat example (#3713)
Move response utils to separate file (#3742)
Fix wrapping CodeSystem import handler (#3741)
Add lookup table to index CodeSystem codings (#3731)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fhir-datastore Related to the FHIR datastore, includes API and FHIR operations
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants