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

The constraint 'app-4' for Appointment is not being enforced due to a typo. #4224

Open
mudlej opened this issue May 25, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@mudlej
Copy link

mudlej commented May 25, 2023

Describe the bug
The expression in constraint 'app-4' for Appointment uses 'no-show' instead of 'noshow' which make it useless since there is no status 'no-show'.

Environment
Using LinuxForHealth FHIR Server 5.1.1.

To Reproduce
Steps to reproduce the behavior:

  1. Create a request to Appointment and use 'noshow' as the status and add a cancellation reason.
    e.g.
       {
            "resourceType": "Appointment",
            "status": "noshow",
            "cancelationReason": {
                "coding": [
                    {
                        "system": "http://terminology.hl7.org/CodeSystem/appointment-cancellation-reason",
                        "code": "pat-mv",
                        "display": "Patient: Moved"
                    }
                ]
            },
            "start": "1996-01-17T00:00:00.000+02:00",
            "end": "1996-01-17T00:00:00.000+02:00",
            "participant": [
                {
                    "actor": {
                        "reference": "Practitioner/2a1ef88f-6efe-4aba-8ec3-e4a303973fdf"
                    },
                    "status": "accepted"
                }
            ]
        }
  1. POST it to FHIR at FHIR_API/Appointment
  2. See the error message in the response body.
    { "severity": "error", "code": "invariant", "details": { "text": "app-4: Cancelation reason is only used for appointments that have been cancelled, or no-show" }, "expression": [ "Appointment" ] }
    4- Using 'no-show' will be rejected as well because the status code is 'noshow'.

Expected behavior
The request should be accepted since it doesn't violate the rule.

Additional context
This could be solved easily by removing the dash from the expression part of the constraint, as in the pull request.

@mudlej mudlej added the bug Something isn't working label May 25, 2023
mudlej added a commit to mudlej/FHIR that referenced this issue May 25, 2023
@lmsurpre
Copy link
Member

Thats a good find. We actually get these constraints straight from the specification and so what you found here is actually a spec bug: https://hl7.org/fhir/R4B/appointment.html#invs

It looks like that was reported to HL7 at https://jira.hl7.org/browse/FHIR-37896 and they already fixed it for R5.
I think it would be reasonable to back-port that fix for our R4B implementation.

@mudlej
Copy link
Author

mudlej commented Jun 20, 2023

I think so. It's a typo in the specification, which results in the opposite of the expected behavior.
Thanks for deciding to back-port the fix.

mudlej added a commit to mudlej/FHIR that referenced this issue Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants