fix bug in rendering and alter load order for StructureDefinitions

This commit is contained in:
Grahame Grieve 2019-08-02 11:39:56 +10:00
parent bf39445d87
commit e604e89290
4 changed files with 21 additions and 5 deletions

View File

@ -3037,8 +3037,8 @@ public class ProfileUtilities extends TranslatingUtilities {
if (!useTableForFixedValues || definition.getFixed().isPrimitive())
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, buildJson(definition.getFixed()), null).addStyle("color: darkgreen")));
else {
c.getPieces().add(checkForNoChange(definition.getPattern(), gen.new Piece(null, "As shown", null).addStyle("color: darkgreen")));
genFixedValue(gen, row, definition.getPattern(), snapshot, false, corePath);
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "As shown", null).addStyle("color: darkgreen")));
genFixedValue(gen, row, definition.getFixed(), snapshot, false, corePath);
}
if (isCoded(definition.getFixed()) && !hasDescription(definition.getFixed())) {
Piece p = describeCoded(gen, definition.getFixed());

View File

@ -1115,5 +1115,15 @@ public abstract class BaseWorkerContext implements IWorkerContext {
public void setUcumService(UcumService ucumService) {
this.ucumService = ucumService;
}
@Override
public List<StructureDefinition> getStructures() {
List<StructureDefinition> res = new ArrayList<>();
synchronized (lock) { // tricky, because you need to lock this as well, but it's really not in use yet
res.addAll(structures.values());
}
return res;
}
}

View File

@ -22,9 +22,11 @@ package org.hl7.fhir.r5.context;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.fhir.ucum.UcumService;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.TerminologyServiceException;
import org.hl7.fhir.r5.formats.IParser;
@ -210,8 +212,10 @@ public interface IWorkerContext {
public List<String> getResourceNames();
public Set<String> getResourceNamesAsSet();
public List<String> getTypeNames();
public List<StructureDefinition> allStructures();
public List<StructureDefinition> allStructures(); // ensure snapshot exists...
public List<StructureDefinition> getStructures();
public List<MetadataResource> allConformanceResources();
public void generateSnapshot(StructureDefinition p) throws DefinitionException, FHIRException;
// -- Terminology services ------------------------------------------------------

View File

@ -117,13 +117,15 @@ public abstract class ParserBase {
return null;
}
// first pass: only look at base definitions
for (StructureDefinition sd : context.allStructures()) {
for (StructureDefinition sd : context.getStructures()) {
if (sd.getUrl().equals("http://hl7.org/fhir/StructureDefinition/"+name)) {
context.generateSnapshot(sd);
return sd;
}
}
for (StructureDefinition sd : context.allStructures()) {
for (StructureDefinition sd : context.getStructures()) {
if (name.equals(sd.getType()) && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
context.generateSnapshot(sd);
return sd;
}
}