HL7 / fhir-shorthand

FHIR Shorthand
44 stars 8 forks source link

Questionnaire choice type converted to coding #135

Closed rathpanyowat closed 2 years ago

rathpanyowat commented 2 years ago

When I tried to build the Questionnaire example with the type = #choice like this.

Instance: TH-home
InstanceOf: Questionnaire
Usage: #example
* url = $QN_TH_Home
* status = #active
* experimental = true
* subjectType = #Location
* item[0]
  * linkId = "1"
  * text = "Type of bathroom"
  * type = #choice

When I built it into fsh-generated, it became like this. The type was converted into "coding" and an extension was added.

"item" : [
    {
      "linkId" : "1",
      "text" : "Type of bathroom",
      "type" : "coding",
      "_type" : {
        "extension" : [
          {
            "url" : "http://hl7.org/fhir/tools/StructureDefinition/original-item-type",
            "valueCode" : "choice"
          }
        ]
      },

I'm not sure if this intentional or not. But I saw the validator shows that this is an error and coding for Questionnaire type is unacceptable.

The value provided ('coding') is not in the value set 'QuestionnaireItemType' (http://hl7.org/fhir/ValueSet/item-type\|4.3.0), and a code is required from this value set) (error message = Unknown Code http://hl7.org/fhir/item-type#coding in http://hl7.org/fhir/item-type)
cmoesel commented 2 years ago

Hi @rathpanyowat. That's very interesting behavior -- but I don't think that SUSHI/FSH is doing it. I just tried this myself, and if you look at the file in fsh-generated, you should see that it has "type": "choice". It's actually the IG Publisher that seems to be transforming it to something different (if you look at the definition in output after running the IG Publisher).

Since this seems to be an issue w/ IG Publisher, you might consider filing a bug on https://github.com/HL7/fhir-ig-publisher and/or reporting it in the #IG creation stream on Zulip.

rathpanyowat commented 2 years ago

Ah.. I see. You're right. Mine is correct in the fsh-generated folder as well. Thanks very much 🙏