FHIR Chat · Canonical URLs containing # · shorthand

Stream: shorthand

Topic: Canonical URLs containing #


view this post on Zulip Josh Mandel (Feb 17 2022 at 19:45):

One other naming issue I'm running into: if I want to use an externally defined extension with a URL containing a hash (say: https://example.org/ext#favorite), I see a parsing error when I do:

* extension contains https://example.org/ext#favorite named fave 1..1

i.e.

expecting {'MS', 'SU', 'TU', 'N', 'D', 'codes', 'valueset', 'system', NUMBER, SEQUENCE}

Quotes don't seem to help; is there another way?

view this post on Zulip Chris Moesel (Feb 17 2022 at 19:49):

I think you mean containing a hash (not a *slash)... and what I expect is happening here is that SUSHI is erroneously parsing this as a code, because FSH syntax for codes is system#code (and system can be a URL). We should probably try to tweak the grammar to support that.

In the mean time, there is a workaround. Just use an alias like so:

Alias: FAV = https://example.org/ext#favorite

Profile: MyPatient
Parent: Patient
* extension contains FAV named fave 1..1

view this post on Zulip Josh Mandel (Feb 17 2022 at 19:52):

Yes, updated my post when I saw the error!) Alias workaround is good, thanks!

view this post on Zulip Chris Moesel (Feb 17 2022 at 20:08):

SUSHI#1025

view this post on Zulip Lloyd McKenzie (Feb 17 2022 at 20:24):

Canonical URLs should NOT contain a hash

view this post on Zulip Lloyd McKenzie (Feb 17 2022 at 20:25):

We use hash in some cases to refer to an element within a reference, so including them in the URL is bad practice.

view this post on Zulip Josh Mandel (Feb 17 2022 at 20:51):

@Lloyd McKenzie do we document this expectation? If not, we should.

view this post on Zulip Lloyd McKenzie (Feb 17 2022 at 23:53):

Actually, I guess I lied. Canonical references are explicitly defined as allowing '#'. But having that in a code system canonical is definitely going to cause tooling grief. @Grahame Grieve?

view this post on Zulip Elliot Silver (Feb 18 2022 at 00:50):

Are there uses for # in canonicals other than (IIRC) referencing a particular element (in a StructureDefinition) or item (in a Questionnaire)? I suspect we allow # in canonicals to support those uses, but the language was sloppy and didn't restrict it to those uses.

view this post on Zulip Brian Postlethwaite (Feb 21 2022 at 23:00):

Questionnaire.item.definition is one place, and I think in the last few days there was a use case in the CodeSystem that Michael Lawley identified.


Last updated: Apr 12 2022 at 19:14 UTC