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

Canonical() behavior when a CodeSystem and a ValueSet have exact same Ids #1469

Open
samanvp opened this issue Jun 6, 2024 · 1 comment · May be fixed by #1528
Open

Canonical() behavior when a CodeSystem and a ValueSet have exact same Ids #1469

samanvp opened this issue Jun 6, 2024 · 1 comment · May be fixed by #1528

Comments

@samanvp
Copy link

samanvp commented Jun 6, 2024

If we define a CodeSystem and a ValueSet with the exact Ids:

CodeSystem: FooBar
Id:         foo-bar
Title:     "Foo Bar CodeSystem"

* #v1
    "value1"
* #v2
    "value2"
ValueSet: FooBar
Id: foo-bar
Title: "Foo Bar ValueSet"

* include codes from system FooBar

Canonical(FooBar) always return the canonical url of the ValueSet.

  • Is there a way we could choose which resource's url we'd like to receive?
  • If not, it would be great if SUSHI could through an error to highlight there is some ambiguity here.
@jafeltra
Copy link
Collaborator

jafeltra commented Jun 6, 2024

Thanks for reporting this @samanvp. I think having SUSHI report that there is ambiguity in this situation through a warning or error could be helpful.

The best way to avoid the ambiguity is to use unique identifiers after the CodeSystem and ValueSet declaration keywords. You could use something like FooBar_CS and FooBar_VS as a simple differentiation. Assuming you want the names in the generated FHIR resources to stay FooBar, you can use a caret path to set the name for both the CodeSystem and the ValueSet back to FooBar. For example, you can do something like this:

CodeSystem: FooBar_CS
Id:         foo-bar
Title:     "Foo Bar CodeSystem"
* ^name = "FooBar"
* #v1 "value1"
* #v2 "value2"
    
    
ValueSet: FooBar_VS
Id: foo-bar
Title: "Foo Bar ValueSet"
* ^name = "FooBar"
* include codes from system FooBar_CS

The unique names after the keyword declaration will allow you to reference the CodeSystem or ValueSet uniquely within the Canonical keyword and elsewhere in your FSH, but the caret path to assign name will keep the generated resources the same. I've created a short example in FSH Online to demonstrate this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants