Merge pull request #601 from hapifhir/gg-202109-network-fail

Gg 202109 network fail
This commit is contained in:
Grahame Grieve 2021-09-10 07:56:49 +10:00 committed by GitHub
commit c6fddeb552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 139 additions and 75 deletions

View File

@ -1038,8 +1038,8 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
for (CanonicalType c : inc.getValueSet()) { for (CanonicalType c : inc.getValueSet()) {
ValueSet vs = fetchResource(ValueSet.class, c.getValue()); ValueSet vs = fetchResource(ValueSet.class, c.getValue());
if (vs != null) { if (vs != null) {
if (isTxCaching && cacheId == null || !cached.contains(vs.getVUrl())) {
pin.addParameter().setName("tx-resource").setResource(vs); pin.addParameter().setName("tx-resource").setResource(vs);
if (isTxCaching && cacheId == null || !cached.contains(vs.getVUrl())) {
cached.add(vs.getVUrl()); cached.add(vs.getVUrl());
cache = true; cache = true;
} }
@ -1048,8 +1048,8 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
} }
CodeSystem cs = fetchResource(CodeSystem.class, inc.getSystem()); CodeSystem cs = fetchResource(CodeSystem.class, inc.getSystem());
if (cs != null) { if (cs != null) {
if (isTxCaching && cacheId == null || !cached.contains(cs.getVUrl())) {
pin.addParameter().setName("tx-resource").setResource(cs); pin.addParameter().setName("tx-resource").setResource(cs);
if (isTxCaching && cacheId == null || !cached.contains(cs.getVUrl())) {
cached.add(cs.getVUrl()); cached.add(cs.getVUrl());
cache = true; cache = true;
} }

View File

@ -89,7 +89,8 @@ public class UnsignedIntType extends IntegerType {
@Override @Override
public UnsignedIntType copy() { public UnsignedIntType copy() {
UnsignedIntType ret = new UnsignedIntType(getValue()); Integer value = getValue();
UnsignedIntType ret = value == null ? new UnsignedIntType() : new UnsignedIntType(value.intValue());
copyValues(ret); copyValues(ret);
return ret; return ret;
} }

View File

@ -21,7 +21,7 @@ public class CanonicalSpreadsheetGenerator extends SpreadsheetGenerator {
} }
protected Sheet renderCanonicalResource(CanonicalResource cr) { protected Sheet renderCanonicalResource(CanonicalResource cr) {
Sheet sheet = wb.createSheet("Metadata"); Sheet sheet = makeSheet("Metadata");
Row headerRow = sheet.createRow(0); Row headerRow = sheet.createRow(0);
addCell(headerRow, 0, "Property", styles.get("header")); addCell(headerRow, 0, "Property", styles.get("header"));

View File

@ -68,7 +68,7 @@ public class CodeSystemSpreadsheetGenerator extends CanonicalSpreadsheetGenerato
} }
private void addFilters(List<CodeSystemFilterComponent> filters) { private void addFilters(List<CodeSystemFilterComponent> filters) {
Sheet sheet = wb.createSheet("Filters"); Sheet sheet = makeSheet("Filters");
addHeaders(sheet, "Code", "Description", "Operators", "Value"); addHeaders(sheet, "Code", "Description", "Operators", "Value");
for (CodeSystemFilterComponent f : filters) { for (CodeSystemFilterComponent f : filters) {
CommaSeparatedStringBuilder cs = new CommaSeparatedStringBuilder(); CommaSeparatedStringBuilder cs = new CommaSeparatedStringBuilder();
@ -80,7 +80,7 @@ public class CodeSystemSpreadsheetGenerator extends CanonicalSpreadsheetGenerato
} }
private void addProperties(List<PropertyComponent> properties) { private void addProperties(List<PropertyComponent> properties) {
Sheet sheet = wb.createSheet("Properties"); Sheet sheet = makeSheet("Properties");
addHeaders(sheet, "Code", "Uri", "Description", "Type"); addHeaders(sheet, "Code", "Uri", "Description", "Type");
for (PropertyComponent p : properties) { for (PropertyComponent p : properties) {
addRow(sheet, p.getCode(), p.getUri(), p.getDescription(), p.getTypeElement().asStringValue()); addRow(sheet, p.getCode(), p.getUri(), p.getDescription(), p.getTypeElement().asStringValue());
@ -88,7 +88,7 @@ public class CodeSystemSpreadsheetGenerator extends CanonicalSpreadsheetGenerato
} }
private void addConcepts(List<ConceptDefinitionComponent> concepts) { private void addConcepts(List<ConceptDefinitionComponent> concepts) {
Sheet sheet = wb.createSheet("Concepts"); Sheet sheet = makeSheet("Concepts");
addHeaders(sheet, "Level", "Code", "Display", "Definition"); //todo: properties and designations addHeaders(sheet, "Level", "Code", "Display", "Definition"); //todo: properties and designations
addConcepts(sheet, 1, concepts); addConcepts(sheet, 1, concepts);
} }
@ -103,7 +103,7 @@ public class CodeSystemSpreadsheetGenerator extends CanonicalSpreadsheetGenerato
} }
private void genExpansionParams(List<ValueSetExpansionParameterComponent> params) { private void genExpansionParams(List<ValueSetExpansionParameterComponent> params) {
Sheet sheet = wb.createSheet("Expansion Parameters"); Sheet sheet = makeSheet("Expansion Parameters");
addHeaders(sheet, "Parameter", "Value"); addHeaders(sheet, "Parameter", "Value");
for (ValueSetExpansionParameterComponent p : params) { for (ValueSetExpansionParameterComponent p : params) {
addRow(sheet, p.getName(), dr.display(p.getValue())); addRow(sheet, p.getName(), dr.display(p.getValue()));
@ -111,7 +111,7 @@ public class CodeSystemSpreadsheetGenerator extends CanonicalSpreadsheetGenerato
} }
private void genExpansion(List<ValueSetExpansionContainsComponent> list) { private void genExpansion(List<ValueSetExpansionContainsComponent> list) {
Sheet sheet = wb.createSheet("Expansion"); Sheet sheet = makeSheet("Expansion");
addHeaders(sheet, "Level", "System", "version", "Code", "Display", "Abstract", "Inactive"); addHeaders(sheet, "Level", "System", "version", "Code", "Display", "Abstract", "Inactive");
genExpansionEntry(1, list, sheet); genExpansionEntry(1, list, sheet);
} }
@ -129,12 +129,12 @@ public class CodeSystemSpreadsheetGenerator extends CanonicalSpreadsheetGenerato
return value ? "" : "false"; return value ? "" : "false";
} }
private void genInclude(ValueSet vs, ConceptSetComponent inc, String mode) { // private void genInclude(ValueSet vs, ConceptSetComponent inc, String mode) {
if (inc.hasSystem()) { // if (inc.hasSystem()) {
genIncludeSystem(vs, inc, mode); // genIncludeSystem(vs, inc, mode);
} else { // } else {
genIncludeValueSets(vs, inc, mode); // genIncludeValueSets(vs, inc, mode);
} // }
// String subname = inc.hasSystem() ? : "ValueSets"; // String subname = inc.hasSystem() ? : "ValueSets";
// //
// //
@ -152,33 +152,33 @@ public class CodeSystemSpreadsheetGenerator extends CanonicalSpreadsheetGenerato
// processElement(sheet, sd, child); // processElement(sheet, sd, child);
// } // }
// configureSheet(sheet, sd); // configureSheet(sheet, sd);
} // }
private void genIncludeValueSets(ValueSet vs, ConceptSetComponent inc, String mode) { // private void genIncludeValueSets(ValueSet vs, ConceptSetComponent inc, String mode) {
Sheet sheet = wb.createSheet(mode+" ValueSets"); // Sheet sheet = makeSheet(mode+" ValueSets");
addValueSets(sheet, inc.getValueSet()); // addValueSets(sheet, inc.getValueSet());
configureSheet(sheet); // configureSheet(sheet);
} // }
//
private void genIncludeSystem(ValueSet vs, ConceptSetComponent inc, String mode) { // private void genIncludeSystem(ValueSet vs, ConceptSetComponent inc, String mode) {
Sheet sheet = wb.createSheet(mode+" from "+dr.displaySystem(inc.getSystem())); // Sheet sheet = makeSheet(mode+" from "+dr.displaySystem(inc.getSystem()));
if (inc.hasValueSet()) { // if (inc.hasValueSet()) {
addValueSets(sheet, inc.getValueSet()); // addValueSets(sheet, inc.getValueSet());
} // }
if (inc.hasFilter()) { // if (inc.hasFilter()) {
addFilters(sheet, inc.getFilter()); // addFilters(sheet, inc.getFilter());
} // }
if (inc.hasConcept()) { // if (inc.hasConcept()) {
addConcepts(sheet, inc.getConcept()); // addConcepts(sheet, inc.getConcept());
} // }
if (!inc.hasConcept() && !inc.hasFilter()) { // if (!inc.hasConcept() && !inc.hasFilter()) {
addAllCodes(sheet); // addAllCodes(sheet);
} // }
addRow(sheet, "", ""); // addRow(sheet, "", "");
addRow(sheet, "System URI", inc.getSystem()); // addRow(sheet, "System URI", inc.getSystem());
//
configureSheet(sheet); // configureSheet(sheet);
} // }
private void addAllCodes(Sheet sheet) { private void addAllCodes(Sheet sheet) {
addHeaders(sheet, "Codes"); addHeaders(sheet, "Codes");

View File

@ -38,7 +38,7 @@ public class ConceptMapSpreadsheetGenerator extends CanonicalSpreadsheetGenerato
} }
private void renderGroup(ConceptMapGroupComponent grp, int i) { private void renderGroup(ConceptMapGroupComponent grp, int i) {
Sheet sheet = wb.createSheet("Mapping Table "+Integer.toString(i)); Sheet sheet = makeSheet("Mapping Table "+Integer.toString(i));
addHeaders(sheet, "Source", "Display", "Relationship", "Target", "Display"); addHeaders(sheet, "Source", "Display", "Relationship", "Target", "Display");
addRow(sheet, grp.getSource(), "", "", grp.getTarget(), ""); addRow(sheet, grp.getSource(), "", "", grp.getTarget(), "");
for (SourceElementComponent s : grp.getElement()) { for (SourceElementComponent s : grp.getElement()) {

View File

@ -2,7 +2,9 @@ package org.hl7.fhir.r5.renderers.spreadsheets;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.BorderStyle;
@ -58,6 +60,7 @@ public class SpreadsheetGenerator {
protected Map<String, CellStyle> styles; protected Map<String, CellStyle> styles;
protected DataRenderer dr; protected DataRenderer dr;
private List<String> sheetNames = new ArrayList<>();
public SpreadsheetGenerator(IWorkerContext context) { public SpreadsheetGenerator(IWorkerContext context) {
super(); super();
@ -72,6 +75,19 @@ public class SpreadsheetGenerator {
outStream.close(); outStream.close();
} }
protected Sheet makeSheet(String name) {
String s = name;
if (sheetNames.contains(s)) {
int i = 1;
do {
i++;
s = name+" "+Integer.toString(i);
} while (sheetNames.contains(s));
}
sheetNames.add(s);
return wb.createSheet(s);
}
private static Map<String, CellStyle> createStyles(Workbook wb){ private static Map<String, CellStyle> createStyles(Workbook wb){
Map<String, CellStyle> styles = new HashMap<>(); Map<String, CellStyle> styles = new HashMap<>();

View File

@ -96,7 +96,7 @@ public class StructureDefinitionSpreadsheetGenerator extends CanonicalSpreadshee
throw new DefinitionException(context.formatMessage(I18nConstants.NEEDS_A_SNAPSHOT)); throw new DefinitionException(context.formatMessage(I18nConstants.NEEDS_A_SNAPSHOT));
} }
addStructureDefinitionMetadata(renderCanonicalResource(sd), sd); addStructureDefinitionMetadata(renderCanonicalResource(sd), sd);
Sheet sheet = wb.createSheet("Elements"); Sheet sheet = makeSheet("Elements");
Row headerRow = sheet.createRow(0); Row headerRow = sheet.createRow(0);
for (int i = 0; i < titles.length; i++) { for (int i = 0; i < titles.length; i++) {
@ -115,6 +115,7 @@ public class StructureDefinitionSpreadsheetGenerator extends CanonicalSpreadshee
return this; return this;
} }
private void addStructureDefinitionMetadata(Sheet sheet, StructureDefinition sd) { private void addStructureDefinitionMetadata(Sheet sheet, StructureDefinition sd) {
for (Coding k : sd.getKeyword()) { for (Coding k : sd.getKeyword()) {
addMetadataRow(sheet, "Keyword", dr.display(k)); addMetadataRow(sheet, "Keyword", dr.display(k));

View File

@ -56,7 +56,7 @@ public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator
} }
private void genExpansionParams(List<ValueSetExpansionParameterComponent> params) { private void genExpansionParams(List<ValueSetExpansionParameterComponent> params) {
Sheet sheet = wb.createSheet("Expansion Parameters"); Sheet sheet = makeSheet("Expansion Parameters");
addHeaders(sheet, "Parameter", "Value"); addHeaders(sheet, "Parameter", "Value");
for (ValueSetExpansionParameterComponent p : params) { for (ValueSetExpansionParameterComponent p : params) {
addRow(sheet, p.getName(), dr.display(p.getValue())); addRow(sheet, p.getName(), dr.display(p.getValue()));
@ -64,7 +64,7 @@ public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator
} }
private void genExpansion(List<ValueSetExpansionContainsComponent> list) { private void genExpansion(List<ValueSetExpansionContainsComponent> list) {
Sheet sheet = wb.createSheet("Expansion"); Sheet sheet = makeSheet("Expansion");
addHeaders(sheet, "Level", "System", "version", "Code", "Display", "Abstract", "Inactive"); addHeaders(sheet, "Level", "System", "version", "Code", "Display", "Abstract", "Inactive");
genExpansionEntry(1, list, sheet); genExpansionEntry(1, list, sheet);
} }
@ -108,13 +108,13 @@ public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator
} }
private void genIncludeValueSets(ValueSet vs, ConceptSetComponent inc, String mode) { private void genIncludeValueSets(ValueSet vs, ConceptSetComponent inc, String mode) {
Sheet sheet = wb.createSheet(mode+" ValueSets"); Sheet sheet = makeSheet(mode+" ValueSets");
addValueSets(sheet, inc.getValueSet()); addValueSets(sheet, inc.getValueSet());
configureSheet(sheet); configureSheet(sheet);
} }
private void genIncludeSystem(ValueSet vs, ConceptSetComponent inc, String mode) { private void genIncludeSystem(ValueSet vs, ConceptSetComponent inc, String mode) {
Sheet sheet = wb.createSheet(mode+" from "+dr.displaySystem(inc.getSystem())); Sheet sheet = makeSheet(mode+" from "+dr.displaySystem(inc.getSystem()));
if (inc.hasValueSet()) { if (inc.hasValueSet()) {
addValueSets(sheet, inc.getValueSet()); addValueSets(sheet, inc.getValueSet());
} }

View File

@ -1,5 +1,7 @@
package org.hl7.fhir.r5.terminologies; package org.hl7.fhir.r5.terminologies;
import java.util.List;
/* /*
Copyright (c) 2011+, HL7, Inc. Copyright (c) 2011+, HL7, Inc.
All rights reserved. All rights reserved.
@ -36,6 +38,6 @@ import org.hl7.fhir.r5.utils.EOperationOutcome;
public interface ValueSetChecker { public interface ValueSetChecker {
Boolean codeInValueSet(String system, String code) throws ETooCostly, EOperationOutcome, Exception; Boolean codeInValueSet(String system, String code, List<String> warnings) throws ETooCostly, EOperationOutcome, Exception;
} }

View File

@ -102,7 +102,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
if (valueset != null && options.getValueSetMode() != ValueSetMode.NO_MEMBERSHIP_CHECK) { if (valueset != null && options.getValueSetMode() != ValueSetMode.NO_MEMBERSHIP_CHECK) {
Boolean result = false; Boolean result = false;
for (Coding c : code.getCoding()) { for (Coding c : code.getCoding()) {
Boolean ok = codeInValueSet(c.getSystem(), c.getCode()); Boolean ok = codeInValueSet(c.getSystem(), c.getCode(), warnings);
if (ok == null && result == false) { if (ok == null && result == false) {
result = null; result = null;
} else if (ok) { } else if (ok) {
@ -151,7 +151,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
if (cs == null) { if (cs == null) {
warningMessage = "Unable to resolve system "+system; warningMessage = "Unable to resolve system "+system;
if (!inExpansion) { if (!inExpansion) {
if (valueset.hasExpansion()) { if (valueset != null && valueset.hasExpansion()) {
return new ValidationResult(IssueSeverity.ERROR, context.formatMessage(I18nConstants.CODESYSTEM_CS_UNK_EXPANSION, valueset.getUrl(), code.getCode().toString(), code.getSystem())); return new ValidationResult(IssueSeverity.ERROR, context.formatMessage(I18nConstants.CODESYSTEM_CS_UNK_EXPANSION, valueset.getUrl(), code.getCode().toString(), code.getSystem()));
} else { } else {
throw new FHIRException(warningMessage); throw new FHIRException(warningMessage);
@ -187,10 +187,12 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
inInclude = checkInclude(code); inInclude = checkInclude(code);
} }
List<String> warnings = new ArrayList<>();
// then, if we have a value set, we check it's in the value set // then, if we have a value set, we check it's in the value set
if (valueset != null && options.getValueSetMode() != ValueSetMode.NO_MEMBERSHIP_CHECK) { if (valueset != null && options.getValueSetMode() != ValueSetMode.NO_MEMBERSHIP_CHECK) {
if ((res==null || res.isOk())) { if ((res==null || res.isOk())) {
Boolean ok = codeInValueSet(system, code.getCode()); Boolean ok = codeInValueSet(system, code.getCode(), warnings);
if (ok == null || !ok) { if (ok == null || !ok) {
if (res == null) { if (res == null) {
res = new ValidationResult((IssueSeverity) null, null); res = new ValidationResult((IssueSeverity) null, null);
@ -549,13 +551,17 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
} }
@Override @Override
public Boolean codeInValueSet(String system, String code) throws FHIRException { public Boolean codeInValueSet(String system, String code, List<String> warnings) throws FHIRException {
if (valueset == null) {
return false;
}
Boolean result = false; Boolean result = false;
if (valueset.hasExpansion()) { if (valueset.hasExpansion()) {
return checkExpansion(new Coding(system, code, null)); return checkExpansion(new Coding(system, code, null));
} else if (valueset.hasCompose()) { } else if (valueset.hasCompose()) {
for (ConceptSetComponent vsi : valueset.getCompose().getInclude()) { for (ConceptSetComponent vsi : valueset.getCompose().getInclude()) {
Boolean ok = inComponent(vsi, system, code, valueset.getCompose().getInclude().size() == 1); Boolean ok = inComponent(vsi, system, code, valueset.getCompose().getInclude().size() == 1, warnings);
if (ok == null && result == false) { if (ok == null && result == false) {
result = null; result = null;
} else if (ok) { } else if (ok) {
@ -564,10 +570,10 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
} }
} }
for (ConceptSetComponent vsi : valueset.getCompose().getExclude()) { for (ConceptSetComponent vsi : valueset.getCompose().getExclude()) {
Boolean nok = inComponent(vsi, system, code, valueset.getCompose().getInclude().size() == 1); Boolean nok = inComponent(vsi, system, code, valueset.getCompose().getInclude().size() == 1, warnings);
if (nok == null && result == false) { if (nok == null && result == false) {
result = null; result = null;
} else if (nok) { } else if (nok != null && nok) {
result = false; result = false;
} }
} }
@ -576,7 +582,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
return result; return result;
} }
private Boolean inComponent(ConceptSetComponent vsi, String system, String code, boolean only) throws FHIRException { private Boolean inComponent(ConceptSetComponent vsi, String system, String code, boolean only, List<String> warnings) throws FHIRException {
for (UriType uri : vsi.getValueSet()) { for (UriType uri : vsi.getValueSet()) {
if (inImport(uri.getValue(), system, code)) { if (inImport(uri.getValue(), system, code)) {
return true; return true;
@ -607,6 +613,9 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
vs.getCompose().addInclude(vsi); vs.getCompose().addInclude(vsi);
ValidationResult res = context.validateCode(options.noClient(), new Coding(system, code, null), vs); ValidationResult res = context.validateCode(options.noClient(), new Coding(system, code, null), vs);
if (res.getErrorClass() == TerminologyServiceErrorClass.UNKNOWN || res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED || res.getErrorClass() == TerminologyServiceErrorClass.VALUESET_UNSUPPORTED) { if (res.getErrorClass() == TerminologyServiceErrorClass.UNKNOWN || res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED || res.getErrorClass() == TerminologyServiceErrorClass.VALUESET_UNSUPPORTED) {
if (warnings != null && res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED) {
warnings.add(context.formatMessage(I18nConstants.TERMINOLOGY_TX_SYSTEM_NOTKNOWN, system));
}
return null; return null;
} }
if (res.getErrorClass() == TerminologyServiceErrorClass.NOSERVICE) { if (res.getErrorClass() == TerminologyServiceErrorClass.NOSERVICE) {
@ -705,7 +714,13 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
} }
private boolean inImport(String uri, String system, String code) throws FHIRException { private boolean inImport(String uri, String system, String code) throws FHIRException {
return getVs(uri).codeInValueSet(system, code); ValueSetCheckerSimple vs = getVs(uri);
if (vs == null) {
return false;
} else {
Boolean ok = vs.codeInValueSet(system, code, null);
return ok != null && ok;
}
} }
} }

View File

@ -228,6 +228,8 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
public String getLatestVersion(String id) throws IOException { public String getLatestVersion(String id) throws IOException {
for (String nextPackageServer : getPackageServers()) { for (String nextPackageServer : getPackageServers()) {
// special case:
if (!("hl7.fhir.pubpack".equals(id) && PRIMARY_SERVER.equals(nextPackageServer))) {
CachingPackageClient pc = new CachingPackageClient(nextPackageServer); CachingPackageClient pc = new CachingPackageClient(nextPackageServer);
try { try {
return pc.getLatestVersion(id); return pc.getLatestVersion(id);
@ -235,6 +237,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
ourLog.info("Failed to determine latest version of package {} from server: {}", id, nextPackageServer); ourLog.info("Failed to determine latest version of package {} from server: {}", id, nextPackageServer);
} }
} }
}
return fetchVersionTheOldWay(id); return fetchVersionTheOldWay(id);
} }
@ -474,6 +477,13 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
id = id.substring(0, id.indexOf("#")); id = id.substring(0, id.indexOf("#"));
} }
if (version == null) {
try {
version = getLatestVersion(id);
} catch (Exception e) {
version = null;
}
}
NpmPackage p = loadPackageFromCacheOnly(id, version); NpmPackage p = loadPackageFromCacheOnly(id, version);
if (p != null) { if (p != null) {
if ("current".equals(version)) { if ("current".equals(version)) {
@ -704,7 +714,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
String pv = Utilities.pathURL(url, v, "package.tgz"); String pv = Utilities.pathURL(url, v, "package.tgz");
try { try {
aurl = pv; aurl = pv;
InputStreamWithSrc src = new InputStreamWithSrc(fetchFromUrlSpecific(pv, true), pv, v); InputStreamWithSrc src = new InputStreamWithSrc(fetchFromUrlSpecific(pv, false), pv, v);
return src; return src;
} catch (Exception e1) { } catch (Exception e1) {
throw new FHIRException("Error fetching package directly (" + pv + "), or fetching package list for " + id + " from " + pu + ": " + e1.getMessage(), e1); throw new FHIRException("Error fetching package directly (" + pv + "), or fetching package list for " + id + " from " + pu + ": " + e1.getMessage(), e1);

View File

@ -603,7 +603,7 @@ BUNDLE_RULE_NONE = No Rule
BUNDLE_RULE_UNKNOWN = Bundle Rule refers to invalid resource {0} BUNDLE_RULE_UNKNOWN = Bundle Rule refers to invalid resource {0}
BUNDLE_RULE_INVALID_INDEX = Bundle Rules index is invalid ({0}) BUNDLE_RULE_INVALID_INDEX = Bundle Rules index is invalid ({0})
BUNDLE_RULE_PROFILE_UNKNOWN = Bundle Rules profile {1} is unknown for {0} BUNDLE_RULE_PROFILE_UNKNOWN = Bundle Rules profile {1} is unknown for {0}
UNABLE_TO_CHECK_IF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_ = Unable to determine whether the provided codes are in the value set {0} because the value set or code system is not known to the validator UNABLE_TO_CHECK_IF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_ = Unable to determine whether the provided codes are in the value set {0} because the value set or a code system it depends on is not known to the validator
TERMINOLOGY_TX_SYSTEM_WRONG_HTML = The code system reference {0} is wrong - the code system reference cannot be to an HTML page. This may be the correct reference: {1} TERMINOLOGY_TX_SYSTEM_WRONG_HTML = The code system reference {0} is wrong - the code system reference cannot be to an HTML page. This may be the correct reference: {1}
TERMINOLOGY_TX_SYSTEM_WRONG_BUILD = The code system reference {0} is wrong - the code system reference cannot be a reference to build.fhir.org. This may be the correct reference: {1} TERMINOLOGY_TX_SYSTEM_WRONG_BUILD = The code system reference {0} is wrong - the code system reference cannot be a reference to build.fhir.org. This may be the correct reference: {1}
FHIRPATH_BAD_DATE = Unable to parse Date {0} FHIRPATH_BAD_DATE = Unable to parse Date {0}

View File

@ -54,6 +54,13 @@ public class PackageCacheTests {
cache.clear(); cache.clear();
Assertions.assertEquals(cache.loadPackage("KBV.Basis", "1.1.3").version(), "1.1.3"); Assertions.assertEquals(cache.loadPackage("KBV.Basis", "1.1.3").version(), "1.1.3");
Assertions.assertEquals(cache.loadPackage("kbv.basis", "1.1.3").version(), "1.1.3"); Assertions.assertEquals(cache.loadPackage("kbv.basis", "1.1.3").version(), "1.1.3");
}
@Test
public void testLastReleasedVersion() throws IOException {
FilesystemPackageCacheManager cache = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
cache.clear();
Assertions.assertEquals("0.0.8", cache.loadPackage("hl7.fhir.pubpack", "0.0.8").version());
Assertions.assertEquals("0.0.9", cache.loadPackage("hl7.fhir.pubpack").version());
} }
} }

View File

@ -91,6 +91,8 @@ public class ValueSetValidator extends BaseValidator {
if (rs != null) { if (rs != null) {
warning(errors, IssueType.BUSINESSRULE, ns.getLiteralPath(), false, I18nConstants.VALUESET_REFERENCE_INVALID_TYPE, v, rs.fhirType()); warning(errors, IssueType.BUSINESSRULE, ns.getLiteralPath(), false, I18nConstants.VALUESET_REFERENCE_INVALID_TYPE, v, rs.fhirType());
} else { } else {
// todo: it's possible, at this point, that the txx server knows the value set, but it's not in scope
// should we handle this case?
warning(errors, IssueType.BUSINESSRULE, ns.getLiteralPath(), false, I18nConstants.VALUESET_REFERENCE_UNKNOWN, v); warning(errors, IssueType.BUSINESSRULE, ns.getLiteralPath(), false, I18nConstants.VALUESET_REFERENCE_UNKNOWN, v);
} }
} }

View File

@ -249,6 +249,11 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
if (content.has("profile")) { if (content.has("profile")) {
System.out.print("** Profile: "); System.out.print("** Profile: ");
JsonObject profile = content.getAsJsonObject("profile"); JsonObject profile = content.getAsJsonObject("profile");
if (profile.has("packages")) {
for (JsonElement e : profile.getAsJsonArray("packages")) {
igLoader.loadIg(vCurr.getIgs(), vCurr.getBinaries(), e.getAsString(), true);
}
}
if (profile.getAsJsonObject("java").has("debug")) { if (profile.getAsJsonObject("java").has("debug")) {
val.setDebug(profile.getAsJsonObject("java").get("debug").getAsBoolean()); val.setDebug(profile.getAsJsonObject("java").get("debug").getAsBoolean());
} }
@ -263,12 +268,17 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
} }
} }
} }
StructureDefinition sd = null;
String filename = profile.get("source").getAsString(); String filename = profile.get("source").getAsString();
if (Utilities.isAbsoluteUrl(filename)) {
sd = val.getContext().fetchResource(StructureDefinition.class, filename);
} else {
String contents = TestingUtilities.loadTestResource("validator", filename); String contents = TestingUtilities.loadTestResource("validator", filename);
System.out.println("Name: " + name + " - profile : " + profile.get("source").getAsString()); System.out.println("Name: " + name + " - profile : " + profile.get("source").getAsString());
version = content.has("version") ? content.get("version").getAsString() : Constants.VERSION; version = content.has("version") ? content.get("version").getAsString() : Constants.VERSION;
StructureDefinition sd = loadProfile(filename, contents, messages); sd = loadProfile(filename, contents, messages);
val.getContext().cacheResource(sd); val.getContext().cacheResource(sd);
}
val.setAssumeValidRestReferences(profile.has("assumeValidRestReferences") ? profile.get("assumeValidRestReferences").getAsBoolean() : false); val.setAssumeValidRestReferences(profile.has("assumeValidRestReferences") ? profile.get("assumeValidRestReferences").getAsBoolean() : false);
List<ValidationMessage> errorsProfile = new ArrayList<ValidationMessage>(); List<ValidationMessage> errorsProfile = new ArrayList<ValidationMessage>();
if (JSONUtil.str(content, "file").endsWith(".json")) if (JSONUtil.str(content, "file").endsWith(".json"))

View File

@ -19,7 +19,7 @@
<properties> <properties>
<hapi_fhir_version>5.1.0</hapi_fhir_version> <hapi_fhir_version>5.1.0</hapi_fhir_version>
<validator_test_case_version>1.1.67</validator_test_case_version> <validator_test_case_version>1.1.68-SNAPSHOT</validator_test_case_version>
<junit_jupiter_version>5.7.1</junit_jupiter_version> <junit_jupiter_version>5.7.1</junit_jupiter_version>
<junit_platform_launcher_version>1.7.1</junit_platform_launcher_version> <junit_platform_launcher_version>1.7.1</junit_platform_launcher_version>
<maven_surefire_version>3.0.0-M4</maven_surefire_version> <maven_surefire_version>3.0.0-M4</maven_surefire_version>