FHIR Chat · White html pages for Profile on Observation with ordinal Ext · IG creation

Stream: IG creation

Topic: White html pages for Profile on Observation with ordinal Ext


view this post on Zulip Oliver Egger (Jul 21 2021 at 10:47):

Attention: A very long message, I almost hit the zulip limit of 10000 chars ....

We encountered a very strancge issue with an Implementation Guide where we had white web pages appearing instead of the profile description. I tried to track the problem down and started making notes ... I put them here, knowing that zulip will not occupy your
whole screen, if you are interested in tracking down IG Publishing issues i invite you to follow along:

We want to create profiles on an Observations, and the title has an ampersand in it:

    <title value="Only ampersand (&amp; named) - working"/>

this works without problems StructureDefinition-TestAmpNamed.

However if we add a the ordinal Value Extension to the Observation the html is invalid and shows in the browser a white page, TestExtAmpNamed

If the title has no ampersand in it, it is working.

The difference between the generated html is:

StructureDefinition-TestAmpNamed:

  <head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
    <title>CH.FHIR.IG.CH-IG\Only ampersand (& named) - working - FHIR v4.0.1</title>

    <!-- snip -->
  </head>

StructureDefinition-TestExtAmpNamed.html:

  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title>CH.FHIR.IG.CH-IG\Extension and ampersand (&amp; named) - not working - FHIR v4.0.1/title&gt;
    <meta name="viewport" />
     <!-- 1) difference with escaping &amp; 2) title tag is not closed, 3) head is not closed before content is coming, only at hen den -->


    <!-- end of file</h2></div></div></div></div></div></body></title></head></html> -->

It looks like the html generation trips over the title in the second case :

/title&gt; instead of </title>

the pages are generated by the IGPublisher with the help of templates and jekyll:

template/includes/fragment-pagebegin.md has the following content:

    <meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
    <title>{{site.data.fhir.igId | upcase}}\{{site.data.pages[page.path].title}} - FHIR v{{site.data.fhir.version}}</title>

so it looks that site.data.pages[page.path].title might be the culprit

this file can be found in temp/pages/_data pages.json: however they look exactly the same, should not give an issue with template.

"StructureDefinition-TestExtAmpNamed.html": {
    "title": "Extension and ampersand (& named) - not working",
},

"StructureDefinition-TestAmpNamed.html": {
    "title": "Only ampersand (& named) - working",
},

running jekyll directly on the command line indeed shows that the output is correct:

jekyll build -s temp/pages -d output

now the pages shows in the browser and the title is correct.

but what is different now, is that i have the yellow note:

<!--ReleaseHeader--><p id="publish-box">Publish Box goes here</p><!--EndReleaseHeader-->

for a regular ig build the version is mentioned, in our case:

<!--ReleaseHeader--><p id="publish-box">CH IG (R4) - Local Development build (v0.1.0). See the <a href="http://fhir.ch/ig/ch-ig/history.html">Directory of published versions</a></p>

brings IGPublisher as a suspect after processing in jekyll ...

During the "Checking Output HTML" phase, the files get updated when something has been changed:

in /org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/HTLMLInspector.java L273

      if (lf.isHasXhtml()) {
        XhtmlNode x = new XhtmlParser().setMustBeWellFormed(strict).parse(new FileInputStream(lf.filename), null);
        referencesValidatorPack = false;
        if (checkLinks(s, "", x, null, messages, false) != NodeChangeType.NONE) { // returns true if changed
          saveFile(lf, x);
        }

saveFile is commented out the html displays correctly, so
1) checkLinks returns a change
2) why does saveFile fail?

in checkLinks it triggers the return true with a condition of NodeChangeType.SELF set to true

    for (XhtmlNode c : x.getChildNodes()) {
      NodeChangeType ct = checkLinks(s, path, c, nuid, messages, inPre || "pre".equals(x.getName()));
      if (ct == NodeChangeType.SELF) {
        nSelfChanged = true;
        nchanged = true;
      } else if (ct == NodeChangeType.CHILD) {
        nchanged = true;
      }
    }

this is caused by checkResolve Link fails which cannot be resolved:

