FHIR / sushi

SUSHI (aka "SUSHI Unshortens Short Hand Inputs") is a reference implementation command-line interpreter/compiler for FHIR Shorthand (FSH).
Apache License 2.0
145 stars 44 forks source link

References to codes defined in locally-defined code system cause IG Pub error #149

Closed markkramerus closed 4 years ago

markkramerus commented 4 years ago

I tried to define a local code system:

CodeSystem:  AJCCFairUse
Title: "AJCC Fair Use"
Description: "A small local subset of AJCC staging codes for example purposes."
* #3C
* #cM0
* #cT3
* #cN3
* #pM0
* #pT3
* #pN3

and then referenced it in an instance like this:

* valueCodeableConcept = AJCCFairUse#3C "IIIC"

That didn't work because the IG Pub complained that you must use a URL for a code system, not a local name.

So I tried this:

Alias: FairUse = http://hl7.org/fhir/us/mcode/CodeSystem/AJCCFairUse

and then tried to reference it in an instance like this:

* valueCodeableConcept = FairUse#3C "IIIC"

but that didn't work either. The IG Pub complained "Unknown Code System 'http://hl7.org/fhir/us/mcode/CodeSystem/AJCCFairUse'", and "URL value 'http://hl7.org/fhir/us/mcode/CodeSystem/AJCCFairUse' does not resolve"

So I'm wondering how one an define a code system in FSH and use codes from that system in the same FSH Tank.

Sorry I can't provide a more complete example because I pulled back my change.

cmoesel commented 4 years ago

I think you've provided enough detail. I'm not surprised that the first approach failed, but I am surprised that your second approach did not work... I know you're manually managing the ImplementationGuide JSON. Did you make sure that your CodeSystem was in the ImplementationGuide JSON so that the publisher would be aware of it?

Also, I thought CodeSystems were not an immediate priority for mCODE. Has that changed?

markkramerus commented 4 years ago

It was part of a rather crazy workaround I was trying out. YES - I forgot to add the CodeSystem to the IG json file, so it wasn't actually in the IG. Good guess on that :) We might be able to close this if I can now get it to work.

markkramerus commented 4 years ago

I think we better leave this open. I fixed the IG json, but I'm still getting an error:

The code system "http://hl7.org/fhir/us/mcode/CodeSystem/AJCCFairUse" is not known (encountered paired with code = "3C"); The code provided (http://hl7.org/fhir/us/mcode/CodeSystem/AJCCFairUse#3C) is not valid in the value set All codes known to the system for 'http://hl7.org/fhir/us/mcode/CodeSystem/AJCCFairUse#3C'
--

The input/resources DOES contain the AJCCFairUse file. It is attached. CodeSystem-AJCCFairUse.json.txt

cmoesel commented 4 years ago

OK, we'll take a look at this.

mint-thompson commented 4 years ago

I want to make sure that I understand this issue correctly, because I'm not able to get an error message that looks like The code system "http://hl7.org/fhir/us/mcode/CodeSystem/AJCCFairUse" is not known (encountered paired with code = "3C")... as posted by @markkramerus above.

The first scenario you reported is where you referred to a local code system by name. In that case, the example's generated IG resource referred to that local name instead of a URL, which led to an error from the IG publisher. I was able to reproduce this error, and it is possible for SUSHI to remedy this by writing the URL instead of the local name in the generated resource.

The second scenario you reported is where you referred to a code system by url through an alias. In this case, the generated IG resource referred to the URL for that code system. When I attempted to reproduce this, I did not receive the error message you specified. Could you provide any additional information about how you made the IG publisher generate this error message?

cmoesel commented 4 years ago

@mint-thompson -- until you hear back from @markkramerus, I recommend you proceed w/ supporting that first use case, where we should replace the name of the code system with its URL. No matter what, I think we want that functionality.