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

Bundle-level constraints are not being checked against the Bundle #2513

Closed
jduteau opened this issue Jun 15, 2021 · 3 comments
Closed

Bundle-level constraints are not being checked against the Bundle #2513

jduteau opened this issue Jun 15, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request P3 Priority 3 - Nice To Have

Comments

@jduteau
Copy link

jduteau commented Jun 15, 2021

There are a number of Bundle constraints that are not being checked against the Bundle. After discussion with Lee and John, it was discovered that the validator is not invoked against the outer bundle but just on the entries within the bundle.

The validator should check constraints against the outer Bundle (checks such as bdl-3, bdl-5, bdl-7, and bdl-8).

The following prose in the FHIR specification about Bundle would also be good to check:

Except for transactions and batches, each entry in a Bundle must have a fullUrl which is the identity of the resource in the entry. Note that this is not a versioned reference to the resource, but its identity. Where a resource is not assigned a persistent identity that can be used in the Bundle, a UUID should be used (urn:uuid:...).

Acceptance Criteria

  1. WHEN a Bundle is submitted that should fail the bdl-x constraints or that does not have a fullUrl for every entry
    THEN errors should be raised by the validator.
@prb112 prb112 added the enhancement New feature or request label Jun 15, 2021
@lmsurpre
Copy link
Member

lmsurpre commented Sep 7, 2021

Leaning toward just writing java logic for the handful of bundle-level constraints...probably as additional checks in FHIRRestHelper.validateBundle

@lmsurpre lmsurpre added the P3 Priority 3 - Nice To Have label Sep 7, 2021
@michaelwschroeder michaelwschroeder self-assigned this Nov 1, 2021
@michaelwschroeder
Copy link
Contributor

I considered the following approaches for validating bundle-level constraints:

  1. calling the validator to validate the bundle resource
  2. writing java logic to validate the bundle-level constraints
Appoach Pros Cons
call validator - validation done consistently with other resource types
- validation will stay in sync with any constraint changes
- validator code changes required to keep from validating child resources
- special logic required for handling of constraint violations in batch vs. transaction bundles
- returned errors would be different than current errors returned for existing checks of some of the bundle constraints
write java logic - simple code checks
- some checks already being done in existing code
- can easily handle special logic required for constraint violations in batch vs. transaction bundles
- error messages for existing checks will not change
- if constraints change, code will have to be updated
- aren't taking advantage of validator

Given that we're already doing some of the checks in java code in FHIRRestHelper.validateBundle(), and that the logic to use the validator is much more complex, and that constraints on the Bundle resource aren't likely to change, I chose to implement the checking via java logic.

One note: the checking will not include the check that every bundle entry has a fullUrl value. This is only required for bundles of type other than batch or transaction, which are the only two types we currently support.

michaelwschroeder added a commit that referenced this issue Nov 8, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Nov 8, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Nov 9, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Nov 9, 2021
Issue #2513 - check bundle-level constraints on creates/updates
@michaelwschroeder michaelwschroeder added this to the Sprint 2021-15 milestone Nov 9, 2021
@d0roppe
Copy link
Collaborator

d0roppe commented Nov 12, 2021

Verified that the bundle constraints are now checked. Closing issue.

@d0roppe d0roppe closed this as completed Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P3 Priority 3 - Nice To Have
Projects
None yet
Development

No branches or pull requests

5 participants