Merge pull request #745 from hapifhir/gg-202202-broken-links

Gg 202202 broken links
This commit is contained in:
Grahame Grieve 2022-02-16 15:53:57 +11:00 committed by GitHub
commit fa5f13a59f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 59 additions and 27 deletions

View File

@ -1,7 +1,10 @@
## Validator Changes
* no changes
* Improve code validation error when value set can't be supported on tx.fhir.org
* Hide error about regex in core package
## Other code changes
* no changes
* Fix wrong URL links in processed markdown
* Don't let txCache errors stop the process
* Fix broken links in questionnaire +

View File

@ -48,7 +48,7 @@ import java.io.FileOutputStream;
public class Test {
public final static String DEF_TS_SERVER = "http://fhir-dev.healthintersections.com.au/open";
public final static String DEV_TS_SERVER = "http://local.fhir.org:960/open";
public final static String DEV_TS_SERVER = "http://local.fhir.org:8080/open";
public static final String DEF_PATH = "c:\\work\\org.hl7.fhir\\build\\implementations\\java\\org.hl7.fhir.convertors\\samples\\";

View File

@ -78,7 +78,7 @@ import java.util.*;
public class ArgonautConverter extends ConverterBase {
// public final static String DEF_TS_SERVER = "http://fhir-dev.healthintersections.com.au/open";
public final static String DEV_TS_SERVER = "http://local.fhir.org:960/open";
public final static String DEV_TS_SERVER = "http://local.fhir.org:8080/open";
public static final String UCUM_PATH = "c:\\work\\org.hl7.fhir\\build\\implementations\\java\\org.hl7.fhir.convertors\\samples\\ucum-essence.xml";
public static final String SRC_PATH = "c:\\work\\org.hl7.fhir\\build\\publish\\";
private static final String DEFAULT_ID_SPACE = "urn:uuid:e8e06b15-0f74-4b8e-b5e2-609dae7119dc";

View File

@ -92,7 +92,7 @@ public class TerminologyClientFactory {
return url;
if (url.startsWith("http://tx.fhir.org"))
return Utilities.pathURL(url, term);
if (url.equals("http://local.fhir.org:960"))
if (url.equals("http://local.fhir.org:8080"))
return Utilities.pathURL(url, term);
return url;
}

View File

@ -2523,7 +2523,8 @@ public class ProfileUtilities extends TranslatingUtilities {
// disabled 7-Dec 2021 GDG - we don't want to fool with relative URLs at all?
// re-enabled 11-Feb 2022 GDG - we do want to do this. At least, $assemble in davinci-dtr, where the markdown comes from the SDC IG, and an SDC local reference must be changed to point to SDC. in this case, it's called when generating snapshots
// added processRelatives parameter to deal with this (well, to try)
if (processRelatives) {
if (processRelatives && webUrl != null) {
System.out.println("Making "+url+" relative to '"+webUrl+"'");
b.append(webUrl);
} else {
System.out.println("Not making "+url+" relative to '"+webUrl+"'");
@ -4785,10 +4786,10 @@ public class ProfileUtilities extends TranslatingUtilities {
private void renderAdditionalBinding(HierarchicalTableGenerator gen, Cell c, Extension ext) {
// <nsbp>2 <sp> purpose <sp> value-set-link ([context]) {documentation}
// String purpose = ext.getExtensionString("purpose");
// String valueSet = ext.getExtensionString("valueSet");
// String doco = ext.getExtensionString("documentation");
// UsageContext usage = (ext.hasExtension("usage")) ? ext.getExtensionByUrl("usage").getValueUsageContext() : null;
String purpose = ext.getExtensionString("purpose");
String valueSet = ext.getExtensionString("valueSet");
String doco = ext.getExtensionString("documentation");
UsageContext usage = (ext.hasExtension("usage")) ? ext.getExtensionByUrl("usage").getValueUsageContext() : null;
//
// purpose: code - defines how the binding is used
// usage : UsageContext - defines the contexts in which this binding is used for it's purpose

View File

@ -813,7 +813,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
pu.setDebug(false);
for (String err : errors)
msgs.add(new ValidationMessage(Source.ProfileValidator, IssueType.EXCEPTION, p.getUserString("path"), "Error sorting Differential: "+err, ValidationMessage.IssueSeverity.ERROR));
pu.generateSnapshot(sd, p, p.getUrl(), Utilities.extractBaseUrl(sd.getUserString("path")), p.getName());
pu.generateSnapshot(sd, p, p.getUrl(), sd.getUserString("webroot"), p.getName());
for (ValidationMessage msg : msgs) {
if ((!ignoreProfileErrors && msg.getLevel() == ValidationMessage.IssueSeverity.ERROR) || msg.getLevel() == ValidationMessage.IssueSeverity.FATAL)
throw new DefinitionException(formatMessage(I18nConstants.PROFILE___ELEMENT__ERROR_GENERATING_SNAPSHOT_, p.getName(), p.getUrl(), msg.getLocation(), msg.getMessage()));

View File

@ -600,7 +600,8 @@ public class TerminologyCache {
caches.put(nc.name, nc);
}
} catch (Exception e) {
throw new FHIRException("Error loading "+fn+": "+e.getMessage()+" entry "+c, e);
System.out.println("Error loading "+fn+": "+e.getMessage()+" entry "+c+" - ignoring it");
e.printStackTrace();
}
}

View File

@ -202,13 +202,13 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
r.setIcon("icon_q_root.gif", "QuestionnaireRoot");
r.getCells().add(gen.new Cell(null, null, q.getName(), null, null));
r.getCells().add(gen.new Cell(null, null, "", null, null));
r.getCells().add(gen.new Cell(null, null, q.getDescription(), null, null));
r.getCells().add(gen.new Cell(null, null, "", null, null));
r.getCells().add(gen.new Cell(null, null, "Questionnaire", null, null));
if (hasFlags) {
r.getCells().add(gen.new Cell(null, null, "", null, null));
}
r.getCells().add(gen.new Cell(null, null, q.getDescription(), null, null));
r.getCells().add(gen.new Cell(null, null, q.hasUrl() ? q.hasVersion() ? q.getUrl()+"#"+q.getVersion() : q.getUrl() : "", null, null));
return r;
}
@ -226,7 +226,9 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
boolean hasExt = false;
r.setIcon("icon-q-"+i.getType().toCode().toLowerCase()+".png", i.getType().getDisplay());
r.getCells().add(gen.new Cell(null, context.getDefinitionsTarget() == null ? "" : context.getDefinitionsTarget()+"#item."+i.getLinkId(), i.getLinkId(), null, null));
Cell c1 = gen.new Cell(null, context.getDefinitionsTarget() == null ? "" : context.getDefinitionsTarget()+"#item."+i.getLinkId(), i.getLinkId(), null, null);
c1.setId("item."+i.getLinkId());
r.getCells().add(c1);
String txt = (i.hasPrefix() ? i.getPrefix() + ". " : "") + i.getText();
r.getCells().add(gen.new Cell(null, null, txt, null, null));
r.getCells().add(gen.new Cell(null, null, (i.getRequired() ? "1" : "0")+".."+(i.getRepeats() ? "*" : "1"), null, null));
@ -282,7 +284,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
Piece p = gen.new Piece(null, "Enable When: ", null);
defn.getPieces().add(p);
if (i.getEnableWhen().size() == 0) {
if (i.getEnableWhen().size() == 1) {
XhtmlNode x = new XhtmlNode(NodeType.Element, "span");
p.getChildren().add(x);
renderEnableWhen(x, i.getEnableWhenFirstRep());

View File

@ -255,7 +255,11 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
res = new ValidationResult((IssueSeverity) null, null);
}
if (!inExpansion && !inInclude) {
res.setMessage("Not in value set "+valueset.getUrl()).setSeverity(IssueSeverity.ERROR);
if (warnings != null) {
res.setMessage("Not in value set "+valueset.getUrl()+" ("+warnings+")").setSeverity(IssueSeverity.ERROR);
} else {
res.setMessage("Not in value set "+valueset.getUrl()).setSeverity(IssueSeverity.ERROR);
}
} else if (warningMessage!=null) {
res = new ValidationResult(IssueSeverity.WARNING, context.formatMessage(I18nConstants.CODE_FOUND_IN_EXPANSION_HOWEVER_, warningMessage));
} else if (inExpansion) {

View File

@ -83,7 +83,7 @@ import java.util.Map.Entry;
*/
public class FilesystemPackageCacheManager extends BasePackageCacheManager implements IPackageCacheManager {
// private static final String SECONDARY_SERVER = "http://local.fhir.org:960/packages";
// private static final String SECONDARY_SERVER = "http://local.fhir.org:8080/packages";
public static final String PACKAGE_REGEX = "^[a-zA-Z][A-Za-z0-9\\_\\-]*(\\.[A-Za-z0-9\\_\\-]+)+$";
public static final String PACKAGE_VERSION_REGEX = "^[A-Za-z][A-Za-z0-9\\_\\-]*(\\.[A-Za-z0-9\\_\\-]+)+\\#[A-Za-z0-9\\-\\_\\$]+(\\.[A-Za-z0-9\\-\\_\\$]+)*$";
public static final String PACKAGE_VERSION_REGEX_OPT = "^[A-Za-z][A-Za-z0-9\\_\\-]*(\\.[A-Za-z0-9\\_\\-]+)+(\\#[A-Za-z0-9\\-\\_]+(\\.[A-Za-z0-9\\-\\_]+)*)?$";

View File

@ -221,7 +221,8 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
private String cellStyle;
protected int span = 1;
private TextAlignment alignment = TextAlignment.LEFT;
private String id;
public Cell() {
}
@ -241,6 +242,8 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
return this;
}
public Cell addMarkdown(String md) {
if (!Utilities.noString(md)) {
try {
@ -428,7 +431,13 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
return this;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
public class Title extends Cell {
@ -725,6 +734,10 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
if (c.span > 1) {
tc.colspan(Integer.toString(c.span));
}
if (c.getId() != null) {
tc.setAttribute("id", c.getId());
}
if (indents != null) {
tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_spacer.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", ".");
tc.setAttribute("style", "vertical-align: top; text-align : left; "+(c.cellStyle != null && c.cellStyle.contains("background-color") ? "" : "background-color: "+color+"; ")+"border: "+ border +"px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url("+imagePath+checkExists(indents, hasChildren, lineColor, outputTracker)+")"+(c.cellStyle != null ? ";"+c.cellStyle : ""));
@ -795,8 +808,9 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
if (p.getHint() != null)
tag.setAttribute("title", p.getHint());
addStyle(tag, p);
if (p.hasChildren())
if (p.hasChildren()) {
tag.getChildNodes().addAll(p.getChildren());
}
} else if (!Utilities.noString(p.getReference())) {
XhtmlNode a = addStyle(tc.addTag("a"), p);
a.setAttribute("href", p.getReference());
@ -818,6 +832,9 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
s.addText(p.getText());
} else
tc.addText(p.getText());
if (p.hasChildren()) {
tc.getChildNodes().addAll(p.getChildren());
}
}
}
if (makeTargets && !Utilities.noString(anchor))

View File

@ -13,7 +13,7 @@ public class CachingPackageClientTests {
private static final String SERVER1 = "http://packages.fhir.org";
private static final String SERVER2 = "https://packages2.fhir.org/packages";
// private static final String SERVER2 = "http://local.fhir.org:960/packages";
// private static final String SERVER2 = "http://local.fhir.org:8080/packages";
@Test
public void testExists() throws IOException {

View File

@ -1876,9 +1876,13 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
// the history of this is a mess - see https://jira.hl7.org/browse/FHIR-13328
// we in practice we will support it in either place, but the specification says on ElementDefinition, not on ElementDefinition.type
// if ("http://hl7.org/fhir/StructureDefinition/regex".equals(extUrl)) {
// list.get(1).setExpression("ElementDefinition.type");
// }
// but this creates validation errors people can't fix all over the place if we don't do this.
if ("http://hl7.org/fhir/StructureDefinition/regex".equals(extUrl)) {
StructureDefinitionContextComponent e = new StructureDefinitionContextComponent();
e.setExpression("ElementDefinition.type");
e.setType(ExtensionContextType.ELEMENT);
list.add(e);
}
if ("http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version".equals(extUrl)) {
list.get(0).setExpression("Element"); // well, it can't be used anywhere but the list of places it can be used is quite long
}

View File

@ -77,7 +77,7 @@ public class StructureDefinitionValidator extends BaseValidator {
List<ValidationMessage> msgs = new ArrayList<>();
ProfileUtilities pu = new ProfileUtilities(context, msgs, null);
pu.setXver(xverManager);
pu.generateSnapshot(base, sd, sd.getUrl(), "http://hl7.org/fhir", sd.getName());
pu.generateSnapshot(base, sd, sd.getUrl(), "http://hl7.org/fhir/R4/", sd.getName());
if (msgs.size() > 0) {
for (ValidationMessage msg : msgs) {
// we need to set the location for the context

View File

@ -22,7 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class ValidationEngineTests {
public static final String DEF_TX = "http://tx.fhir.org";
// public static final String DEF_TX = "http://local.fhir.org:960";
// public static final String DEF_TX = "http://local.fhir.org:8080";
public static boolean inbuild;