Stream: conformance
Topic: StructureDefinition.type for logical model?
Michel Rutten (Nov 05 2018 at 13:28):
I'm trying to determine how Forge should initialize the StructureDefinition.type field for logical models. R4 introduces some additional rules for logical models and StructureDefinition.type, however I don't quite understand:
http://build.fhir.org/structuredefinition-definitions.html#StructureDefinition.type
"Absolute URLs are only allowed in logical models."
- Do logical models have to specify an absolute url? Or are there other options?
- Is this an author-defined url?
- Or should this value be equal to the canonical url?
"For logical models, where the type is a URL, the type name SHOULD start with the tail of the type URL where required."
What does this mean? What "type name" does this refer to?
Grahame Grieve (Nov 06 2018 at 07:00):
- author defined URL.
- Would typically be the same as the canonical URL (has been in all the ones I've done).
- all the path names e.g. http://hl7.org.au/fhir/StructureDefinition/Colorectal (for both canonical and type), all the Paths are Colorectal.xxxx
Michel Rutten (Nov 09 2018 at 09:47):
Excellent, thanks for clarification!
Alexander Zautke (Dec 05 2018 at 07:49):
Thanks to Michel, Forge is now implementing these rules. Follow-up problem: When trying to validate one of these new logical models I am running into the issue that that the sdf-8 constraint is failing. If we define the type as a URL, "element.first().path = %resource.type" seems to fail. Do we need to exclude logical models in this rule, just like in e.g. sdf-11?
Michel Rutten (Dec 10 2018 at 10:48):
Concerning sdf-8, the description of StructureDefinition.type provides some guidance:
http://build.fhir.org/structuredefinition-definitions.html#StructureDefinition.type
"For logical models, where the type is a URL, the type name SHOULD start with the tail of the type URL where required."
I propose we update the sdf-8 invariant expression accordingly.
Lloyd McKenzie (Dec 10 2018 at 22:14):
@Grahame Grieve Can we make this fix for R4?
Grahame Grieve (Dec 11 2018 at 21:57):
looks like we need to
Grahame Grieve (Dec 11 2018 at 21:57):
propose a change on FHIR-I. but wouldn't committee need to vote on this one?
Lloyd McKenzie (Dec 11 2018 at 22:12):
We can un-cancel our Monday call if we need to vote on it, but we'd need to pre-apply it. I think it's a no-brainer - shouldn't be controversial
Grahame Grieve (Dec 12 2018 at 00:01):
that would be too late to apply it.
Grahame Grieve (Dec 12 2018 at 00:01):
it's normative content, and I believe it's the primary expression we are talking about here
Lloyd McKenzie (Dec 12 2018 at 03:36):
That's why I said we'd need to pre-apply. The Monday vote would be a formality
Lloyd McKenzie (Dec 12 2018 at 03:37):
If it's a situation where it's clearly broken, I think it's a non-substantive technical correction
Grahame Grieve (Dec 12 2018 at 04:26):
I feel as though FMG should ok
Lloyd McKenzie (Dec 12 2018 at 04:36):
Do you want me to put together the pull request? We can then discuss on the call.
Grahame Grieve (Dec 12 2018 at 04:39):
ok
Lloyd McKenzie (Dec 12 2018 at 04:52):
Added GF#19762
Lloyd McKenzie (Dec 12 2018 at 05:04):
The current invariant is this:
element.first().path = %resource.type and element.tail().all(path.startsWith(%resource.type&'.'))
My proposed change is this:
(kind = 'logical' or element.first().path = %resource.type) and element.tail().all(path.startsWith(%resource.snapshot.element.first().path&'.'))
Lloyd McKenzie (Dec 12 2018 at 05:05):
However, there's a problem with 8a too:
Lloyd McKenzie (Dec 12 2018 at 05:05):
element.first().path.startsWith(%resource.type) and (element.tail().not() or element.tail().all(path.startsWith(%resource.type&'.')))
Lloyd McKenzie (Dec 12 2018 at 05:07):
I can make the first part conditional on whether it's not a logical model. However, for the second part, I can't just grab the first differential element. I need to grab the first differential element, split it by "." and grab the first node.
Lloyd McKenzie (Dec 12 2018 at 05:07):
I have no idea if that's possible, or if so, how to do it. @Grahame Grieve @Bryn Rhodes ?
Bryn Rhodes (Dec 12 2018 at 05:14):
FHIRPath doesn't define a split operator, no.
Bryn Rhodes (Dec 12 2018 at 05:15):
I've tried to come up with a way to do it with repeat or aggregate, but so far, no luck.
Bryn Rhodes (Dec 12 2018 at 05:16):
If you always only need the first element in the result of the split, you can just grab that pretty easily with a substring, right?
Lloyd McKenzie (Dec 12 2018 at 05:23):
The first path might be "Foo" or "Foo.bar" or "Foo.bar.whatever". In all cases, I want to grab just the string "Foo". Not sure how to do that with substring
Grahame Grieve (Dec 12 2018 at 05:26):
I think you should just revoke the entire rules for logical models
Lloyd McKenzie (Dec 12 2018 at 05:28):
You still want logical models to have a common name as the root of all the paths
Lloyd McKenzie (Dec 12 2018 at 05:28):
I think I can use replaceMatches to turn everything following "." into nothing
Lloyd McKenzie (Dec 12 2018 at 05:31):
(kind = 'logical' or element.first().path.startsWith(%resource.type)) and (element.tail().not() or element.tail().all(path.startsWith(%resource.differential.element.first().path.replaceMatches('\..*','')&'.')))
Lloyd McKenzie (Dec 12 2018 at 05:32):
Does that look ok?
Lloyd McKenzie (Dec 12 2018 at 05:42):
I'm getting this error: .path.replaceMatches('\\..*','')&'.')))' has illegal path (The parameter type 'http://hl7.org/fhirpath/String' is not legal for replaceMatches parameter 1. expecting SINGLETON[http://hl7.org/fhir/StructureDefinition/string]) (src = Publisher)
Lloyd McKenzie (Dec 12 2018 at 05:43):
That seems like a build tool error to me? (As the example in the spec is definitely passing a fhirpathString, not a FHIR string)
Lloyd McKenzie (Dec 12 2018 at 05:43):
@Grahame Grieve ?
Grahame Grieve (Dec 12 2018 at 05:45):
it does look like an error in the code to me
Lloyd McKenzie (Dec 12 2018 at 05:46):
Is that something fixable at this point?
Grahame Grieve (Dec 12 2018 at 05:47):
it should be. It'll be a few hours though - I'm deep inside generating the extension packages
Lloyd McKenzie (Dec 12 2018 at 05:53):
I'll take a stab and see how I go
Last updated: Apr 12 2022 at 19:14 UTC