finished i18N processing
This commit is contained in:
parent
7ada30807d
commit
108efaaf92
|
@ -82,6 +82,7 @@ import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
|||
import org.hl7.fhir.r5.terminologies.ValueSetExpanderSimple;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.r5.utils.client.ToolingClientLogger;
|
||||
import org.hl7.fhir.utilities.I18nConstants;
|
||||
import org.hl7.fhir.utilities.OIDUtils;
|
||||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
@ -237,7 +238,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
if (Utilities.existsInList(url, "http://hl7.org/fhir/SearchParameter/example")) {
|
||||
return;
|
||||
}
|
||||
throw new DefinitionException("Duplicate Resource " + url);
|
||||
throw new DefinitionException(formatMessage(I18nConstants.DUPLICATE_RESOURCE_, url));
|
||||
}
|
||||
if (r instanceof StructureDefinition)
|
||||
structures.see((StructureDefinition) m);
|
||||
|
@ -311,7 +312,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
return laterVersion(newParts[i], oldParts[i]);
|
||||
}
|
||||
// This should never happen
|
||||
throw new Error("Delimited versions have exact match for delimiter '"+delimiter+"' : "+newParts+" vs "+oldParts);
|
||||
throw new Error(formatMessage(I18nConstants.DELIMITED_VERSIONS_HAVE_EXACT_MATCH_FOR_DELIMITER____VS_, delimiter, newParts, oldParts));
|
||||
}
|
||||
|
||||
protected <T extends CanonicalResource> void seeMetadataResource(T r, Map<String, T> map, List<T> list, boolean addId) throws FHIRException {
|
||||
|
@ -430,7 +431,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
ValueSet vs = null;
|
||||
vs = fetchResource(ValueSet.class, binding.getValueSet());
|
||||
if (vs == null)
|
||||
throw new FHIRException("Unable to resolve value Set "+binding.getValueSet());
|
||||
throw new FHIRException(formatMessage(I18nConstants.UNABLE_TO_RESOLVE_VALUE_SET_, binding.getValueSet()));
|
||||
return expandVS(vs, cacheOk, heirarchical);
|
||||
}
|
||||
|
||||
|
@ -449,7 +450,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
p.setParameter("excludeNested", !hierarchical);
|
||||
|
||||
if (noTerminologyServer)
|
||||
return new ValueSetExpansionOutcome("Error expanding ValueSet: running without terminology services", TerminologyServiceErrorClass.NOSERVICE);
|
||||
return new ValueSetExpansionOutcome(formatMessage(I18nConstants.ERROR_EXPANDING_VALUESET_RUNNING_WITHOUT_TERMINOLOGY_SERVICES), TerminologyServiceErrorClass.NOSERVICE);
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("_limit", Integer.toString(expandCodesLimit ));
|
||||
params.put("_incomplete", "true");
|
||||
|
@ -469,19 +470,19 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
@Override
|
||||
public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk, boolean heirarchical) {
|
||||
if (expParameters == null)
|
||||
throw new Error("No Expansion Parameters provided");
|
||||
throw new Error(formatMessage(I18nConstants.NO_EXPANSION_PARAMETERS_PROVIDED));
|
||||
Parameters p = expParameters.copy();
|
||||
return expandVS(vs, cacheOk, heirarchical, p);
|
||||
}
|
||||
|
||||
public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk, boolean heirarchical, Parameters p) {
|
||||
if (p == null)
|
||||
throw new Error("No Parameters provided to expandVS");
|
||||
throw new Error(formatMessage(I18nConstants.NO_PARAMETERS_PROVIDED_TO_EXPANDVS));
|
||||
if (vs.hasExpansion()) {
|
||||
return new ValueSetExpansionOutcome(vs.copy());
|
||||
}
|
||||
if (!vs.hasUrl())
|
||||
throw new Error("no value set");
|
||||
throw new Error(formatMessage(I18nConstants.NO_VALUE_SET));
|
||||
|
||||
CacheToken cacheToken = txCache.generateExpandToken(vs, heirarchical);
|
||||
ValueSetExpansionOutcome res;
|
||||
|
@ -498,7 +499,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
ValueSetExpanderSimple vse = new ValueSetExpanderSimple(this);
|
||||
res = vse.doExpand(vs, p);
|
||||
if (!res.getValueset().hasUrl())
|
||||
throw new Error("no url in expand value set");
|
||||
throw new Error(formatMessage(I18nConstants.NO_URL_IN_EXPAND_VALUE_SET));
|
||||
txCache.cacheExpansion(cacheToken, res, TerminologyCache.TRANSIENT);
|
||||
return res;
|
||||
} catch (Exception e) {
|
||||
|
@ -506,7 +507,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
|
||||
// if that failed, we try to expand on the server
|
||||
if (noTerminologyServer)
|
||||
return new ValueSetExpansionOutcome("Error expanding ValueSet: running without terminology services", TerminologyServiceErrorClass.NOSERVICE);
|
||||
return new ValueSetExpansionOutcome(formatMessage(I18nConstants.ERROR_EXPANDING_VALUESET_RUNNING_WITHOUT_TERMINOLOGY_SERVICES), TerminologyServiceErrorClass.NOSERVICE);
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("_limit", Integer.toString(expandCodesLimit ));
|
||||
params.put("_incomplete", "true");
|
||||
|
@ -516,7 +517,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
if (!result.hasUrl())
|
||||
result.setUrl(vs.getUrl());
|
||||
if (!result.hasUrl())
|
||||
throw new Error("no url in expand value set 2");
|
||||
throw new Error(formatMessage(I18nConstants.NO_URL_IN_EXPAND_VALUE_SET_2));
|
||||
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
|
||||
} catch (Exception e) {
|
||||
res = new ValueSetExpansionOutcome(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), TerminologyServiceErrorClass.UNKNOWN).setTxLink(txLog == null ? null : txLog.getLastId());
|
||||
|
@ -576,12 +577,12 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
}
|
||||
|
||||
if (!options.isUseServer()) {
|
||||
return new ValidationResult(IssueSeverity.WARNING, "Unable to validate code without using server", TerminologyServiceErrorClass.BLOCKED_BY_OPTIONS);
|
||||
return new ValidationResult(IssueSeverity.WARNING,formatMessage(I18nConstants.UNABLE_TO_VALIDATE_CODE_WITHOUT_USING_SERVER), TerminologyServiceErrorClass.BLOCKED_BY_OPTIONS);
|
||||
}
|
||||
|
||||
// if that failed, we try to validate on the server
|
||||
if (noTerminologyServer) {
|
||||
return new ValidationResult(IssueSeverity.ERROR, "Error validating code: running without terminology services", TerminologyServiceErrorClass.NOSERVICE);
|
||||
return new ValidationResult(IssueSeverity.ERROR,formatMessage(I18nConstants.ERROR_VALIDATING_CODE_RUNNING_WITHOUT_TERMINOLOGY_SERVICES), TerminologyServiceErrorClass.NOSERVICE);
|
||||
}
|
||||
String csumm = txCache != null ? txCache.summary(code) : null;
|
||||
if (txCache != null) {
|
||||
|
@ -656,15 +657,15 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
pin.addParameter().setName("valueSet").setResource(vs);
|
||||
for (ParametersParameterComponent pp : pin.getParameter())
|
||||
if (pp.getName().equals("profile"))
|
||||
throw new Error("Can only specify profile in the context");
|
||||
throw new Error(formatMessage(I18nConstants.CAN_ONLY_SPECIFY_PROFILE_IN_THE_CONTEXT));
|
||||
if (expParameters == null)
|
||||
throw new Error("No ExpansionProfile provided");
|
||||
throw new Error(formatMessage(I18nConstants.NO_EXPANSIONPROFILE_PROVIDED));
|
||||
pin.addParameter().setName("profile").setResource(expParameters);
|
||||
if (txLog != null) {
|
||||
txLog.clearLastId();
|
||||
}
|
||||
if (txClient == null) {
|
||||
throw new FHIRException("Attempt to use Terminology server when no Terminology server is available");
|
||||
throw new FHIRException(formatMessage(I18nConstants.ATTEMPT_TO_USE_TERMINOLOGY_SERVER_WHEN_NO_TERMINOLOGY_SERVER_IS_AVAILABLE));
|
||||
}
|
||||
Parameters pOut;
|
||||
if (vs == null)
|
||||
|
@ -871,7 +872,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
}
|
||||
if (supportedCodeSystems.contains(uri))
|
||||
return null;
|
||||
throw new FHIRException("not done yet: can't fetch "+uri);
|
||||
throw new FHIRException(formatMessage(I18nConstants.NOT_DONE_YET_CANT_FETCH_, uri));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -917,10 +918,10 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
if (parts.length >= 2) {
|
||||
if (!Utilities.noString(type))
|
||||
if (!type.equals(parts[parts.length-2]))
|
||||
throw new Error("Resource type mismatch for "+type+" / "+uri);
|
||||
throw new Error(formatMessage(I18nConstants.RESOURCE_TYPE_MISMATCH_FOR___, type, uri));
|
||||
return allResourcesById.get(parts[parts.length-2]).get(parts[parts.length-1]);
|
||||
} else
|
||||
throw new Error("Unable to process request for resource for "+type+" / "+uri);
|
||||
throw new Error(formatMessage(I18nConstants.UNABLE_TO_PROCESS_REQUEST_FOR_RESOURCE_FOR___, type, uri));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
@ -72,6 +73,7 @@ import org.hl7.fhir.r5.utils.INarrativeGenerator;
|
|||
import org.hl7.fhir.r5.utils.IResourceValidator;
|
||||
import org.hl7.fhir.r5.utils.NarrativeGenerator;
|
||||
import org.hl7.fhir.utilities.CSFileInputStream;
|
||||
import org.hl7.fhir.utilities.I18nConstants;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.cache.NpmPackage;
|
||||
|
@ -117,11 +119,20 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
public SimpleWorkerContext() throws FileNotFoundException, IOException, FHIRException {
|
||||
super();
|
||||
}
|
||||
|
||||
public SimpleWorkerContext(Locale locale) throws FileNotFoundException, IOException, FHIRException {
|
||||
super(locale);
|
||||
}
|
||||
|
||||
public SimpleWorkerContext(SimpleWorkerContext other) throws FileNotFoundException, IOException, FHIRException {
|
||||
super();
|
||||
copy(other);
|
||||
}
|
||||
|
||||
public SimpleWorkerContext(SimpleWorkerContext other, Locale locale) throws FileNotFoundException, IOException, FHIRException {
|
||||
super(locale);
|
||||
copy(other);
|
||||
}
|
||||
|
||||
protected void copy(SimpleWorkerContext other) {
|
||||
super.copy(other);
|
||||
|
@ -249,7 +260,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
txClient.setLogger(txLog);
|
||||
return txClient.getCapabilitiesStatementQuick().getSoftware().getVersion();
|
||||
} catch (Exception e) {
|
||||
throw new FHIRException("Unable to connect to terminology server. Use parameter '-tx n/a' tun run without using terminology services to validate LOINC, SNOMED, ICD-X etc. Error = "+e.getMessage(), e);
|
||||
throw new FHIRException(formatMessage(I18nConstants.UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__, e.getMessage()), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,9 +278,9 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
f = xml.parse(stream);
|
||||
}
|
||||
} catch (DataFormatException e1) {
|
||||
throw new org.hl7.fhir.exceptions.FHIRFormatError("Error parsing "+name+":" +e1.getMessage(), e1);
|
||||
throw new org.hl7.fhir.exceptions.FHIRFormatError(formatMessage(I18nConstants.ERROR_PARSING_, name, e1.getMessage()), e1);
|
||||
} catch (Exception e1) {
|
||||
throw new org.hl7.fhir.exceptions.FHIRFormatError("Error parsing "+name+":" +e1.getMessage(), e1);
|
||||
throw new org.hl7.fhir.exceptions.FHIRFormatError(formatMessage(I18nConstants.ERROR_PARSING_, name, e1.getMessage()), e1);
|
||||
}
|
||||
if (f instanceof Bundle) {
|
||||
Bundle bnd = (Bundle) f;
|
||||
|
@ -325,7 +336,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
try {
|
||||
loadDefinitionItem(s, pi.load("package", s), loader, filter);
|
||||
} catch (FHIRException | IOException e) {
|
||||
throw new FHIRException("Error reading "+s+" from package "+pi.name()+"#"+pi.version()+": "+e.getMessage(), e);
|
||||
throw new FHIRException(formatMessage(I18nConstants.ERROR_READING__FROM_PACKAGE__, s, pi.name(), pi.version(), e.getMessage()), e);
|
||||
}
|
||||
}
|
||||
for (String s : pi.list("other")) {
|
||||
|
@ -377,7 +388,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
if (version == null)
|
||||
version = s.substring(8);
|
||||
else if (!version.equals(s.substring(8)))
|
||||
throw new DefinitionException("Version mismatch. The context has version "+version+" loaded, and the new content being loaded is version "+s.substring(8));
|
||||
throw new DefinitionException(formatMessage(I18nConstants.VERSION_MISMATCH_THE_CONTEXT_HAS_VERSION__LOADED_AND_THE_NEW_CONTENT_BEING_LOADED_IS_VERSION_, version, s.substring(8)));
|
||||
}
|
||||
if (s.startsWith("revision="))
|
||||
revision = s.substring(9);
|
||||
|
@ -397,7 +408,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
case JSON: return newJsonParser();
|
||||
case XML: return newXmlParser();
|
||||
default:
|
||||
throw new Error("Parser Type "+type.toString()+" not supported");
|
||||
throw new Error(formatMessage(I18nConstants.PARSER_TYPE__NOT_SUPPORTED, type.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,7 +418,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
return new JsonParser();
|
||||
if (type.equalsIgnoreCase("XML"))
|
||||
return new XmlParser();
|
||||
throw new Error("Parser Type "+type.toString()+" not supported");
|
||||
throw new Error(formatMessage(I18nConstants.PARSER_TYPE__NOT_SUPPORTED, type.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -427,7 +438,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
@Override
|
||||
public IResourceValidator newValidator() throws FHIRException {
|
||||
if (validatorFactory == null)
|
||||
throw new Error("No validator configured");
|
||||
throw new Error(formatMessage(I18nConstants.NO_VALIDATOR_CONFIGURED));
|
||||
return validatorFactory.makeValidator(this);
|
||||
}
|
||||
|
||||
|
@ -655,13 +666,13 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
public void generateSnapshot(StructureDefinition p, boolean logical) throws DefinitionException, FHIRException {
|
||||
if (!p.hasSnapshot() && (logical || p.getKind() != StructureDefinitionKind.LOGICAL)) {
|
||||
if (!p.hasBaseDefinition())
|
||||
throw new DefinitionException("Profile "+p.getName()+" ("+p.getUrl()+") has no base and no snapshot");
|
||||
throw new DefinitionException(formatMessage(I18nConstants.PROFILE___HAS_NO_BASE_AND_NO_SNAPSHOT, p.getName(), p.getUrl()));
|
||||
StructureDefinition sd = fetchResource(StructureDefinition.class, p.getBaseDefinition());
|
||||
if (sd == null && "http://hl7.org/fhir/StructureDefinition/Base".equals(p.getBaseDefinition())) {
|
||||
sd = ProfileUtilities.makeBaseDefinition(p.getFhirVersion());
|
||||
}
|
||||
if (sd == null) {
|
||||
throw new DefinitionException("Profile "+p.getName()+" ("+p.getUrl()+") base "+p.getBaseDefinition()+" could not be resolved");
|
||||
throw new DefinitionException(formatMessage(I18nConstants.PROFILE___BASE__COULD_NOT_BE_RESOLVED, p.getName(), p.getUrl(), p.getBaseDefinition()));
|
||||
}
|
||||
List<ValidationMessage> msgs = new ArrayList<ValidationMessage>();
|
||||
List<String> errors = new ArrayList<String>();
|
||||
|
@ -677,10 +688,10 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
pu.generateSnapshot(sd, p, p.getUrl(), Utilities.extractBaseUrl(sd.getUserString("path")), p.getName());
|
||||
for (ValidationMessage msg : msgs) {
|
||||
if ((!ignoreProfileErrors && msg.getLevel() == ValidationMessage.IssueSeverity.ERROR) || msg.getLevel() == ValidationMessage.IssueSeverity.FATAL)
|
||||
throw new DefinitionException("Profile "+p.getName()+" ("+p.getUrl()+"), element "+msg.getLocation()+". Error generating snapshot: "+msg.getMessage());
|
||||
throw new DefinitionException(formatMessage(I18nConstants.PROFILE___ELEMENT__ERROR_GENERATING_SNAPSHOT_, p.getName(), p.getUrl(), msg.getLocation(), msg.getMessage()));
|
||||
}
|
||||
if (!p.hasSnapshot())
|
||||
throw new FHIRException("Profile "+p.getName()+" ("+p.getUrl()+"). Error generating snapshot");
|
||||
throw new FHIRException(formatMessage(I18nConstants.PROFILE___ERROR_GENERATING_SNAPSHOT, p.getName(), p.getUrl()));
|
||||
pu = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ package org.hl7.fhir.r5.terminologies;
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -45,6 +45,7 @@ import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
|||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.I18nConstants;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions.ValueSetMode;
|
||||
|
@ -70,7 +71,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||
if (options.getValueSetMode() != ValueSetMode.CHECK_MEMERSHIP_ONLY) {
|
||||
for (Coding c : code.getCoding()) {
|
||||
if (!c.hasSystem())
|
||||
warnings.add("Coding has no system - cannot validate");
|
||||
warnings.add(context.formatMessage(I18nConstants.CODING_HAS_NO_SYSTEM__CANNOT_VALIDATE));
|
||||
CodeSystem cs = context.fetchCodeSystem(c.getSystem());
|
||||
ValidationResult res = null;
|
||||
if (cs == null || cs.getContent() != CodeSystemContentMode.COMPLETE) {
|
||||
|
@ -90,7 +91,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||
ok = ok || codeInValueSet(c.getSystem(), c.getCode());
|
||||
}
|
||||
if (!ok)
|
||||
errors.add(0, "None of the provided codes are in the value set "+valueset.getUrl());
|
||||
errors.add(0, context.formatMessage(I18nConstants.NONE_OF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_, valueset.getUrl()));
|
||||
}
|
||||
if (errors.size() > 0)
|
||||
return new ValidationResult(IssueSeverity.ERROR, errors.toString());
|
||||
|
@ -138,7 +139,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||
if (!inExpansion)
|
||||
res.setMessage("Not in value set "+valueset.getUrl()).setSeverity(IssueSeverity.ERROR);
|
||||
else if (warningMessage!=null)
|
||||
res = new ValidationResult(IssueSeverity.WARNING, "Code found in expansion, however: " + warningMessage);
|
||||
res = new ValidationResult(IssueSeverity.WARNING, context.formatMessage(I18nConstants.CODE_FOUND_IN_EXPANSION_HOWEVER_, warningMessage));
|
||||
else
|
||||
res.setMessage("Code found in expansion, however: " + res.getMessage());
|
||||
}
|
||||
|
@ -165,7 +166,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||
private ValidationResult validateCode(Coding code, CodeSystem cs) {
|
||||
ConceptDefinitionComponent cc = findCodeInConcept(cs.getConcept(), code.getCode());
|
||||
if (cc == null)
|
||||
return new ValidationResult(IssueSeverity.ERROR, "Unknown Code "+gen(code)+" in "+cs.getUrl());
|
||||
return new ValidationResult(IssueSeverity.ERROR, context.formatMessage(I18nConstants.UNKNOWN_CODE__IN_, gen(code), cs.getUrl()));
|
||||
if (code.getDisplay() == null)
|
||||
return new ValidationResult(cc);
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
|
@ -193,7 +194,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||
return new ValidationResult(cc);
|
||||
}
|
||||
}
|
||||
return new ValidationResult(IssueSeverity.WARNING, "Display Name for "+code.getSystem()+"#"+code.getCode()+" should be one of '"+b.toString()+"' instead of '"+code.getDisplay()+"'", cc);
|
||||
return new ValidationResult(IssueSeverity.WARNING, context.formatMessage(I18nConstants.DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF_, code.getSystem(), code.getCode(), b.toString(), code.getDisplay()), cc);
|
||||
}
|
||||
|
||||
private ConceptReferenceComponent findValueSetRef(String system, String code) {
|
||||
|
@ -233,25 +234,25 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||
|
||||
private String getValueSetSystem() throws FHIRException {
|
||||
if (valueset == null)
|
||||
throw new FHIRException("Unable to resolve system - no value set");
|
||||
throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__NO_VALUE_SET));
|
||||
if (valueset.getCompose().hasExclude())
|
||||
throw new FHIRException("Unable to resolve system - value set has excludes");
|
||||
throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_EXCLUDES));
|
||||
if (valueset.getCompose().getInclude().size() == 0) {
|
||||
if (!valueset.hasExpansion() || valueset.getExpansion().getContains().size() == 0)
|
||||
throw new FHIRException("Unable to resolve system - value set has no includes or expansion");
|
||||
throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_NO_INCLUDES_OR_EXPANSION));
|
||||
else {
|
||||
String cs = valueset.getExpansion().getContains().get(0).getSystem();
|
||||
if (cs != null && checkSystem(valueset.getExpansion().getContains(), cs))
|
||||
return cs;
|
||||
else
|
||||
throw new FHIRException("Unable to resolve system - value set expansion has multiple systems");
|
||||
throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_EXPANSION_HAS_MULTIPLE_SYSTEMS));
|
||||
}
|
||||
}
|
||||
for (ConceptSetComponent inc : valueset.getCompose().getInclude()) {
|
||||
if (inc.hasValueSet())
|
||||
throw new FHIRException("Unable to resolve system - value set has imports");
|
||||
throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_IMPORTS));
|
||||
if (!inc.hasSystem())
|
||||
throw new FHIRException("Unable to resolve system - value set has include with no system");
|
||||
throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_NO_SYSTEM));
|
||||
}
|
||||
if (valueset.getCompose().getInclude().size() == 1)
|
||||
return valueset.getCompose().getInclude().get(0).getSystem();
|
||||
|
@ -360,7 +361,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||
// ok, we need the code system
|
||||
CodeSystem cs = context.fetchCodeSystem(system);
|
||||
if (cs == null || cs.getContent() != CodeSystemContentMode.COMPLETE) {
|
||||
// make up a transient value set with
|
||||
// make up a transient value set with
|
||||
ValueSet vs = new ValueSet();
|
||||
vs.setUrl(Utilities.makeUuidUrn());
|
||||
vs.getCompose().addInclude(vsi);
|
||||
|
@ -395,7 +396,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||
return codeInConceptFilter(cs, f, code);
|
||||
else {
|
||||
System.out.println("todo: handle filters with property = "+f.getProperty());
|
||||
throw new FHIRException("Unable to handle system "+cs.getUrl()+" filter with property = "+f.getProperty());
|
||||
throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_HANDLE_SYSTEM__FILTER_WITH_PROPERTY__, cs.getUrl(), f.getProperty()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,7 +406,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
|
|||
case ISNOTA: return !codeInConceptIsAFilter(cs, f, code);
|
||||
default:
|
||||
System.out.println("todo: handle concept filters with op = "+f.getOp());
|
||||
throw new FHIRException("Unable to handle system "+cs.getUrl()+" concept filter with op = "+f.getOp());
|
||||
throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_HANDLE_SYSTEM__CONCEPT_FILTER_WITH_OP__, cs.getUrl(), f.getOp()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -386,5 +386,45 @@ public class I18nConstants {
|
|||
public final static String UNKNOWN_DATA_FORMAT_ = "Unknown_Data_format_";
|
||||
public final static String NO_TYPE_FOUND_ON_ = "No_type_found_on_";
|
||||
public final static String ERROR_WRITING_NUMBER__TO_JSON = "error_writing_number__to_JSON";
|
||||
public final static String UNABLE_TO_PROCESS_REQUEST_FOR_RESOURCE_FOR___ = "Unable_to_process_request_for_resource_for___";
|
||||
public final static String RESOURCE_TYPE_MISMATCH_FOR___ = "Resource_type_mismatch_for___";
|
||||
public final static String NOT_DONE_YET_CANT_FETCH_ = "not_done_yet_cant_fetch_";
|
||||
public final static String ATTEMPT_TO_USE_TERMINOLOGY_SERVER_WHEN_NO_TERMINOLOGY_SERVER_IS_AVAILABLE = "Attempt_to_use_Terminology_server_when_no_Terminology_server_is_available";
|
||||
public final static String NO_EXPANSIONPROFILE_PROVIDED = "No_ExpansionProfile_provided";
|
||||
public final static String CAN_ONLY_SPECIFY_PROFILE_IN_THE_CONTEXT = "Can_only_specify_profile_in_the_context";
|
||||
public final static String NO_URL_IN_EXPAND_VALUE_SET_2 = "no_url_in_expand_value_set_2";
|
||||
public final static String NO_URL_IN_EXPAND_VALUE_SET = "no_url_in_expand_value_set";
|
||||
public final static String NO_VALUE_SET = "no_value_set";
|
||||
public final static String NO_PARAMETERS_PROVIDED_TO_EXPANDVS = "No_Parameters_provided_to_expandVS";
|
||||
public final static String NO_EXPANSION_PARAMETERS_PROVIDED = "No_Expansion_Parameters_provided";
|
||||
public final static String UNABLE_TO_RESOLVE_VALUE_SET_ = "Unable_to_resolve_value_Set_";
|
||||
public final static String DELIMITED_VERSIONS_HAVE_EXACT_MATCH_FOR_DELIMITER____VS_ = "Delimited_versions_have_exact_match_for_delimiter____vs_";
|
||||
public final static String DUPLICATE_RESOURCE_ = "Duplicate_Resource_";
|
||||
public final static String ERROR_EXPANDING_VALUESET_RUNNING_WITHOUT_TERMINOLOGY_SERVICES = "Error_expanding_ValueSet_running_without_terminology_services";
|
||||
public final static String ERROR_VALIDATING_CODE_RUNNING_WITHOUT_TERMINOLOGY_SERVICES = "Error_validating_code_running_without_terminology_services";
|
||||
public final static String UNABLE_TO_VALIDATE_CODE_WITHOUT_USING_SERVER = "Unable_to_validate_code_without_using_server";
|
||||
public final static String PROFILE___ERROR_GENERATING_SNAPSHOT = "Profile___Error_generating_snapshot";
|
||||
public final static String PROFILE___ELEMENT__ERROR_GENERATING_SNAPSHOT_ = "Profile___element__Error_generating_snapshot_";
|
||||
public final static String PROFILE___BASE__COULD_NOT_BE_RESOLVED = "Profile___base__could_not_be_resolved";
|
||||
public final static String PROFILE___HAS_NO_BASE_AND_NO_SNAPSHOT = "Profile___has_no_base_and_no_snapshot";
|
||||
public final static String NO_VALIDATOR_CONFIGURED = "No_validator_configured";
|
||||
public final static String PARSER_TYPE__NOT_SUPPORTED = "Parser_Type__not_supported";
|
||||
public final static String VERSION_MISMATCH_THE_CONTEXT_HAS_VERSION__LOADED_AND_THE_NEW_CONTENT_BEING_LOADED_IS_VERSION_ = "Version_mismatch_The_context_has_version__loaded_and_the_new_content_being_loaded_is_version_";
|
||||
public final static String ERROR_READING__FROM_PACKAGE__ = "Error_reading__from_package__";
|
||||
public final static String ERROR_PARSING_ = "Error_parsing_";
|
||||
public final static String UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__ = "Unable_to_connect_to_terminology_server_Use_parameter_tx_na_tun_run_without_using_terminology_services_to_validate_LOINC_SNOMED_ICDX_etc_Error__";
|
||||
public final static String DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF_ = "Display_Name_for__should_be_one_of__instead_of_";
|
||||
public final static String UNKNOWN_CODE__IN_ = "Unknown_Code__in_";
|
||||
public final static String CODE_FOUND_IN_EXPANSION_HOWEVER_ = "Code_found_in_expansion_however_";
|
||||
public final static String NONE_OF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_ = "None_of_the_provided_codes_are_in_the_value_set_";
|
||||
public final static String CODING_HAS_NO_SYSTEM__CANNOT_VALIDATE = "Coding_has_no_system__cannot_validate";
|
||||
public final static String UNABLE_TO_HANDLE_SYSTEM__CONCEPT_FILTER_WITH_OP__ = "Unable_to_handle_system__concept_filter_with_op__";
|
||||
public final static String UNABLE_TO_HANDLE_SYSTEM__FILTER_WITH_PROPERTY__ = "Unable_to_handle_system__filter_with_property__";
|
||||
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_NO_SYSTEM = "Unable_to_resolve_system__value_set_has_include_with_no_system";
|
||||
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_IMPORTS = "Unable_to_resolve_system__value_set_has_imports";
|
||||
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_EXPANSION_HAS_MULTIPLE_SYSTEMS = "Unable_to_resolve_system__value_set_expansion_has_multiple_systems";
|
||||
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_NO_INCLUDES_OR_EXPANSION = "Unable_to_resolve_system__value_set_has_no_includes_or_expansion";
|
||||
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_EXCLUDES = "Unable_to_resolve_system__value_set_has_excludes";
|
||||
public final static String UNABLE_TO_RESOLVE_SYSTEM__NO_VALUE_SET = "Unable_to_resolve_system__no_value_set";
|
||||
|
||||
}
|
||||
|
|
|
@ -383,5 +383,45 @@ Unknown_Date_format_ = Unknown Date format ''{0}''
|
|||
Unknown_Data_format_ = Unknown Data format ''{0}''
|
||||
No_type_found_on_ = No type found on ''{0}''
|
||||
error_writing_number__to_JSON = error writing number ''{0}'' to JSON
|
||||
Unable_to_process_request_for_resource_for___ = Unable to process request for resource for {0} / {1}
|
||||
Resource_type_mismatch_for___ = Resource type mismatch for {0} / {1}
|
||||
not_done_yet_cant_fetch_ = not done yet: can''t fetch {0}
|
||||
Attempt_to_use_Terminology_server_when_no_Terminology_server_is_available = Attempt to use Terminology server when no Terminology server is available
|
||||
No_ExpansionProfile_provided = No ExpansionProfile provided
|
||||
Can_only_specify_profile_in_the_context = Can only specify profile in the context
|
||||
no_url_in_expand_value_set_2 = no url in expand value set 2
|
||||
no_url_in_expand_value_set = no url in expand value set
|
||||
no_value_set = no value set
|
||||
No_Parameters_provided_to_expandVS = No Parameters provided to expandVS
|
||||
No_Expansion_Parameters_provided = No Expansion Parameters provided
|
||||
Unable_to_resolve_value_Set_ = Unable to resolve value Set {0}
|
||||
Delimited_versions_have_exact_match_for_delimiter____vs_ = Delimited versions have exact match for delimiter ''{0}'' : {1} vs {2}
|
||||
Duplicate_Resource_ = Duplicate Resource {0}
|
||||
Error_expanding_ValueSet_running_without_terminology_services = Error expanding ValueSet: running without terminology services
|
||||
Error_validating_code_running_without_terminology_services = Error validating code: running without terminology services
|
||||
Unable_to_validate_code_without_using_server = Unable to validate code without using server
|
||||
Profile___Error_generating_snapshot = Profile {0} ({1}). Error generating snapshot
|
||||
Profile___element__Error_generating_snapshot_ = Profile {0} ({1}), element {2}. Error generating snapshot: {3}
|
||||
Profile___base__could_not_be_resolved = Profile {0} ({1}) base {2} could not be resolved
|
||||
Profile___has_no_base_and_no_snapshot = Profile {0} ({1}) has no base and no snapshot
|
||||
No_validator_configured = No validator configured
|
||||
Parser_Type__not_supported = Parser Type {0} not supported
|
||||
Version_mismatch_The_context_has_version__loaded_and_the_new_content_being_loaded_is_version_ = Version mismatch. The context has version {0} loaded, and the new content being loaded is version {1}
|
||||
Error_reading__from_package__ = Error reading {0} from package {1}#{2}: {3}
|
||||
Error_parsing_ = Error parsing {0}:{1}
|
||||
Unable_to_connect_to_terminology_server_Use_parameter_tx_na_tun_run_without_using_terminology_services_to_validate_LOINC_SNOMED_ICDX_etc_Error__ = Unable to connect to terminology server. Use parameter ''-tx n/a'' tun run without using terminology services to validate LOINC, SNOMED, ICD-X etc. Error = {0}
|
||||
Display_Name_for__should_be_one_of__instead_of_ = Display Name for {0}#{1} should be one of ''{2}'' instead of ''{3}''
|
||||
Unknown_Code__in_ = Unknown Code {0} in {1}
|
||||
Code_found_in_expansion_however_ = Code found in expansion, however: {0}
|
||||
None_of_the_provided_codes_are_in_the_value_set_ = None of the provided codes are in the value set {0}
|
||||
Coding_has_no_system__cannot_validate = Coding has no system - cannot validate
|
||||
Unable_to_handle_system__concept_filter_with_op__ = Unable to handle system {0} concept filter with op = {1}
|
||||
Unable_to_handle_system__filter_with_property__ = Unable to handle system {0} filter with property = {1}
|
||||
Unable_to_resolve_system__value_set_has_include_with_no_system = Unable to resolve system - value set has include with no system
|
||||
Unable_to_resolve_system__value_set_has_imports = Unable to resolve system - value set has imports
|
||||
Unable_to_resolve_system__value_set_expansion_has_multiple_systems = Unable to resolve system - value set expansion has multiple systems
|
||||
Unable_to_resolve_system__value_set_has_no_includes_or_expansion = Unable to resolve system - value set has no includes or expansion
|
||||
Unable_to_resolve_system__value_set_has_excludes = Unable to resolve system - value set has excludes
|
||||
Unable_to_resolve_system__no_value_set = Unable to resolve system - no value set
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue