Merge pull request #929 from hapifhir/gg-2022-09-cs_vs
Gg 2022 09 cs vs
This commit is contained in:
commit
0b40db7f0b
|
@ -116,28 +116,53 @@ public class PackageVisitor {
|
|||
Map<String, String> cpidMap = getAllCIPackages();
|
||||
Set<String> cpidSet = new HashSet<>();
|
||||
System.out.println("Go: "+cpidMap.size()+" current packages");
|
||||
int i = 0;
|
||||
for (String s : cpidMap.keySet()) {
|
||||
processCurrentPackage(s, cpidMap.get(s), cpidSet);
|
||||
processCurrentPackage(s, cpidMap.get(s), cpidSet, i, cpidMap.size());
|
||||
i++;
|
||||
}
|
||||
Set<String> pidList = getAllPackages();
|
||||
System.out.println("Go: "+pidList.size()+" published packages");
|
||||
i = 0;
|
||||
for (String pid : pidList) {
|
||||
if (!cpidSet.contains(pid)) {
|
||||
cpidSet.add(pid);
|
||||
List<String> vList = listVersions(pid);
|
||||
if (oldVersions) {
|
||||
for (String v : vList) {
|
||||
processPackage(pid, v);
|
||||
processPackage(pid, v, i, pidList.size());
|
||||
}
|
||||
} else if (vList.isEmpty()) {
|
||||
System.out.println("No Packages for "+pid);
|
||||
} else {
|
||||
processPackage(pid, vList.get(vList.size() - 1));
|
||||
processPackage(pid, vList.get(vList.size() - 1), i, pidList.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
JsonObject json = JsonTrackingParser.fetchJson("https://raw.githubusercontent.com/FHIR/ig-registry/master/fhir-ig-list.json");
|
||||
i = 0;
|
||||
List<JsonObject> objects = JsonUtilities.objects(json, "guides");
|
||||
for (JsonObject o : objects) {
|
||||
String pid = JsonUtilities.str(o, "npm-name");
|
||||
if (pid != null && !cpidSet.contains(pid)) {
|
||||
cpidSet.add(pid);
|
||||
List<String> vList = listVersions(pid);
|
||||
if (oldVersions) {
|
||||
for (String v : vList) {
|
||||
processPackage(pid, v, i, objects.size());
|
||||
}
|
||||
} else if (vList.isEmpty()) {
|
||||
System.out.println("No Packages for "+pid);
|
||||
} else {
|
||||
processPackage(pid, vList.get(vList.size() - 1), i, objects.size());
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private void processCurrentPackage(String url, String pid, Set<String> cpidSet) {
|
||||
private void processCurrentPackage(String url, String pid, Set<String> cpidSet, int i, int t) {
|
||||
try {
|
||||
String[] p = url.split("\\/");
|
||||
String repo = "https://build.fhir.org/ig/"+p[0]+"/"+p[1];
|
||||
|
@ -160,7 +185,7 @@ public class PackageVisitor {
|
|||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Processed: "+pid+"#current: "+c+" resources");
|
||||
System.out.println("Processed: "+pid+"#current: "+c+" resources ("+i+" of "+t+")");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Unable to process: "+pid+"#current: "+e.getMessage());
|
||||
|
@ -228,7 +253,7 @@ public class PackageVisitor {
|
|||
}
|
||||
|
||||
|
||||
private void processPackage(String pid, String v) throws IOException {
|
||||
private void processPackage(String pid, String v, int i, int t) throws IOException {
|
||||
NpmPackage npm = null;
|
||||
String fv = null;
|
||||
try {
|
||||
|
@ -252,7 +277,7 @@ public class PackageVisitor {
|
|||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Processed: "+pid+"#"+v+": "+c+" resources");
|
||||
System.out.println("Processed: "+pid+"#"+v+": "+c+" resources ("+i+" of "+t+")");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,9 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
if (conf.getRest().size() > 0) {
|
||||
CapabilityStatementRestComponent rest = conf.getRest().get(0);
|
||||
XhtmlNode t = x.table(null);
|
||||
addTableRow(t, "Mode", rest.getMode().toString());
|
||||
if (rest.hasMode()) {
|
||||
addTableRow(t, "Mode", rest.getMode().toString());
|
||||
}
|
||||
addMarkdown(addTableRow(t, "Description"), rest.getDocumentation());
|
||||
|
||||
addTableRow(t, "Transaction", showOp(rest, SystemRestfulInteraction.TRANSACTION));
|
||||
|
|
|
@ -41,6 +41,7 @@ import java.util.Set;
|
|||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.model.BooleanType;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
|
@ -67,6 +68,35 @@ import org.hl7.fhir.utilities.Utilities;
|
|||
|
||||
public class CodeSystemUtilities {
|
||||
|
||||
public static class SystemReference {
|
||||
private String link;
|
||||
private String text;
|
||||
private boolean local;
|
||||
|
||||
public SystemReference(String text, String link) {
|
||||
super();
|
||||
this.link = link;
|
||||
this.text = text;
|
||||
}
|
||||
public SystemReference(String text, String link, boolean local) {
|
||||
super();
|
||||
this.link = link;
|
||||
this.text = text;
|
||||
this.local = local;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public boolean isLocal() {
|
||||
return local;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ConceptDefinitionComponentSorter implements Comparator<ConceptDefinitionComponent> {
|
||||
|
||||
@Override
|
||||
|
@ -619,5 +649,26 @@ public class CodeSystemUtilities {
|
|||
return jurisdiction == null || !jurisdiction.contains("#") ? null : new Coding().setCode(jurisdiction.substring(jurisdiction.indexOf("#")+1)).setSystem(jurisdiction.substring(0, jurisdiction.indexOf("#")));
|
||||
}
|
||||
|
||||
public static SystemReference getSystemReference(String system, IWorkerContext ctxt) {
|
||||
if (system == null) {
|
||||
return null;
|
||||
} if ("http://snomed.info/sct".equals(system)) {
|
||||
return new SystemReference("SNOMED CT", "https://browser.ihtsdotools.org/");
|
||||
} else if ("http://loinc.org".equals(system)) {
|
||||
return new SystemReference("LOINC", "https://loinc.org/");
|
||||
} else if ("http://unitsofmeasure.org".equals(system)) {
|
||||
return new SystemReference("UCUM", "http://ucum.org");
|
||||
} else if (system.equals("http://www.nlm.nih.gov/research/umls/rxnorm")) {
|
||||
return new SystemReference("RxNorm", "http://www.nlm.nih.gov/research/umls/rxnorm");
|
||||
} else if (ctxt != null) {
|
||||
CodeSystem cs = ctxt.fetchCodeSystem(system);
|
||||
if (cs != null && cs.hasUserData("path")) {
|
||||
return new SystemReference(cs.present(), cs.getUserString("path"), Utilities.isAbsoluteUrl(cs.getUserString("path")));
|
||||
} else if (cs != null) {
|
||||
return new SystemReference(cs.present(), null);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -51,6 +51,7 @@ import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
|||
import org.hl7.fhir.r5.model.CodeType;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionPropertyComponent;
|
||||
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities.ConceptDefinitionComponentSorter;
|
||||
|
@ -272,5 +273,18 @@ public class ValueSetUtilities {
|
|||
Collections.sort(inc.getConcept(), new ConceptReferenceComponentSorter());
|
||||
}
|
||||
|
||||
public static String getAllCodesSystem(ValueSet vs) {
|
||||
if (vs.hasCompose()) {
|
||||
ValueSetComposeComponent c = vs.getCompose();
|
||||
if (c.getExclude().isEmpty() && c.getInclude().size() == 1) {
|
||||
ConceptSetComponent i = c.getIncludeFirstRep();
|
||||
if (i.hasSystem() && !i.hasValueSet() && !i.hasConcept() && !i.hasFilter()) {
|
||||
return i.getSystem();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -631,6 +631,10 @@ public class I18nConstants {
|
|||
public static final String VALUESET_SHAREABLE_MISSING_HL7 = "VALUESET_SHAREABLE_MISSING_HL7";
|
||||
public static final String VALUESET_SHAREABLE_EXTRA_MISSING_HL7 = "VALUESET_SHAREABLE_EXTRA_MISSING_HL7";
|
||||
public static final String VALUESET_SHAREABLE_EXTRA_MISSING = "VALUESET_SHAREABLE_EXTRA_MISSING";
|
||||
public static final String CODESYSTEM_SHAREABLE_MISSING = "CODESYSTEM_SHAREABLE_MISSING";
|
||||
public static final String CODESYSTEM_SHAREABLE_MISSING_HL7 = "CODESYSTEM_SHAREABLE_MISSING_HL7";
|
||||
public static final String CODESYSTEM_SHAREABLE_EXTRA_MISSING_HL7 = "CODESYSTEM_SHAREABLE_EXTRA_MISSING_HL7";
|
||||
public static final String CODESYSTEM_SHAREABLE_EXTRA_MISSING = "CODESYSTEM_SHAREABLE_EXTRA_MISSING";
|
||||
public static final String VALUESET_UNC_SYSTEM_WARNING = "VALUESET_UNC_SYSTEM_WARNING";
|
||||
public static final String VALUESET_UNC_SYSTEM_WARNING_VER = "VALUESET_UNC_SYSTEM_WARNING_VER";
|
||||
public static final String VALUESET_IMPORT_UNION_INTERSECTION = "VALUESET_IMPORT_UNION_INTERSECTION";
|
||||
|
|
|
@ -165,5 +165,4 @@ public class JsonUtilities {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
|
@ -726,3 +726,7 @@ VALUESET_SHAREABLE_MISSING = The ShareableValueSet profile says that the {0} ele
|
|||
VALUESET_SHAREABLE_EXTRA_MISSING = The ShareableValueSet profile recommends that the {0} element is populated, but it is not present. Published value sets SHOULD conform to the ShareableValueSet profile
|
||||
VALUESET_SHAREABLE_MISSING_HL7 = The ShareableValueSet profile says that the {0} element is mandatory, but it is not found. HL7 Published value sets SHALL conform to the ShareableValueSet profile
|
||||
VALUESET_SHAREABLE_EXTRA_MISSING_HL7 = The ShareableValueSet profile recommends that the {0} element is populated, but it is not found. HL7 Published value sets SHALL conform to the ShareableValueSet profile
|
||||
CODESYSTEM_SHAREABLE_MISSING = The ShareableCodeSystem profile says that the {0} element is mandatory, but it is not present. Published value sets SHOULD conform to the ShareableCodeSystem profile
|
||||
CODESYSTEM_SHAREABLE_EXTRA_MISSING = The ShareableCodeSystem profile recommends that the {0} element is populated, but it is not present. Published value sets SHOULD conform to the ShareableCodeSystem profile
|
||||
CODESYSTEM_SHAREABLE_MISSING_HL7 = The ShareableCodeSystem profile says that the {0} element is mandatory, but it is not found. HL7 Published value sets SHALL conform to the ShareableCodeSystem profile
|
||||
CODESYSTEM_SHAREABLE_EXTRA_MISSING_HL7 = The ShareableCodeSystem profile recommends that the {0} element is populated, but it is not found. HL7 Published value sets SHALL conform to the ShareableCodeSystem profile
|
||||
|
|
|
@ -91,28 +91,28 @@ public class CodeSystemValidator extends BaseValidator {
|
|||
private void checkShareableCodeSystem(List<ValidationMessage> errors, Element cs, NodeStack stack) {
|
||||
if (parent.isForPublication()) {
|
||||
if (isHL7(cs)) {
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("url"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "url");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("version"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "version");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("title"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "title");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("name"), I18nConstants.VALUESET_SHAREABLE_EXTRA_MISSING_HL7, "name");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("status"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "status");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("experimental"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "experimental");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("description"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "description");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("content"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "content");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("url"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING_HL7, "url");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("version"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING_HL7, "version");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("title"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING_HL7, "title");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("name"), I18nConstants.CODESYSTEM_SHAREABLE_EXTRA_MISSING_HL7, "name");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("status"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING_HL7, "status");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("experimental"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING_HL7, "experimental");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("description"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING_HL7, "description");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("content"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING_HL7, "content");
|
||||
if (!"supplement".equals(cs.getChildValue("content"))) {
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("caseSensitive"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "caseSensitive");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("caseSensitive"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING_HL7, "caseSensitive");
|
||||
}
|
||||
} else {
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("url"), I18nConstants.VALUESET_SHAREABLE_MISSING, "url");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("version"), I18nConstants.VALUESET_SHAREABLE_MISSING, "version");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("title"), I18nConstants.VALUESET_SHAREABLE_MISSING, "title");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("name"), I18nConstants.VALUESET_SHAREABLE_EXTRA_MISSING, "name");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("status"), I18nConstants.VALUESET_SHAREABLE_MISSING, "status");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("experimental"), I18nConstants.VALUESET_SHAREABLE_MISSING, "experimental");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("description"), I18nConstants.VALUESET_SHAREABLE_MISSING, "description");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("content"), I18nConstants.VALUESET_SHAREABLE_MISSING, "content");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("url"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING, "url");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("version"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING, "version");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("title"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING, "title");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("name"), I18nConstants.CODESYSTEM_SHAREABLE_EXTRA_MISSING, "name");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("status"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING, "status");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("experimental"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING, "experimental");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("description"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING, "description");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("content"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING, "content");
|
||||
if (!"supplement".equals(cs.getChildValue("content"))) {
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("caseSensitive"), I18nConstants.VALUESET_SHAREABLE_MISSING, "caseSensitive");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("caseSensitive"), I18nConstants.CODESYSTEM_SHAREABLE_MISSING, "caseSensitive");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ public class StructureDefinitionValidator extends BaseValidator {
|
|||
List<ValidationMessage> msgs = new ArrayList<>();
|
||||
ProfileUtilities pu = new ProfileUtilities(context, msgs, null);
|
||||
pu.setXver(xverManager);
|
||||
pu.setNewSlicingProcessing(!sd.hasFhirVersion() || VersionUtilities.isR4Plus(sd.getFhirVersion().toCode()));
|
||||
pu.generateSnapshot(base, sd, sd.getUrl(), "http://hl7.org/fhir/R4/", sd.getName());
|
||||
if (msgs.size() > 0) {
|
||||
for (ValidationMessage msg : msgs) {
|
||||
|
|
Loading…
Reference in New Issue