Stream: conformance
Topic: SD names, id, and url parts
John Moehrke (Jul 27 2018 at 17:55):
When I first looked to set guidance for IHE. It seemed that using "." (period) in names and ids was the pattern. I get this still from Forge. Yet, seems US-Core uses '-' (dash). Is there a reason for or against either of these? I ask as I am updating the IHE guidance, and I have heard that the IG publication tooling requires dash and doesn't allow period...
John Moehrke (Jul 27 2018 at 17:59):
for example: IHE.MHD.Query.Minimal.DocumentReference vs IHE-MHD-Query-Minimal-DocumentReference
As in https://simplifier.net/IHEPatientDemographi/IHEMHDQueryMinimalDocumentReference/~overview
Michel Rutten (Jul 30 2018 at 10:04):
@John Moehrke element id's are generated from path names and slice names. Therefore a slice name cannot include dot .
, semicolon :
characters. However slice names are allowed to contain dashes -
.
Michel Rutten (Jul 30 2018 at 10:05):
See invariant eld-16 on ElementDefinition:
sliceName must be composed of proper tokens separated by "/" (expression :
sliceName.empty() or sliceName.matches('^[a-zA-Z0-9\\/\\-_\\[\\]\\@]+$')
)
John Moehrke (Jul 30 2018 at 12:50):
I have not yet worked on slicing. I am just naming the SD. Why would the id in the SD be so constrained?
John Moehrke (Jul 30 2018 at 12:51):
Would be nice if there was a recommendation (best-practice) for this... is there?
Michel Rutten (Jul 30 2018 at 13:35):
Hi @John Moehrke, I assumed you were referring to element ids (?); these are generated according to a pre-defined format. Resource ids are not constrained however.
John Moehrke (Jul 30 2018 at 13:43):
Im talking about the name/id of a StructureDefinition... as in the example I gave from IHE.
Michel Rutten (Jul 30 2018 at 13:56):
Note that StructureDefinition.name
must be computer-friendly (e.g. suitable for code-generation):
http://build.fhir.org/structuredefinition-definitions.html#StructureDefinition.name
Resource.id
is usually served-assigned.
John Moehrke (Jul 30 2018 at 13:59):
lets focus then on .name... seems to me IHE.MHD.Query.Minimal.DocumentReference is just as computer friendly as IHE-MHD-Query-Minimal-DocumentReference
Or is there some definition of computer friendly? Computers might have been more friendly back-in-my-day
Lloyd McKenzie (Jul 30 2018 at 14:08):
Periods in names are usually used to navigate between properties in most computer languages, so you can't have "." in the name of a class.
John Moehrke (Jul 30 2018 at 14:57):
So then @Lloyd McKenzie this is why the IG publisher requires '-' and forbids '.'? I am not against this guidance, just wish it was said somewhere so that I wouldn't have been guiding IHE in using '.'
Lloyd McKenzie (Jul 30 2018 at 16:02):
It's new guidance introduced into the validation on the basis that we had no guidance previously
John Moehrke (Jul 30 2018 at 17:02):
so it is written somewhere? Please point...
Lloyd McKenzie (Jul 30 2018 at 18:14):
Not that I'm aware of.
Lloyd McKenzie (Jul 30 2018 at 18:14):
Though it may be approved in a change proposal - and we did the tooling bit first as that was what was going to impact designs.
Grahame Grieve (Jul 30 2018 at 18:21):
the IG publisher requires '-' and forbids '.'?
Grahame Grieve (Jul 30 2018 at 18:21):
what are you talking about?
John Moehrke (Jul 30 2018 at 19:32):
I have been told that when people try to use the StructureDefinition that IHE publishes with the IG publisher validation they must replace the '.' with '-'. I have not done this myself, I hear it from others. So I am trying to adjust the guidance I give to IHE profile writers so that we do the right or 'best' thing.
Grahame Grieve (Jul 30 2018 at 19:37):
please get a more detailed report - it doesn't sound correct to me
Brian Postlethwaite (Jul 31 2018 at 00:12):
and - (subtract) would be no better than . an _ (underscore) however would be ok for classname generation
Brian Postlethwaite (Jul 31 2018 at 00:12):
Specifically for element name, not so sure about SD.name
Brian Postlethwaite (Jul 31 2018 at 00:44):
Infact I just happen to have tripped over this exact invariant by using an underscore (which is in a logical model) and don't think logical models should be constrained by this rule.
John Moehrke (Jul 31 2018 at 13:09):
Am I not understanding @Lloyd McKenzie as saying that period "." should not be used in the name of an SD? I have been asking a very simple question, but getting all kinds of answers about other things. Where @Grahame Grieve seems to be indicating that a period should be fine in a SD name. Again, for example from IHE MHD profile --
IHE.MHD.Query.Minimal.DocumentReference vs IHE-MHD-Query-Minimal-DocumentReference vs IHE_MHD_Query_Minimal_DocumentReference
Grahame Grieve (Jul 31 2018 at 13:25):
what is the specific error?
John Moehrke (Jul 31 2018 at 16:20):
checking... The person is European, so is gone for the summer
Michel Rutten (Aug 01 2018 at 08:45):
A code generator will typically convert StructureDefinition.name
into a type name and ElementDefinition.path
into a member name. Therefore the values of these properties are constrained to be "computer friendly". Also see GF#12710.
John Moehrke (Aug 01 2018 at 12:50):
Modern computers are far more picky than I remember. Why is a period not computer friendly? I suspect you don't mean computers, but rather some encoding friendly.. right>? It seems then that GF#12710, if passed, would mean I would need to change from period to underscore. Camel is fine within a domain, but these names need to define their domain too as they are globally flat. This is why I used period... IHE.MHD.Query.Minimal.DocmentReference ---- is <IHE domain>.<IHE profile>.<transaction identifier>.<option name>.<resource name>
Michel Rutten (Aug 01 2018 at 13:21):
@John Moehrke In most computer languages, the dot .
is a reserved character / has special meaning; usually to navigate to a specific object member. User-assigned identifiers cannot contain reserved characters, as this would break parsing. All code generators have to take this into account. In FHIR, code generators operate on conformance resources. Therefore, conformance resources require special invariants on relevant property values to ensure that generated code is syntactically valid.
John Moehrke (Aug 01 2018 at 13:32):
ah, so the computer is not the unfriendly participant. The computer is processing the period quite well. It would be best to place the blame where it should be. Because when I read 'computer friendly' as the requirement, I simply used period rather than space... Getting GF#12710 into the build would help clarify the real friendliness that is required.
Also note, I do have a navigation use-case, hence why period seemed logical to me and yet also computer friendly
Lloyd McKenzie (Aug 01 2018 at 14:04):
In the block vote for FHIR-I for next week, there's a proposal to make the Regex for names [A-Z][A-Za-Z0-9_]*
John Moehrke (Aug 01 2018 at 14:48):
@Lloyd McKenzie , I think you are referring to GF#12710. right? Or is there another one? Adding this detail is good. sucks for me, but now is not bad time to fix. So it seems I need to change IHE recommendation to use underscore '_' where I today recommend period '.' right?
Lloyd McKenzie (Aug 01 2018 at 14:56):
Correct.
John Moehrke (Aug 01 2018 at 19:33):
Is there a convention for filename? Yes, I know that is outside the scope of the fhir spec... but am asking more about tooling in this case. I see that Forge tends to put ".structuredefinition.xml". Yet I tend to put the structureDefinition files into a /StructureDefinition/ directory... so it seems redundant.
Elliot Silver (Aug 01 2018 at 19:34):
If we're looking at restricting names because they are turned into variable/element names by certain code generators, what is the plan to restrict names from clashing with reserved keywords in my or your favorite language?
Lloyd McKenzie (Aug 01 2018 at 21:47):
Filename is driven by IG template. We'll have standard templates that provide guidance at some point, but none yet.
Grahame Grieve (Aug 02 2018 at 00:29):
none. code generators need to deal with that
Lloyd McKenzie (Aug 02 2018 at 00:46):
Actually, there's a proposal in the block vote to deal with that too. (You can ask to yank it if you wish...)
Grahame Grieve (Aug 02 2018 at 05:00):
when's the block vote for?
Lloyd McKenzie (Aug 02 2018 at 05:22):
Monday
John Moehrke (Aug 02 2018 at 12:33):
which item? From that I can determine if I care to figure out where this block vote is happ;ening. I don't think I have specific requirements, I just don't want to break all of IHE to change period to underscore; and find out that I need to break it all again when some other random requirement comes my way
Grahame Grieve (Aug 02 2018 at 12:35):
so I still don't know why you think this is a problem. There is, so far as I can see, no rules about this in the IG infrastructure, and you still haven't reported an actual error
John Moehrke (Aug 02 2018 at 12:41):
Grahame, GF#12710 is about to become the problem. It has been a hidden requirement prior to this.
John Moehrke (Aug 02 2018 at 12:42):
I would love to continue to use period.... but I am being told that I can't... because it is not computer friendly
Grahame Grieve (Aug 02 2018 at 12:43):
so it's about to be a problem, and I think it's an inappropriate rule. BUt you're saying that there's already a problem, and I don't know what that problem is
Last updated: Apr 12 2022 at 19:14 UTC