Merge pull request #959 from hapifhir/gg-202210-ips-fixes

Gg 202210 ips fixes
This commit is contained in:
Grahame Grieve 2022-10-20 17:19:41 +11:00 committed by GitHub
commit ef5683c969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 12 deletions

View File

@ -1,7 +1,17 @@
## Validator Changes ## Validator Changes
* no changes * Improved Errors for bad resource ids
* R5 ballot: Hack around discovered issues in the ballot
* Enforce value set & code system versioning when validating codes
* Enable bulk -snapshot and -convert on multiple/wildcard -source
* Fix bug revalidating profiled abstract types
## Other code changes ## Other code changes
* no changes * Rework validator test cases to not have inter-test dependencies (+ fix up to allow contexts to be cloned)
* add First draft of xliff production
* Add ActorDefinition conversions R5 -> R4, R4B, R3
* Add support for validating logical model json files (not surfaced in CLI yet)
* Updates for changes to extension URLs in Tools IG
* Fix map rendering in value sets
* Fix broken link in R4 DeviceUseStatement

View File

@ -119,9 +119,6 @@ public abstract class TerminologyRenderer extends ResourceRenderer {
XhtmlNode td = tr.td(); XhtmlNode td = tr.td();
XhtmlNode b = td.b(); XhtmlNode b = td.b();
String link = m.getLink(); String link = m.getLink();
if (!Utilities.isAbsoluteUrl(link)) {
link = getContext().getSpecificationLink()+link;
}
XhtmlNode a = b.ah(link); XhtmlNode a = b.ah(link);
a.addText(m.getDetails().getName()); a.addText(m.getDetails().getName());
if (m.getDetails().isDoDescription() && m.getMap().hasDescription()) if (m.getDetails().isDoDescription() && m.getMap().hasDescription())

View File

@ -75,7 +75,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
} }
public boolean render(XhtmlNode x, ValueSet vs, boolean header) throws FHIRFormatError, DefinitionException, IOException { public boolean render(XhtmlNode x, ValueSet vs, boolean header) throws FHIRFormatError, DefinitionException, IOException {
List<UsedConceptMap> maps = findReleventMaps(vs); List<UsedConceptMap> maps = findReleventMaps(vs);
boolean hasExtensions; boolean hasExtensions;
if (vs.hasExpansion()) { if (vs.hasExpansion()) {
@ -1158,6 +1158,21 @@ public class ValueSetRenderer extends TerminologyRenderer {
addDesignationsToRow(c, designations, tr); addDesignationsToRow(c, designations, tr);
addLangaugesToRow(c, langs, tr); addLangaugesToRow(c, langs, tr);
} }
for (UsedConceptMap m : maps) {
td = tr.td();
List<TargetElementComponentWrapper> mappings = findMappingsForCode(c.getCode(), m.getMap());
boolean first = true;
for (TargetElementComponentWrapper mapping : mappings) {
if (!first)
td.br();
first = false;
XhtmlNode span = td.span(null, mapping.comp.getRelationship().toString());
span.addText(getCharForRelationship(mapping.comp));
addRefToCode(td, mapping.group.getTarget(), m.getLink(), mapping.comp.getCode());
if (!Utilities.noString(mapping.comp.getComment()))
td.i().tx("("+mapping.comp.getComment()+")");
}
}
} }
} }
if (inc.getFilter().size() > 0) { if (inc.getFilter().size() > 0) {

View File

@ -2,6 +2,8 @@ package org.hl7.fhir.r5.utils;
import org.hl7.fhir.r5.context.CanonicalResourceManager.CanonicalResourceProxy; import org.hl7.fhir.r5.context.CanonicalResourceManager.CanonicalResourceProxy;
import org.hl7.fhir.r5.context.IWorkerContext.PackageVersion; import org.hl7.fhir.r5.context.IWorkerContext.PackageVersion;
import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.StructureDefinition;
public class PackageHackerR5 { public class PackageHackerR5 {
@ -32,9 +34,23 @@ public class PackageHackerR5 {
r.hack("http://terminology.hl7.org/CodeSystem/v2-0360-2.3.1", "2.3.1"); r.hack("http://terminology.hl7.org/CodeSystem/v2-0360-2.3.1", "2.3.1");
} }
if ("http://hl7.org/fhir/StructureDefinition/DeviceUseStatement".equals(r.getUrl()) && "4.0.1".equals(r.getVersion())) {
StructureDefinition sd = (StructureDefinition) r.getResource();
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ed.hasRequirements()) {
ed.setRequirements(ed.getRequirements().replace("[http://hl7.org/fhir/StructureDefinition/bodySite](null.html)", "[http://hl7.org/fhir/StructureDefinition/bodySite](http://hl7.org/fhir/extension-bodysite.html)"));
}
}
for (ElementDefinition ed : sd.getDifferential().getElement()) {
if (ed.hasRequirements()) {
ed.setRequirements(ed.getRequirements().replace("[http://hl7.org/fhir/StructureDefinition/bodySite](null.html)", "[http://hl7.org/fhir/StructureDefinition/bodySite](http://hl7.org/fhir/extension-bodysite.html)"));
}
}
}
if (r.hasUrl() && r.getUrl().contains("|")) { if (r.hasUrl() && r.getUrl().contains("|")) {
assert false; assert false;
} }
} }
} }

View File

@ -5030,7 +5030,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return; // there'll be an error elsewhere in this case, and we're going to stop. return; // there'll be an error elsewhere in this case, and we're going to stop.
List<ElementDefinition> typeChildDefinitions = getActualTypeChildren(hostContext, element, actualType); List<ElementDefinition> typeChildDefinitions = getActualTypeChildren(hostContext, element, actualType);
// what were going to do is merge them - the type is not allowed to constrain things that the child definitions already do (well, if it does, it'll be ignored) // what were going to do is merge them - the type is not allowed to constrain things that the child definitions already do (well, if it does, it'll be ignored)
mergeChildLists(childDefinitions, typeChildDefinitions, definition.getPath(), actualType); childDefinitions = mergeChildLists(childDefinitions, typeChildDefinitions, definition.getPath(), actualType);
} }
List<ElementInfo> children = listChildren(element, stack); List<ElementInfo> children = listChildren(element, stack);
@ -5045,21 +5045,22 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
} }
private void mergeChildLists(List<ElementDefinition> master, List<ElementDefinition> additional, String masterPath, String typePath) { private List<ElementDefinition> mergeChildLists(List<ElementDefinition> source, List<ElementDefinition> additional, String masterPath, String typePath) {
List<ElementDefinition> res = new ArrayList<>();
res.addAll(source);
for (ElementDefinition ed : additional) { for (ElementDefinition ed : additional) {
boolean inMaster = false; boolean inMaster = false;
for (ElementDefinition t : master) { for (ElementDefinition t : source) {
String tp = masterPath + ed.getPath().substring(typePath.length()); String tp = masterPath + ed.getPath().substring(typePath.length());
if (t.getPath().equals(tp)) { if (t.getPath().equals(tp)) {
inMaster = true; inMaster = true;
} }
} }
if (!inMaster) { if (!inMaster) {
master.add(ed); res.add(ed);
} }
} }
return res;
} }
// todo: the element definition in context might assign a constrained profile for the type? // todo: the element definition in context might assign a constrained profile for the type?