FHIR Chat · Example file names · IG creation

Stream: IG creation

Topic: Example file names


view this post on Zulip Brian Reinhold (Nov 12 2018 at 15:13):

I am having a problem 'linking' my example files to my IG. In order to get it to work I had to do the following in the IG

<resource>
      <reference>
        <reference value="Bundle/1540337338319"/>
      </reference>
      <name value="Example upload from Pulse Oximeter"/>
      <description value="Example contains an unknown patient, the PHG and PHD Device resources, Battery Level, Oxygen Saturation, and Pulse Rate Numeric Observations, and a Coincident Time Stamp Observation. The example is packaged into a transaction Bundle." />
      <exampleBoolean value="true"/>
      <groupingId value="hl7.fhir.uv.phd" />
    </resource>

and, the worst, I had to re-name my example file to 1540337338319.json. The 1540337338319 was the logical id of the Bundle resource contained in the file.

What I wanted to do was to keep the name of the file as NoninPulseOx.json as that is the device where the data originated from. I suppose the other alternative is to rename the logical id to NoninPulseOx.json? Is there a way I can work around this so I can have human-friendly file names and maintain reasonable logical ids?

I guess what I do not understand is why the reference value is not the relative path to the file.

view this post on Zulip Grahame Grieve (Nov 12 2018 at 15:35):

use the second - use the id NoninPulseOx for the resource

view this post on Zulip Lloyd McKenzie (Nov 12 2018 at 17:05):

Filenames need to correspond to the resource ids - that's how the IGPublisher locates them.

view this post on Zulip Eric Haas (Nov 12 2018 at 17:51):

... or use source parameter in the ig.json file

for example

    },
    "Encounter/example-1": {
      "base": "Encounter-example-1.html",
      "source": "encounter-example-1.xml"
    },
    "ValueSet/argonaut-clinical-note-type": {
      "base": "ValueSet-argonaut-clinical-note-type.html",
      "source": "ValueSet-argonaut-clinical-note-type.xml"
    },
    "StructureDefinition/argo-diagnosticreport": {
      "base": "StructureDefinition-argo-diagnosticreport.html",
      "defns": "StructureDefinition-argo-diagnosticreport-definitions.html",
      "source": "structuredefinition-argo-diagnosticreport.xml"
    },

view this post on Zulip Brian Reinhold (Nov 13 2018 at 23:57):

@Eric Haas I tried the following in ig.json

{
    "Observation/NumericNaN":
    {
        "base": "NumericNaN.html",
        "source": "src/examples/NumericNaN.json"
    }
},
{
  "redirect": "src-generated/PhdImplementationGuide.json",
  "comments": "The IG-configuration file is generated from the IG xml file in src using framework/xslt/igToConfig.xslt.  It should never be edited directly"
}

and in the ImplementationGuide.xml

    <resource>
      <reference>
        <reference value="Observation/1.0.0.42"/>
      </reference>
      <name value="Not a number example"/>
      <description value="Example is an upload of an SpO2 value from a pulse oximeter where the sensor was unable to make the measurement and reported a NaN (Not-a-Number)." />
      <exampleBoolean value="true"/>
      <groupingId value="hl7.fhir.uv.phd" />
    </resource>

However, I get the usual error in the build

     [java] Load Content                                                                     (16.0938sec)
     [java] java.lang.Exception: Unable to find the source file for Observation/1.0.0.42: not specified, so tried observation-1.0.0.42.xml, 1.0.0.42.observation.xml, observation-1.0.0.42.json, observation/1.0.0.42.xml, observation/1.0.0.42.json, 1.0.0.42.xml, and 1.0.0.42.json in dirs [E:\Ruby25-x64\IG_Publisher\PHD\src-generated\resources, E:\Ruby25-x64\IG_Publisher\PHD\src-generated\resources, E:\Ruby25-x64\IG_Publisher\PHD\src\resources, E:\Ruby25-x64\IG_Publisher\PHD\src\vocabulary, E:\Ruby25-x64\IG_Publisher\PHD\src\examples]

This may be because I am using Lloyd's Framework and there is no way to override the pre-assumed names.

view this post on Zulip Eric Haas (Nov 14 2018 at 00:08):