<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck0004.png)" class="hierarchy"><img src="tbl_spacer.png" alt="." style="background-color: inherit" class="hierarchy"/><img src="tbl_blank.png" alt="." style="background-color: inherit" class="hierarchy"/><img src="tbl_blank.png" alt="." style="background-color: inherit" class="hierarchy"/><img src="tbl_vjoin_end.png" alt="." style="background-color: inherit" class="hierarchy"/><img src="icon_slice_item.png" alt="." style="background-color: #F7F7F7; background-color: inherit" title="Slice Item" class="hierarchy"/> <a href="StructureDefinition-TestExtAmpNamed-definitions.html#Observation.valueCodeableConcept.coding.extension:ordinalValue" title="Extension URL = http://hl7.org/fhir/StructureDefinition/ordinalValue">ordinalValue</a><a name="Observation.valueCodeableConcept.coding.extension"> </a></td>

they are added also in this process added in the qa.html of the IG Publisher (actually could have noticed this here first in qa.html instead of debugging IGPublisher):

  1. StructureDefinition-TestExt-definitions.html#/html/body/div/div/div/div/div/table/tr/td/p/a at Line 478, column 371 error The link 'questionnaire.html' for "Questionnaires" cannot be resolved
  2. StructureDefinition-TestExt.html#/html/body/div/div/div/div/div/div/div/div/div/table/tr/td/a at Line 521, column 809 error The link 'StructureDefinition-TestExt-definitions.html#Observation.valueCodeableConcept.coding.extension:ordinalValue' for "ordinalValue" cannot be resolved (valid targets: 115 targets)

The first url cannot be resolved, because the ordinal Extension has defined in the comment a relative link, see http://hl7.org/fhir/extension-ordinalvalue.xml.html. This relative link
is kept when incorporating it our Observation which includes this extension and can then not be resolved because it is not relative to the FHIR spec. For
Observation.hasMember the link is changed to [QuestionnaireResponse](http://hl7.org/fhir/R4/questionnaireresponse.html), event though in the base spec master format definition it is also [QuestionnaireResponse](questionnaireresponse.html). This looks like the extension comments are not expanded to the fullUrl in the IG Publisher.

The second url cannot be resolved because the fragment on the differential table is not corresponding to the defined fragment on the detailed description tag, in the detailed description tag there is additional .value. This is occuring in the Differential Table Link by clicking on ordinalValue, but not in the Snapshot view, I think the Differential needs to be fixed.

Differential link/fragment for ordinalValue: StructureDefinition-TestExt.html#Observation.valueCodeableConcept.coding.extension:ordinalValue
Snapshot link/fragment for StructureDefinition-TestExt-definitions.html#Observation.value[x]:valueCodeableConcept.coding.extension:ordinalValue

The not resolving Link triggers the saving of the file, so this function looks like it does not serialize correctly the xhtml when the tile has an ampersand in it, BUT WAIT!!! & not escaped in html, see:

    <title>CH.FHIR.IG.CH-IG\Only ampersand (& named) - working - FHIR v4.0.1</title>

This is not correct according to xhtml in C.12 C.12. Using Ampersands in Attribute Values (and Elsewhere) and https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references. So the template needs to be changed to that the title is escaped (& instead of &amp) in the jekyll template, and we are back to the template constructing the html page:

from:
{{site.data.pages[page.path].title

to:
{{site.data.pages[page.path].title | escape_once }}

we are using the [fhir.base.template#current]https://github.com/HL7/ig-template-base which is configured in ig.ini.
forked it to modify

we run the ig publisher

java -jar /Users/oliveregger/.vscode/extensions/yannick-lagger.vscode-fhir-tools-1.4.1/publisher.jar -ig . -tx n/a
...
Installing fhir.base.template#dev to the package cache

now we change ig.ini to use fhir.base.template#dev instead of fhir.base.template#current and we should have the
pages also reappearing when running IG Publisher, and yes finally, we have it working ....

Pull Request is here.

For the resolve Links issues I will create two github issues.

view this post on Zulip Lloyd McKenzie (Jul 21 2021 at 14:39):

@Oliver Egger, thanks for the thorough job of debugging. One small correction on your pull request.

view this post on Zulip Oliver Egger (Jul 21 2021 at 15:10):

@Lloyd McKenzie thanks for the review and merge!


Last updated: Apr 12 2022 at 19:14 UTC