MauroDataMapper-NHSD / mdm-plugin-nhs-data-dictionary

Mauro Core Plugin for the NHS Data Dictionary
Apache License 2.0
0 stars 0 forks source link

Cannot preview any choice element row from a Data Set #70

Closed pjmonks closed 1 day ago

pjmonks commented 1 month ago

Overview

The data set "Clinical Data Sets > COSDS > Cancer Outcomes and Services Data Set - Core" has a table called "DEMOGRAPHICS - CORE". The live published website looks like this:

image

But the Orchestrator preview does not show the address choice field:

image

Mauro Views

In Mauro, the address choice field is set up like this:

image

This is the "Data Set Table" profile for the "Address Choice" class:

image

And here is some additional hidden metadata to complete the row information:

image

Other choice types

Upon further investigation, I don't think any choice type is being rendered to the HTML preview of a data set table. For example, this is the live published "Diagnostic Imaging Data Set" from https://www.datadictionary.nhs.uk/data_sets/clinical_data_sets/diagnostic_imaging_data_set.html:

image

This is the Mauro structure of the "IMAGING CODE" choice:

image

But this is the preview of the data set in the Orchestrator. Notice the choice between "IMAGING CODE" elements is missing:

image

Fixes

pjmonks commented 1 month ago

@mhocc I've looked at the code and think choices are being rendered to DITA only, but not the HTML preview.

For DITA, I've traced markup generation to this:

  1. NhsDDDataSetClass represents a table, or a sub-group within a table.
  2. NhsDDDataSetClass.outputClassAsDita() will render the table and rows
  3. NhsDDDataSetClass.addAllChildRows() will render the list of rows to add to the table/group.
  4. NhsDDDataSetClass.addChildRow() will render the row itself, which will have two columns - a "Mandation" and a text entry containing a link to a data element
  5. NhsDDDataSetClass.getXRefStringFromItem() will produce the paragraphs/links for the row
  6. NhsDDDataSetClass.createEntryParagraphs() is where all the possible choice options are considered for rendering, including "Address choice"

For HTML markup generation, a different route is taken:

  1. NhsDDDataSet.getStructureAsHtml() is the entry point
  2. Which then uses OtherDataSetToHtml.outputAsHtml() to render the whole data set to HTML
  3. OtherDataSetToHtml.outputClassAsHtml() is the equivalent of NhsDDDataSetClass.outputClassAsDita(), along with other similarities to the DITA code
  4. OtherDataSetToHtml.addChildRow() is where the problem is, it does not include the choice logic that the DITA version has.
mhocc commented 3 weeks ago

This is partially working: it gets the address links and produces the two options but there's too much hard-coding and the links are to https://datadictionary.nhs.uk/ and not styled correctly