fix spelling of heirarchy

This commit is contained in:
Grahame Grieve 2024-04-20 23:32:52 +10:00
parent ed18ec2cc6
commit 3fb9bc20f4
13 changed files with 71 additions and 83 deletions

View File

@ -380,7 +380,7 @@ public class ICD11Generator {
cs.setPublisher("WHO"); cs.setPublisher("WHO");
cs.setCopyright("Consult WHO For terms of use"); cs.setCopyright("Consult WHO For terms of use");
cs.setCaseSensitive(true); cs.setCaseSensitive(true);
cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.ISA); // though we aren't going to have a heirarchy cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.ISA); // though we aren't going to have a hierarchy
// cs.setCompositional(true); // cs.setCompositional(true);
// cs.setVersionNeeded(true); // cs.setVersionNeeded(true);
cs.setValueSet("http://id.who.int/icd11/ValueSet/all-foundation"); cs.setValueSet("http://id.who.int/icd11/ValueSet/all-foundation");

View File

@ -107,7 +107,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
private List<ValueSetExpansionContainsComponent> roots = new ArrayList<ValueSet.ValueSetExpansionContainsComponent>(); private List<ValueSetExpansionContainsComponent> roots = new ArrayList<ValueSet.ValueSetExpansionContainsComponent>();
private Map<String, ValueSetExpansionContainsComponent> map = new HashMap<String, ValueSet.ValueSetExpansionContainsComponent>(); private Map<String, ValueSetExpansionContainsComponent> map = new HashMap<String, ValueSet.ValueSetExpansionContainsComponent>();
private IWorkerContext context; private IWorkerContext context;
private boolean canBeHeirarchy = true; private boolean canBeHierarchy = true;
private Set<String> excludeKeys = new HashSet<String>(); private Set<String> excludeKeys = new HashSet<String>();
private Set<String> excludeSystems = new HashSet<String>(); private Set<String> excludeSystems = new HashSet<String>();
private ValueSetExpanderFactory factory; private ValueSetExpanderFactory factory;
@ -151,13 +151,13 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
String s = key(n); String s = key(n);
if (map.containsKey(s) || excludeKeys.contains(s)) { if (map.containsKey(s) || excludeKeys.contains(s)) {
canBeHeirarchy = false; canBeHierarchy = false;
} else { } else {
codes.add(n); codes.add(n);
map.put(s, n); map.put(s, n);
total++; total++;
} }
if (canBeHeirarchy && parent != null) { if (canBeHierarchy && parent != null) {
parent.getContains().add(n); parent.getContains().add(n);
} else { } else {
roots.add(n); roots.add(n);
@ -198,7 +198,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
ValueSetExpansionContainsComponent np = null; ValueSetExpansionContainsComponent np = null;
boolean abs = CodeSystemUtilities.isNotSelectable(cs, def); boolean abs = CodeSystemUtilities.isNotSelectable(cs, def);
boolean inc = CodeSystemUtilities.isInactive(cs, def); boolean inc = CodeSystemUtilities.isInactive(cs, def);
if (canBeHeirarchy || !abs) if (canBeHierarchy || !abs)
np = addCode(system, def.getCode(), def.getDisplay(), parent, def.getDesignation(), profile, abs, inc, filters); np = addCode(system, def.getCode(), def.getDisplay(), parent, def.getDesignation(), profile, abs, inc, filters);
for (ConceptDefinitionComponent c : def.getConcept()) for (ConceptDefinitionComponent c : def.getConcept())
addCodeAndDescendents(cs, system, c, np, profile, filters); addCodeAndDescendents(cs, system, c, np, profile, filters);
@ -280,7 +280,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
if (source.hasCompose()) if (source.hasCompose())
handleCompose(source.getCompose(), focus.getExpansion().getParameter(), profile); handleCompose(source.getCompose(), focus.getExpansion().getParameter(), profile);
if (canBeHeirarchy) { if (canBeHierarchy) {
for (ValueSetExpansionContainsComponent c : roots) { for (ValueSetExpansionContainsComponent c : roots) {
focus.getExpansion().getContains().add(c); focus.getExpansion().getContains().add(c);
} }
@ -288,7 +288,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
for (ValueSetExpansionContainsComponent c : codes) { for (ValueSetExpansionContainsComponent c : codes) {
if (map.containsKey(key(c)) && !c.getAbstract()) { // we may have added abstract codes earlier while we still thought it might be heirarchical, but later we gave up, so now ignore them if (map.containsKey(key(c)) && !c.getAbstract()) { // we may have added abstract codes earlier while we still thought it might be heirarchical, but later we gave up, so now ignore them
focus.getExpansion().getContains().add(c); focus.getExpansion().getContains().add(c);
c.getContains().clear(); // make sure any heirarchy is wiped c.getContains().clear(); // make sure any hierarchy is wiped
} }
} }
} }
@ -321,12 +321,6 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
return res; return res;
} }
private void addToHeirarchy(List<ValueSetExpansionContainsComponent> target, List<ValueSetExpansionContainsComponent> source) {
for (ValueSetExpansionContainsComponent s : source) {
target.add(s);
}
}
private String getCodeDisplay(CodeSystem cs, String code) throws TerminologyServiceException { private String getCodeDisplay(CodeSystem cs, String code) throws TerminologyServiceException {
ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), code); ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), code);
if (def == null) if (def == null)
@ -350,13 +344,13 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
// Exclude comes first because we build up a map of things to exclude // Exclude comes first because we build up a map of things to exclude
for (ConceptSetComponent inc : compose.getExclude()) for (ConceptSetComponent inc : compose.getExclude())
excludeCodes(inc, params); excludeCodes(inc, params);
canBeHeirarchy = !profile.getExcludeNested() && excludeKeys.isEmpty() && excludeSystems.isEmpty(); canBeHierarchy = !profile.getExcludeNested() && excludeKeys.isEmpty() && excludeSystems.isEmpty();
boolean first = true; boolean first = true;
for (ConceptSetComponent inc : compose.getInclude()) { for (ConceptSetComponent inc : compose.getInclude()) {
if (first == true) if (first == true)
first = false; first = false;
else else
canBeHeirarchy = false; canBeHierarchy = false;
includeCodes(inc, params, profile); includeCodes(inc, params, profile);
} }
@ -381,7 +375,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
if (!existsInParams(params, p.getName(), p.getValue())) if (!existsInParams(params, p.getName(), p.getValue()))
params.add(p); params.add(p);
} }
canBeHeirarchy = false; // if we're importing a value set, we have to be combining, so we won't try for a heirarchy canBeHierarchy = false; // if we're importing a value set, we have to be combining, so we won't try for a hierarchy
return vso.getValueset(); return vso.getValueset();
} }
@ -406,7 +400,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
} else { } else {
CodeSystem cs = context.fetchCodeSystem(inc.getSystem()); CodeSystem cs = context.fetchCodeSystem(inc.getSystem());
if ((cs == null || cs.getContent() != CodeSystemContentMode.COMPLETE) && context.supportsSystem(inc.getSystem())) { if ((cs == null || cs.getContent() != CodeSystemContentMode.COMPLETE) && context.supportsSystem(inc.getSystem())) {
addCodes(context.expandVS(inc, canBeHeirarchy), params, profile, imports); addCodes(context.expandVS(inc, canBeHierarchy), params, profile, imports);
return; return;
} }
@ -430,14 +424,14 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
} }
if (!inc.getConcept().isEmpty()) { if (!inc.getConcept().isEmpty()) {
canBeHeirarchy = false; canBeHierarchy = false;
for (ConceptReferenceComponent c : inc.getConcept()) { for (ConceptReferenceComponent c : inc.getConcept()) {
addCode(inc.getSystem(), c.getCode(), Utilities.noString(c.getDisplay()) ? getCodeDisplay(cs, c.getCode()) : c.getDisplay(), null, convertDesignations(c.getDesignation()), profile, false, addCode(inc.getSystem(), c.getCode(), Utilities.noString(c.getDisplay()) ? getCodeDisplay(cs, c.getCode()) : c.getDisplay(), null, convertDesignations(c.getDesignation()), profile, false,
CodeSystemUtilities.isInactive(cs, c.getCode()), imports); CodeSystemUtilities.isInactive(cs, c.getCode()), imports);
} }
} }
if (inc.getFilter().size() > 1) { if (inc.getFilter().size() > 1) {
canBeHeirarchy = false; // which will bt the case if we get around to supporting this canBeHierarchy = false; // which will bt the case if we get around to supporting this
throw new TerminologyServiceException("Multiple filters not handled yet"); // need to and them, and this isn't done yet. But this shouldn't arise in non loinc and snomed value sets throw new TerminologyServiceException("Multiple filters not handled yet"); // need to and them, and this isn't done yet. But this shouldn't arise in non loinc and snomed value sets
} }
if (inc.getFilter().size() == 1) { if (inc.getFilter().size() == 1) {
@ -457,7 +451,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
addCodeAndDescendents(cs, inc.getSystem(), c, null, profile, imports); addCodeAndDescendents(cs, inc.getSystem(), c, null, profile, imports);
} else if ("display".equals(fc.getProperty()) && fc.getOp() == FilterOperator.EQUAL) { } else if ("display".equals(fc.getProperty()) && fc.getOp() == FilterOperator.EQUAL) {
// gg; note: wtf is this: if the filter is display=v, look up the code 'v', and see if it's diplsay is 'v'? // gg; note: wtf is this: if the filter is display=v, look up the code 'v', and see if it's diplsay is 'v'?
canBeHeirarchy = false; canBeHierarchy = false;
ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), fc.getValue()); ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), fc.getValue());
if (def != null) { if (def != null) {
if (isNotBlank(def.getDisplay()) && isNotBlank(fc.getValue())) { if (isNotBlank(def.getDisplay()) && isNotBlank(fc.getValue())) {

View File

@ -299,7 +299,7 @@ public class CodeSystemUtilities {
} }
// see http://hl7.org/fhir/R4/codesystem.html#hierachy // see http://hl7.org/fhir/R4/codesystem.html#hierachy
// returns additional parents not in the heirarchy // returns additional parents not in the hierarchy
public static List<String> getOtherChildren(CodeSystem cs, ConceptDefinitionComponent c) { public static List<String> getOtherChildren(CodeSystem cs, ConceptDefinitionComponent c) {
List<String> res = new ArrayList<String>(); List<String> res = new ArrayList<String>();
for (ConceptPropertyComponent p : c.getProperty()) { for (ConceptPropertyComponent p : c.getProperty()) {

View File

@ -106,7 +106,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
private List<ValueSetExpansionContainsComponent> roots = new ArrayList<ValueSet.ValueSetExpansionContainsComponent>(); private List<ValueSetExpansionContainsComponent> roots = new ArrayList<ValueSet.ValueSetExpansionContainsComponent>();
private Map<String, ValueSetExpansionContainsComponent> map = new HashMap<String, ValueSet.ValueSetExpansionContainsComponent>(); private Map<String, ValueSetExpansionContainsComponent> map = new HashMap<String, ValueSet.ValueSetExpansionContainsComponent>();
private IWorkerContext context; private IWorkerContext context;
private boolean canBeHeirarchy = true; private boolean canBeHierarchy = true;
private Set<String> excludeKeys = new HashSet<String>(); private Set<String> excludeKeys = new HashSet<String>();
private Set<String> excludeSystems = new HashSet<String>(); private Set<String> excludeSystems = new HashSet<String>();
private ValueSet focus; private ValueSet focus;
@ -152,13 +152,13 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
String s = key(n); String s = key(n);
if (map.containsKey(s) || excludeKeys.contains(s)) { if (map.containsKey(s) || excludeKeys.contains(s)) {
canBeHeirarchy = false; canBeHierarchy = false;
} else { } else {
codes.add(n); codes.add(n);
map.put(s, n); map.put(s, n);
total++; total++;
} }
if (canBeHeirarchy && parent != null) { if (canBeHierarchy && parent != null) {
parent.getContains().add(n); parent.getContains().add(n);
} else { } else {
roots.add(n); roots.add(n);
@ -227,7 +227,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
ValueSetExpansionContainsComponent np = null; ValueSetExpansionContainsComponent np = null;
boolean abs = CodeSystemUtilities.isNotSelectable(cs, def); boolean abs = CodeSystemUtilities.isNotSelectable(cs, def);
boolean inc = CodeSystemUtilities.isInactive(cs, def); boolean inc = CodeSystemUtilities.isInactive(cs, def);
if (canBeHeirarchy || !abs) if (canBeHierarchy || !abs)
np = addCode(system, def.getCode(), def.getDisplay(), parent, def.getDesignation(), expParams, abs, inc, np = addCode(system, def.getCode(), def.getDisplay(), parent, def.getDesignation(), expParams, abs, inc,
filters); filters);
for (ConceptDefinitionComponent c : def.getConcept()) for (ConceptDefinitionComponent c : def.getConcept())
@ -343,7 +343,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
if (source.hasCompose()) if (source.hasCompose())
handleCompose(source.getCompose(), focus.getExpansion().getParameter(), expParams, source.getUrl()); handleCompose(source.getCompose(), focus.getExpansion().getParameter(), expParams, source.getUrl());
if (canBeHeirarchy) { if (canBeHierarchy) {
for (ValueSetExpansionContainsComponent c : roots) { for (ValueSetExpansionContainsComponent c : roots) {
focus.getExpansion().getContains().add(c); focus.getExpansion().getContains().add(c);
} }
@ -353,7 +353,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
// thought it might be heirarchical, but later we gave up, so // thought it might be heirarchical, but later we gave up, so
// now ignore them // now ignore them
focus.getExpansion().getContains().add(c); focus.getExpansion().getContains().add(c);
c.getContains().clear(); // make sure any heirarchy is wiped c.getContains().clear(); // make sure any hierarchy is wiped
} }
} }
} }
@ -372,13 +372,6 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
return res; return res;
} }
private void addToHeirarchy(List<ValueSetExpansionContainsComponent> target,
List<ValueSetExpansionContainsComponent> source) {
for (ValueSetExpansionContainsComponent s : source) {
target.add(s);
}
}
private String getCodeDisplay(CodeSystem cs, String code) throws TerminologyServiceException { private String getCodeDisplay(CodeSystem cs, String code) throws TerminologyServiceException {
ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), code); ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), code);
if (def == null) if (def == null)
@ -403,14 +396,14 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
// Exclude comes first because we build up a map of things to exclude // Exclude comes first because we build up a map of things to exclude
for (ConceptSetComponent inc : compose.getExclude()) for (ConceptSetComponent inc : compose.getExclude())
excludeCodes(inc, params, ctxt); excludeCodes(inc, params, ctxt);
canBeHeirarchy = !expParams.getParameterBool("excludeNested") && excludeKeys.isEmpty() && excludeSystems.isEmpty(); canBeHierarchy = !expParams.getParameterBool("excludeNested") && excludeKeys.isEmpty() && excludeSystems.isEmpty();
boolean first = true; boolean first = true;
for (ConceptSetComponent inc : compose.getInclude()) { for (ConceptSetComponent inc : compose.getInclude()) {
if (first == true) if (first == true)
first = false; first = false;
else else
canBeHeirarchy = false; canBeHierarchy = false;
includeCodes(inc, params, expParams, canBeHeirarchy); includeCodes(inc, params, expParams, canBeHierarchy);
} }
} }
@ -433,8 +426,8 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
if (!existsInParams(params, p.getName(), p.getValue())) if (!existsInParams(params, p.getName(), p.getValue()))
params.add(p); params.add(p);
} }
canBeHeirarchy = false; // if we're importing a value set, we have to be combining, so we won't try for canBeHierarchy = false; // if we're importing a value set, we have to be combining, so we won't try for
// a heirarchy // a hierarchy
return vso.getValueset(); return vso.getValueset();
} }
@ -518,7 +511,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
} }
if (!inc.getConcept().isEmpty()) { if (!inc.getConcept().isEmpty()) {
canBeHeirarchy = false; canBeHierarchy = false;
for (ConceptReferenceComponent c : inc.getConcept()) { for (ConceptReferenceComponent c : inc.getConcept()) {
c.checkNoModifiers("Code in Code System", "expanding"); c.checkNoModifiers("Code in Code System", "expanding");
addCode(inc.getSystem(), c.getCode(), addCode(inc.getSystem(), c.getCode(),
@ -528,7 +521,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
} }
} }
if (inc.getFilter().size() > 1) { if (inc.getFilter().size() > 1) {
canBeHeirarchy = false; // which will bt the case if we get around to supporting this canBeHierarchy = false; // which will bt the case if we get around to supporting this
throw new TerminologyServiceException("Multiple filters not handled yet"); // need to and them, and this isn't throw new TerminologyServiceException("Multiple filters not handled yet"); // need to and them, and this isn't
// done yet. But this shouldn't arise // done yet. But this shouldn't arise
// in non loinc and snomed value sets // in non loinc and snomed value sets
@ -562,7 +555,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander {
} else if ("display".equals(fc.getProperty()) && fc.getOp() == FilterOperator.EQUAL) { } else if ("display".equals(fc.getProperty()) && fc.getOp() == FilterOperator.EQUAL) {
// gg; note: wtf is this: if the filter is display=v, look up the code 'v', and // gg; note: wtf is this: if the filter is display=v, look up the code 'v', and
// see if it's diplsay is 'v'? // see if it's diplsay is 'v'?
canBeHeirarchy = false; canBeHierarchy = false;
ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), fc.getValue()); ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), fc.getValue());
if (def != null) { if (def != null) {
if (isNotBlank(def.getDisplay()) && isNotBlank(fc.getValue())) { if (isNotBlank(def.getDisplay()) && isNotBlank(fc.getValue())) {

View File

@ -420,7 +420,7 @@ public class CodeSystemUtilities {
} }
// see http://hl7.org/fhir/R4/codesystem.html#hierachy // see http://hl7.org/fhir/R4/codesystem.html#hierachy
// returns additional parents not in the heirarchy // returns additional parents not in the hierarchy
public static List<String> getOtherChildren(CodeSystem cs, ConceptDefinitionComponent c) { public static List<String> getOtherChildren(CodeSystem cs, ConceptDefinitionComponent c) {
List<String> res = new ArrayList<String>(); List<String> res = new ArrayList<String>();
for (ConceptPropertyComponent p : c.getProperty()) { for (ConceptPropertyComponent p : c.getProperty()) {

View File

@ -183,7 +183,7 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
private List<ValueSetExpansionContainsComponent> roots = new ArrayList<ValueSet.ValueSetExpansionContainsComponent>(); private List<ValueSetExpansionContainsComponent> roots = new ArrayList<ValueSet.ValueSetExpansionContainsComponent>();
private Map<String, ValueSetExpansionContainsComponent> map = new HashMap<String, ValueSet.ValueSetExpansionContainsComponent>(); private Map<String, ValueSetExpansionContainsComponent> map = new HashMap<String, ValueSet.ValueSetExpansionContainsComponent>();
private IWorkerContext context; private IWorkerContext context;
private boolean canBeHeirarchy = true; private boolean canBeHierarchy = true;
private boolean includeAbstract = true; private boolean includeAbstract = true;
private Set<String> excludeKeys = new HashSet<String>(); private Set<String> excludeKeys = new HashSet<String>();
private Set<String> excludeSystems = new HashSet<String>(); private Set<String> excludeSystems = new HashSet<String>();
@ -238,13 +238,13 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
String s = key(n); String s = key(n);
if (map.containsKey(s) || excludeKeys.contains(s)) { if (map.containsKey(s) || excludeKeys.contains(s)) {
canBeHeirarchy = false; canBeHierarchy = false;
} else { } else {
codes.add(n); codes.add(n);
map.put(s, n); map.put(s, n);
total++; total++;
} }
if (canBeHeirarchy && parent != null) { if (canBeHierarchy && parent != null) {
parent.getContains().add(n); parent.getContains().add(n);
} else { } else {
roots.add(n); roots.add(n);
@ -446,7 +446,7 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
handleCompose(source.getCompose(), focus.getExpansion(), expParams, source.getUrl(), handleCompose(source.getCompose(), focus.getExpansion(), expParams, source.getUrl(),
focus.getExpansion().getExtension()); focus.getExpansion().getExtension());
if (canBeHeirarchy) { if (canBeHierarchy) {
for (ValueSetExpansionContainsComponent c : roots) { for (ValueSetExpansionContainsComponent c : roots) {
focus.getExpansion().getContains().add(c); focus.getExpansion().getContains().add(c);
} }
@ -457,7 +457,7 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
// might be heirarchical, but later we // might be heirarchical, but later we
// gave up, so now ignore them // gave up, so now ignore them
focus.getExpansion().getContains().add(c); focus.getExpansion().getContains().add(c);
c.getContains().clear(); // make sure any heirarchy is wiped c.getContains().clear(); // make sure any hierarchy is wiped
} }
} }
} }
@ -493,15 +493,15 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
// Exclude comes first because we build up a map of things to exclude // Exclude comes first because we build up a map of things to exclude
for (ConceptSetComponent inc : compose.getExclude()) for (ConceptSetComponent inc : compose.getExclude())
excludeCodes(inc, exp.getParameter(), ctxt); excludeCodes(inc, exp.getParameter(), ctxt);
canBeHeirarchy = !expParams.getParameterBool("excludeNested") && excludeKeys.isEmpty() && excludeSystems.isEmpty(); canBeHierarchy = !expParams.getParameterBool("excludeNested") && excludeKeys.isEmpty() && excludeSystems.isEmpty();
includeAbstract = !expParams.getParameterBool("excludeNotForUI"); includeAbstract = !expParams.getParameterBool("excludeNotForUI");
boolean first = true; boolean first = true;
for (ConceptSetComponent inc : compose.getInclude()) { for (ConceptSetComponent inc : compose.getInclude()) {
if (first == true) if (first == true)
first = false; first = false;
else else
canBeHeirarchy = false; canBeHierarchy = false;
includeCodes(inc, exp, expParams, canBeHeirarchy, extensions); includeCodes(inc, exp, expParams, canBeHierarchy, extensions);
} }
} }
@ -540,8 +540,8 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
exp.getParameter().add(p); exp.getParameter().add(p);
} }
copyExpansion(vso.getValueset().getExpansion().getContains()); copyExpansion(vso.getValueset().getExpansion().getContains());
canBeHeirarchy = false; // if we're importing a value set, we have to be combining, so we won't try for canBeHierarchy = false; // if we're importing a value set, we have to be combining, so we won't try for
// a heirarchy // a hierarchy
return vso.getValueset(); return vso.getValueset();
} }
@ -681,7 +681,7 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
} }
if (!inc.getConcept().isEmpty()) { if (!inc.getConcept().isEmpty()) {
canBeHeirarchy = false; canBeHierarchy = false;
for (ConceptReferenceComponent c : inc.getConcept()) { for (ConceptReferenceComponent c : inc.getConcept()) {
c.checkNoModifiers("Code in Code System", "expanding"); c.checkNoModifiers("Code in Code System", "expanding");
ConceptDefinitionComponent def = CodeSystemUtilities.findCode(cs.getConcept(), c.getCode()); ConceptDefinitionComponent def = CodeSystemUtilities.findCode(cs.getConcept(), c.getCode());
@ -705,7 +705,7 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
} }
} }
if (inc.getFilter().size() > 1) { if (inc.getFilter().size() > 1) {
canBeHeirarchy = false; // which will bt the case if we get around to supporting this canBeHierarchy = false; // which will bt the case if we get around to supporting this
throw failTSE("Multiple filters not handled yet"); // need to and them, and this isn't done yet. But this throw failTSE("Multiple filters not handled yet"); // need to and them, and this isn't done yet. But this
// shouldn't arise in non loinc and snomed value sets // shouldn't arise in non loinc and snomed value sets
} }
@ -745,7 +745,7 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
} else if ("display".equals(fc.getProperty()) && fc.getOp() == FilterOperator.EQUAL) { } else if ("display".equals(fc.getProperty()) && fc.getOp() == FilterOperator.EQUAL) {
// gg; note: wtf is this: if the filter is display=v, look up the code 'v', and // gg; note: wtf is this: if the filter is display=v, look up the code 'v', and
// see if it's diplsay is 'v'? // see if it's diplsay is 'v'?
canBeHeirarchy = false; canBeHierarchy = false;
ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), fc.getValue()); ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), fc.getValue());
if (def != null) { if (def != null) {
if (isNotBlank(def.getDisplay()) && isNotBlank(fc.getValue())) { if (isNotBlank(def.getDisplay()) && isNotBlank(fc.getValue())) {

View File

@ -275,11 +275,11 @@ public class CodeSystemRenderer extends TerminologyRenderer {
private void makeHierarchyParam(XhtmlNode x, CodeSystem cs, Enumeration<CodeSystemHierarchyMeaning> hm) { private void makeHierarchyParam(XhtmlNode x, CodeSystem cs, Enumeration<CodeSystemHierarchyMeaning> hm) {
if (hm.hasValue()) { if (hm.hasValue()) {
String s = hm.getValue().getDisplay(); String s = hm.getValue().getDisplay();
renderStatus(hm, x).tx(" "+/*!#*/"in a "+s+" heirarchy"); renderStatus(hm, x).tx(" "+/*!#*/"in a "+s+" hierarchy");
} else if (VersionComparisonAnnotation.hasDeleted(cs, "hierarchyMeaning")) { } else if (VersionComparisonAnnotation.hasDeleted(cs, "hierarchyMeaning")) {
makeHierarchyParam(x, null, (Enumeration<CodeSystemHierarchyMeaning>) VersionComparisonAnnotation.getDeleted(cs, "hierarchyMeaning").get(0)); makeHierarchyParam(x, null, (Enumeration<CodeSystemHierarchyMeaning>) VersionComparisonAnnotation.getDeleted(cs, "hierarchyMeaning").get(0));
} else if (CodeSystemUtilities.hasHierarchy(cs)) { } else if (CodeSystemUtilities.hasHierarchy(cs)) {
x.tx(" "+/*!#*/"in an undefined heirarchy"); x.tx(" "+/*!#*/"in an undefined hierarchy");
} else { } else {
x.tx(""); x.tx("");
} }
@ -682,7 +682,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
} }
} }
for (ConceptDefinitionDesignationComponent cd : c.getDesignation()) { for (ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
if (cd.hasLanguage() && !langs.contains(cd.getLanguage()) && !c.getDefinition().equalsIgnoreCase(cd.getValue())) { if (cd.hasLanguage() && (langs == null || !langs.contains(cd.getLanguage())) && (c.getDefinition() == null || !c.getDefinition().equalsIgnoreCase(cd.getValue()))) {
list.add(new Translateable(cd.getLanguage(), cd.getValueElement())); list.add(new Translateable(cd.getLanguage(), cd.getValueElement()));
} }
} }

View File

@ -1017,14 +1017,14 @@ public class ValueSetRenderer extends TerminologyRenderer {
} }
private void renderExpansionRules(XhtmlNode x, ConceptSetComponent inc, int index, Map<String, ConceptDefinitionComponent> definitions) throws FHIRException, IOException { private void renderExpansionRules(XhtmlNode x, ConceptSetComponent inc, int index, Map<String, ConceptDefinitionComponent> definitions) throws FHIRException, IOException {
String s = /*!#*/"This include specifies a heirarchy for when value sets are generated for use in a User Interface, but the rules are not properly defined"; String s = /*!#*/"This include specifies a hierarchy for when value sets are generated for use in a User Interface, but the rules are not properly defined";
if (inc.hasExtension(ToolingExtensions.EXT_EXPAND_RULES)) { if (inc.hasExtension(ToolingExtensions.EXT_EXPAND_RULES)) {
String rule = inc.getExtensionString(ToolingExtensions.EXT_EXPAND_RULES); String rule = inc.getExtensionString(ToolingExtensions.EXT_EXPAND_RULES);
if (rule != null) { if (rule != null) {
switch (rule) { switch (rule) {
case "all-codes": s = /*!#*/"This include specifies a heirarchy for when value sets are generated for use in a User Interface. The expansion contains all the codes, and also this structure:"; case "all-codes": s = /*!#*/"This include specifies a hierarchy for when value sets are generated for use in a User Interface. The expansion contains all the codes, and also this structure:";
case "ungrouped": s = /*!#*/"This include specifies a heirarchy for when value sets are generated for use in a User Interface. The expansion contains this structure, and any codes not found in the structure:"; case "ungrouped": s = /*!#*/"This include specifies a hierarchy for when value sets are generated for use in a User Interface. The expansion contains this structure, and any codes not found in the structure:";
case "groups-only": s = /*!#*/"This include specifies a heirarchy for when value sets are generated for use in a User Interface. The expansion contains this structure:"; case "groups-only": s = /*!#*/"This include specifies a hierarchy for when value sets are generated for use in a User Interface. The expansion contains this structure:";
} }
} }
} }

View File

@ -607,7 +607,7 @@ public class CodeSystemUtilities extends TerminologyUtilities {
} }
// see http://hl7.org/fhir/R4/codesystem.html#hierachy // see http://hl7.org/fhir/R4/codesystem.html#hierachy
// returns additional parents not in the heirarchy // returns additional parents not in the hierarchy
public static List<String> getOtherChildren(CodeSystem cs, ConceptDefinitionComponent c) { public static List<String> getOtherChildren(CodeSystem cs, ConceptDefinitionComponent c) {
List<String> res = new ArrayList<String>(); List<String> res = new ArrayList<String>();
for (ConceptPropertyComponent p : c.getProperty()) { for (ConceptPropertyComponent p : c.getProperty()) {

View File

@ -320,7 +320,7 @@ public class ValueSetExpander extends ValueSetProcessBase {
String s = key(n); String s = key(n);
if (wc.getMap().containsKey(s) || wc.getExcludeKeys().contains(s)) { if (wc.getMap().containsKey(s) || wc.getExcludeKeys().contains(s)) {
wc.setCanBeHeirarchy(false); wc.setCanBeHierarchy(false);
} else { } else {
wc.getCodes().add(n); wc.getCodes().add(n);
wc.getMap().put(s, n); wc.getMap().put(s, n);
@ -335,7 +335,7 @@ public class ValueSetExpander extends ValueSetProcessBase {
// throw failCostly(context.formatMessage(I18nConstants.VALUESET_TOO_COSTLY, focus.getUrl(), ">" + Integer.toString(maxExpansionSize))); // throw failCostly(context.formatMessage(I18nConstants.VALUESET_TOO_COSTLY, focus.getUrl(), ">" + Integer.toString(maxExpansionSize)));
// } // }
} }
if (wc.isCanBeHeirarchy() && parent != null) { if (wc.isCanBeHierarchy() && parent != null) {
parent.getContains().add(n); parent.getContains().add(n);
} else if (!wc.getRootMap().containsKey(s)) { } else if (!wc.getRootMap().containsKey(s)) {
wc.getRootMap().put(s, n); wc.getRootMap().put(s, n);
@ -765,7 +765,7 @@ public class ValueSetExpander extends ValueSetProcessBase {
} else { } else {
throw failCostly(context.formatMessage(I18nConstants.VALUESET_TOO_COSTLY_COUNT, focus.getVersionedUrl(), ">" + MessageFormat.format("{0,number,#}", maxExpansionSize), MessageFormat.format("{0,number,#}", dwc.getTotal()))); throw failCostly(context.formatMessage(I18nConstants.VALUESET_TOO_COSTLY_COUNT, focus.getVersionedUrl(), ">" + MessageFormat.format("{0,number,#}", maxExpansionSize), MessageFormat.format("{0,number,#}", dwc.getTotal())));
} }
} else if (dwc.isCanBeHeirarchy() && ((dwc.getCountParam() == 0) || dwc.getCountParam() > dwc.getCodes().size())) { } else if (dwc.isCanBeHierarchy() && ((dwc.getCountParam() == 0) || dwc.getCountParam() > dwc.getCodes().size())) {
for (ValueSetExpansionContainsComponent c : dwc.getRoots()) { for (ValueSetExpansionContainsComponent c : dwc.getRoots()) {
focus.getExpansion().getContains().add(c); focus.getExpansion().getContains().add(c);
} }
@ -773,7 +773,7 @@ public class ValueSetExpander extends ValueSetProcessBase {
int i = 0; int i = 0;
int cc = 0; int cc = 0;
for (ValueSetExpansionContainsComponent c : dwc.getCodes()) { for (ValueSetExpansionContainsComponent c : dwc.getCodes()) {
c.getContains().clear(); // make sure any heirarchy is wiped c.getContains().clear(); // make sure any hierarchy is wiped
if (dwc.getMap().containsKey(key(c)) && (includeAbstract || !c.getAbstract())) { // we may have added abstract codes earlier while we still thought it might be heirarchical, but later we gave up, so now ignore them if (dwc.getMap().containsKey(key(c)) && (includeAbstract || !c.getAbstract())) { // we may have added abstract codes earlier while we still thought it might be heirarchical, but later we gave up, so now ignore them
if (dwc.getOffsetParam() == 0 || i >= dwc.getOffsetParam()) { if (dwc.getOffsetParam() == 0 || i >= dwc.getOffsetParam()) {
focus.getExpansion().getContains().add(c); focus.getExpansion().getContains().add(c);
@ -834,15 +834,15 @@ public class ValueSetExpander extends ValueSetProcessBase {
// Exclude comes first because we build up a map of things to exclude // Exclude comes first because we build up a map of things to exclude
for (ConceptSetComponent inc : compose.getExclude()) for (ConceptSetComponent inc : compose.getExclude())
excludeCodes(dwc, inc, expParams, exp, valueSet); excludeCodes(dwc, inc, expParams, exp, valueSet);
dwc.setCanBeHeirarchy(!expParams.getParameterBool("excludeNested") && dwc.getExcludeKeys().isEmpty() && dwc.getExcludeSystems().isEmpty() && dwc.getOffsetParam() == 0); dwc.setCanBeHierarchy(!expParams.getParameterBool("excludeNested") && dwc.getExcludeKeys().isEmpty() && dwc.getExcludeSystems().isEmpty() && dwc.getOffsetParam() == 0);
includeAbstract = !expParams.getParameterBool("excludeNotForUI"); includeAbstract = !expParams.getParameterBool("excludeNotForUI");
boolean first = true; boolean first = true;
for (ConceptSetComponent inc : compose.getInclude()) { for (ConceptSetComponent inc : compose.getInclude()) {
if (first == true) if (first == true)
first = false; first = false;
else else
dwc.setCanBeHeirarchy(false); dwc.setCanBeHierarchy(false);
includeCodes(inc, exp, expParams, dwc.isCanBeHeirarchy(), compose.hasInactive() ? !compose.getInactive() : checkNoInActiveFromParam(expParams), extensions, valueSet); includeCodes(inc, exp, expParams, dwc.isCanBeHierarchy(), compose.hasInactive() ? !compose.getInactive() : checkNoInActiveFromParam(expParams), extensions, valueSet);
} }
} }
@ -910,7 +910,7 @@ public class ValueSetExpander extends ValueSetProcessBase {
if (isValueSetUnionImports(valueSet)) { if (isValueSetUnionImports(valueSet)) {
copyExpansion(wc, evs.getContains()); copyExpansion(wc, evs.getContains());
} }
wc.setCanBeHeirarchy(false); // if we're importing a value set, we have to be combining, so we won't try for a heirarchy wc.setCanBeHierarchy(false); // if we're importing a value set, we have to be combining, so we won't try for a hierarchy
return vso.getValueset(); return vso.getValueset();
} }
@ -1109,7 +1109,7 @@ public class ValueSetExpander extends ValueSetProcessBase {
} }
if (!inc.getConcept().isEmpty()) { if (!inc.getConcept().isEmpty()) {
dwc.setCanBeHeirarchy(false); dwc.setCanBeHierarchy(false);
for (ConceptReferenceComponent c : inc.getConcept()) { for (ConceptReferenceComponent c : inc.getConcept()) {
c.checkNoModifiers("Code in Value Set", "expanding"); c.checkNoModifiers("Code in Value Set", "expanding");
ConceptDefinitionComponent def = CodeSystemUtilities.findCodeOrAltCode(cs.getConcept(), c.getCode(), null); ConceptDefinitionComponent def = CodeSystemUtilities.findCodeOrAltCode(cs.getConcept(), c.getCode(), null);
@ -1136,7 +1136,7 @@ public class ValueSetExpander extends ValueSetProcessBase {
} }
if (inc.getFilter().size() > 0) { if (inc.getFilter().size() > 0) {
if (inc.getFilter().size() > 1) { if (inc.getFilter().size() > 1) {
dwc.setCanBeHeirarchy(false); // which will be the case if we get around to supporting this dwc.setCanBeHierarchy(false); // which will be the case if we get around to supporting this
} }
if (cs.getContent() == CodeSystemContentMode.FRAGMENT) { if (cs.getContent() == CodeSystemContentMode.FRAGMENT) {
addFragmentWarning(exp, cs); addFragmentWarning(exp, cs);
@ -1203,7 +1203,7 @@ public class ValueSetExpander extends ValueSetProcessBase {
} else if ("display".equals(fc.getProperty()) && fc.getOp() == FilterOperator.EQUAL) { } else if ("display".equals(fc.getProperty()) && fc.getOp() == FilterOperator.EQUAL) {
// gg; note: wtf is this: if the filter is display=v, look up the code 'v', and see if it's display is 'v'? // gg; note: wtf is this: if the filter is display=v, look up the code 'v', and see if it's display is 'v'?
dwc.setCanBeHeirarchy(false); dwc.setCanBeHierarchy(false);
ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), fc.getValue()); ConceptDefinitionComponent def = getConceptForCode(cs.getConcept(), fc.getValue());
if (def != null) { if (def != null) {
if (isNotBlank(def.getDisplay()) && isNotBlank(fc.getValue())) { if (isNotBlank(def.getDisplay()) && isNotBlank(fc.getValue())) {

View File

@ -18,7 +18,7 @@ class WorkingContext {
private Set<String> excludeKeys = new HashSet<String>(); private Set<String> excludeKeys = new HashSet<String>();
private Set<String> excludeSystems = new HashSet<String>(); private Set<String> excludeSystems = new HashSet<String>();
private boolean canBeHeirarchy = true; private boolean canBeHierarchy = true;
private Integer offsetParam; private Integer offsetParam;
private Integer countParam; // allowed count. Because of internal processing, we allow more private Integer countParam; // allowed count. Because of internal processing, we allow more
private int total; // running count. This might be more than actually seen if we call out to an external server and only get the first 1000 codes private int total; // running count. This might be more than actually seen if we call out to an external server and only get the first 1000 codes
@ -48,12 +48,12 @@ class WorkingContext {
return excludeSystems; return excludeSystems;
} }
public boolean isCanBeHeirarchy() { public boolean isCanBeHierarchy() {
return canBeHeirarchy; return canBeHierarchy;
} }
public void setCanBeHeirarchy(boolean canBeHeirarchy) { public void setCanBeHierarchy(boolean canBeHierarchy) {
this.canBeHeirarchy = canBeHeirarchy; this.canBeHierarchy = canBeHierarchy;
} }
public boolean hasOffsetParam() { public boolean hasOffsetParam() {

View File

@ -218,7 +218,7 @@ public class ToolingExtensions {
public static final String EXT_Q_DISPLAY_CAT = "http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory"; public static final String EXT_Q_DISPLAY_CAT = "http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory";
public static final String EXT_REND_MD = "http://hl7.org/fhir/StructureDefinition/rendering-markdown"; public static final String EXT_REND_MD = "http://hl7.org/fhir/StructureDefinition/rendering-markdown";
public static final String EXT_CAP_STMT_EXPECT = "http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation"; public static final String EXT_CAP_STMT_EXPECT = "http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation";
public static final String EXT_ED_HEIRARCHY = "http://hl7.org/fhir/StructureDefinition/elementdefinition-heirarchy"; public static final String EXT_ED_HIERARCHY = "http://hl7.org/fhir/StructureDefinition/elementdefinition-hierarchy";
public static final String EXT_SD_IMPOSE_PROFILE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-imposeProfile"; public static final String EXT_SD_IMPOSE_PROFILE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-imposeProfile";
public static final String EXT_SD_COMPLIES_WITH_PROFILE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-compliesWithProfile"; public static final String EXT_SD_COMPLIES_WITH_PROFILE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-compliesWithProfile";
public static final String EXT_DEF_TYPE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype"; public static final String EXT_DEF_TYPE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype";
@ -272,6 +272,7 @@ public class ToolingExtensions {
public static final String EXT_APPLICABLE_VERSION = "http://hl7.org/fhir/StructureDefinition/version-specific-use"; public static final String EXT_APPLICABLE_VERSION = "http://hl7.org/fhir/StructureDefinition/version-specific-use";
public static final String EXT_APPLICABLE_VERSION_VALUE = "http://hl7.org/fhir/StructureDefinition/version-specific-value"; public static final String EXT_APPLICABLE_VERSION_VALUE = "http://hl7.org/fhir/StructureDefinition/version-specific-value";
public static final String EXT_IG_URL = "http://hl7.org/fhir/tools/StructureDefinition/implementationguide-resource-uri"; public static final String EXT_IG_URL = "http://hl7.org/fhir/tools/StructureDefinition/implementationguide-resource-uri";
public static final String EXT_VS_CS_SUPPL_NEEDED = "http://hl7.org/fhir/StructureDefinition/valueset-supplement";
// specific extension helpers // specific extension helpers

View File

@ -552,7 +552,7 @@ public class CodeSystemValidator extends BaseValidator {
hint(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, s.getLiteralPath(), false, I18nConstants.CODESYSTEM_CS_NONHL7_MISSING_ELEMENT, "caseSensitive"); hint(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, s.getLiteralPath(), false, I18nConstants.CODESYSTEM_CS_NONHL7_MISSING_ELEMENT, "caseSensitive");
} }
} }
if (Utilities.noString(hierarchyMeaning) && hasHeirarchy(cs)) { if (Utilities.noString(hierarchyMeaning) && hasHierarchy(cs)) {
NodeStack s = stack; NodeStack s = stack;
Element c = cs.getNamedChild("hierarchyMeaning", false); Element c = cs.getNamedChild("hierarchyMeaning", false);
if (c != null) { if (c != null) {
@ -604,7 +604,7 @@ public class CodeSystemValidator extends BaseValidator {
} }
private boolean hasHeirarchy(Element cs) { private boolean hasHierarchy(Element cs) {
for (Element c : cs.getChildren("concept")) { for (Element c : cs.getChildren("concept")) {
if (c.hasChildren("concept")) { if (c.hasChildren("concept")) {
return true; return true;