Closed PSUPing closed 4 years ago
I'd be happy to entertain a PR for #2 and #3 above. Those are probably good things to do either way.
With that said, right now the validate()
functionality only validates against the core spec. Long term, it should be extended to support validating against one or more specific profiles (and maybe also validate against whatever profile(s) is listed in the Resource.meta.profile property). If the profile is not found in the list of parsed profiles, it should probably ask for the profile via an event, and fail with a validation error message if the profile ultimately isn't found. This is something I've been wanting to dig into for a while, but I'm not sure when I'll be able to get to it. Very busy right now.
Loading profiles sounds like an interesting addition. Especially with the various standards building on top of FHIR, that could be very useful.
I merged your change, and created an enhancement ticket to be addressed later. I believe your immediate problems is solved, at least, so I'm closing the ticket. Let me know if I'm wrong.
👍
Scenario
I've been working with the Davinci Data Exchange for Quality Measure (DEQM) profile. As part of the profile there are a few resources where the base profile is being extended. This is done for a few different reasons: adding relevant extensions, requiring things that are optional in the base FHIR spec, etc.
Ideally, what I'd like to be able to do is use the base FHIR profile and "overlay" the changes for the DEQM spec. I tried the following code:
This the StructureDefinition from the DEQM spec that I'm using in the above example. StructureDefinition-organization-deqm.txt
When doing this I get the following error:
After looking through the parser, I traced it back to this specific block in
populateBackboneElement
(around line 349 in parseConformance.js).It looks like the
parentBackboneElement._properties.push(newProperty);
is throwing the error because previously if the element is defined without a_properties
it's an undefined object and, therefore, cannot push to it. Since I'm trying to in effect "modify" the resource after it's already been created, I believe this is where the error is coming from.Possible Fixes
There's three possible fixes that I'm thinking of for this.
For 2 and 3, I'm happy to submit a PR. I wanted to open an issue and discuss first to make sure I wasn't missing anything and this made sense for the library.