the example should be in both structures:

ig.json

{
    "Observation/1.0.0.42":
    {
        "base": "/1.0.0.42.html",
        "source": "1.0.0.42.json" //which folder to look in is define by the  ig.json parameter path.resources below...
...
  "paths": {
    ...
    "resources": [
      "src/resources",
      "src/examples"
    ]
  },

    }
}

ImplementationGuide - ( which could be in xml or json)

      <resource>
      <reference>
        <reference value="Observation/1.0.0.42"/>
      </reference>
      <name value="Not a number example"/>
      <description value="Example is an upload of an SpO2 value from a pulse oximeter where the sensor was unable to make the measurement and reported a NaN (Not-a-Number)." />
      <exampleBoolean value="true"/>
      <groupingId value="hl7.fhir.uv.phd" />
    </resource>

view this post on Zulip Brian Reinhold (Nov 14 2018 at 00:13):

@Eric Haas what if the real file name is NumericNaN.json which contains an Observation which happens to have a logical id of 1.0.0.42? The file is located in src/examples. I did place something in the ig.json and implementation guide but I got the error that the file could not be found. If I massage the name so its the same as the id, then it will work (without the need for any entry in ig.json).

I get a validation error I do not understand but that's a different story.

view this post on Zulip Eric Haas (Nov 14 2018 at 00:16):

the file name does not need to match the id

here is what you want:

ig.json

{
    "Observation/1.0.0.42":
    {
        "base": "1.0.0.42.html", //  or whatever you want to call it
        "source": "MyFileName.json" //which folder to look in is define by the  ig.json parameter path.resources below...
...
  "paths": {
    ...
    "resources": [
      "src/resources",
      "src/examples"
    ]
  },

    }
}

ImplementationGuide - ( which could be in xml or json)

      <resource>
      <reference>
        <reference value="Observation/1.0.0.42"/>
      </reference>
      <name value="Not a number example"/>
      <description value="Example is an upload of an SpO2 value from a pulse oximeter where the sensor was unable to make the measurement and reported a NaN (Not-a-Number)." />
      <exampleBoolean value="true"/>
      <groupingId value="hl7.fhir.uv.phd" />
    </resource>

view this post on Zulip Eric Haas (Nov 14 2018 at 00:17):

if that does not work it could be that lloyd's frameswork is strict about file naming.

view this post on Zulip Brian Reinhold (Nov 14 2018 at 00:36):

if that does not work it could be that lloyd's frameswork is strict about file naming.

@Eric Haas I think I have to come to that conclusion. No matter how I try the build says it cant find it and it is looking for a certain name.

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 08:41):

Lloyd's framework is indeed strict about file naming. The ig.json file is generated from the implementation guide and it requires that the file names be based on the id.

view this post on Zulip Brian Reinhold (Nov 14 2018 at 10:54):

Lloyd's framework is indeed strict about file naming. The ig.json file is generated from the implementation guide and it requires that the file names be based on the id.

Yea, I have kind of come to that conclusion. So the best compromise is to make the id some friendly name that one can use for the file that tells the user basically what the file contains.

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 10:54):

yes

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 10:55):

And if you like, embed a comment in the example noting that real-world ids probably won't be that friendly...

view this post on Zulip Brian Reinhold (Nov 14 2018 at 10:56):

And if you like, embed a comment in the example noting that real-world ids probably won't be that friendly...

Is there a way to embed a comment in a json example that the IG publisher will accept?

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 10:59):

Nope

view this post on Zulip Lloyd McKenzie (Nov 14 2018 at 11:00):

That's a JSON syntax limitation - we use off-the-shelf JSON parsers and comments aren't allowed in the JSON syntax. We've asked and it's been confirmed that "no comments" is an intentional "feature".

view this post on Zulip Brian Reinhold (Nov 14 2018 at 11:02):

That's a JSON syntax limitation - we use off-the-shelf JSON parsers and comments aren't allowed in the JSON syntax. We've asked and it's been confirmed that "no comments" is an intentional "feature".

Yes I know. Until the JSON powers-that-be come to agreement on comments only those parsers that define a means of adding comments can support such. Good luck using the JSON anywhere else!


Last updated: Apr 12 2022 at 19:14 UTC