Skip to content

Commit

Permalink
clearTxCache, terminolgyRouting #299
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveregger committed Oct 17, 2024
1 parent 19748e1 commit 0da03d3
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 7 deletions.
13 changes: 7 additions & 6 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
2024/10/17 Release 3.9.4

- Tutorial for validation FHIR resources with [matchbox](https://ahdis.github.io/matchbox/validation-tutorial/)
- Gazelle reports: add test to ensure https://gazelle.ihe.net/jira/browse/EHS-831 is fixed
- Allow validating a resource through the GUI with URL search parameters [#288](https://github.com/ahdis/matchbox/issues/288)
- Terminology: support CodeableConcept in ValueSet/$validate operation [#291](https://github.com/ahdis/matchbox/issues/291)
- Upgrade hapifhir org.hl7.fhir.core to 6.3.32
- Validation: Tutorial for validating FHIR resources with [matchbox](https://ahdis.github.io/matchbox/validation-tutorial/)
- Validation: add button to copy a direct link to the validation [#296](https://github.com/ahdis/matchbox/issues/296)
- Validation: support additional validation parameters [#299](https://github.com/ahdis/matchbox/issues/299)
- Validation: Allow validating a resource through the GUI with URL search parameters [#288](https://github.com/ahdis/matchbox/issues/288)
- Validation: Terminology: support CodeableConcept in ValueSet/$validate operation [#291](https://github.com/ahdis/matchbox/issues/291)
- FML: Use FMLParser in StructureMapUtilities and support for identity transform [#289](https://github.com/ahdis/matchbox/issues/289)
- FML: FML transform performance tuning #264 (via @mrunibe)
- Validation: add button to copy a direct link to the validation [#296](https://github.com/ahdis/matchbox/issues/296)
- Gazelle reports: add test to ensure https://gazelle.ihe.net/jira/browse/EHS-831 is fixed
- Upgrade hapifhir org.hl7.fhir.core to 6.3.32

2024/10/07 Release 3.9.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.hl7.fhir.r5.renderers.spreadsheets.StructureDefinitionSpreadsheetGenerator;
import org.hl7.fhir.r5.renderers.spreadsheets.ValueSetSpreadsheetGenerator;
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
import org.hl7.fhir.r5.terminologies.client.TerminologyClientManager.InternalLogEvent;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.TimeTracker;
import org.hl7.fhir.utilities.Utilities;
Expand Down Expand Up @@ -148,7 +149,8 @@ public void validateSources(CliContext cliContext, ValidationEngine validator) t
ValidationOutputRenderer renderer = makeValidationOutputRenderer(cliContext);
renderer.setOutput(dst);
renderer.setCrumbTrails(validator.isCrumbTrails());

renderer.setShowMessageIds(validator.isShowMessageIds());

int ec = 0;

if (r instanceof Bundle) {
Expand Down Expand Up @@ -183,6 +185,20 @@ public void validateSources(CliContext cliContext, ValidationEngine validator) t
TextFile.stringToFile(html, cliContext.getHtmlOutput());
System.out.println("HTML Summary in " + cliContext.getHtmlOutput());
}

if (cliContext.isShowTerminologyRouting()) {
System.out.println("");
System.out.println("Terminology Routing Dump ---------------------------------------");
if (validator.getContext().getTxClientManager().getInternalLog().isEmpty()) {
System.out.println("(nothing happened)");
} else {
for (InternalLogEvent log : validator.getContext().getTxClientManager().getInternalLog()) {
System.out.println(log.getMessage()+" -> "+log.getServer()+" (for VS "+log.getVs()+" with systems '"+log.getSystems()+"', choices = '"+log.getChoices()+"')");
}
}
validator.getContext().getTxClientManager().getInternalLog().clear();
}

System.exit(ec > 0 ? 1 : 0);
}

Expand Down
45 changes: 45 additions & 0 deletions matchbox-server/src/main/java/ch/ahdis/matchbox/CliContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ public CliContext setExtensions(List<String> extensions) {
@JsonProperty("forPublication")
private boolean forPublication = false;

@JsonProperty("showMessageIds")
private boolean showMessageIds = false;

@JsonProperty("showTerminologyRouting")
private boolean showTerminologyRouting = false;

@JsonProperty("clearTxCache")
private boolean clearTxCache = false;

@JsonProperty("allowExampleUrls")
private boolean allowExampleUrls = true;

Expand Down Expand Up @@ -586,6 +595,30 @@ public void setForPublication(boolean forPublication) {
this.forPublication = forPublication;
}

public boolean isShowMessageIds() {
return showMessageIds;
}

public void setShowMessageIds(boolean showMessageIds) {
this.showMessageIds = showMessageIds;
}

public boolean isShowTerminologyRouting() {
return showTerminologyRouting;
}

public void setShowTerminologyRouting(boolean showTerminologyRouting) {
this.showTerminologyRouting = showTerminologyRouting;
}

public boolean isClearTxCache() {
return clearTxCache;
}

public void setClearTxCache(boolean clearTxCache) {
this.clearTxCache = clearTxCache;
}

public boolean isAllowExampleUrls() {
return allowExampleUrls;
}
Expand Down Expand Up @@ -635,6 +668,9 @@ public boolean equals(final Object o) {
&& securityChecks == that.securityChecks
&& crumbTrails == that.crumbTrails
&& forPublication == that.forPublication
&& showMessageIds == that.showMessageIds
&& showTerminologyRouting == that.showTerminologyRouting
&& clearTxCache == that.clearTxCache
&& allowExampleUrls == that.allowExampleUrls
&& onlyOneEngine == that.onlyOneEngine
&& xVersion == that.xVersion
Expand Down Expand Up @@ -677,6 +713,9 @@ public int hashCode() {
securityChecks,
crumbTrails,
forPublication,
showMessageIds,
showTerminologyRouting,
clearTxCache,
httpReadOnly,
allowExampleUrls,
htmlInMarkdownCheck,
Expand Down Expand Up @@ -732,6 +771,9 @@ public String toString() {
", securityChecks=" + securityChecks +
", crumbTrails=" + crumbTrails +
", forPublication=" + forPublication +
", showMessageIds=" + showMessageIds +
", showTerminologyRouting=" + showTerminologyRouting +
", clearTxCache=" + clearTxCache +
", allowExampleUrls=" + allowExampleUrls +
", locale='" + locale + '\'' +
", locations=" + locations +
Expand Down Expand Up @@ -771,6 +813,9 @@ public void addContextToExtension(final Extension ext) {
addExtension(ext, "securityChecks", new BooleanType(this.securityChecks));
addExtension(ext, "crumbTrails", new BooleanType(this.crumbTrails));
addExtension(ext, "forPublication", new BooleanType(this.forPublication));
addExtension(ext, "showMessageIds", new BooleanType(this.showMessageIds));
addExtension(ext, "showTerminologyRouting", new BooleanType(this.showTerminologyRouting));
addExtension(ext, "clearTxCache", new BooleanType(this.clearTxCache));
addExtension(ext, "httpReadOnly", new BooleanType(this.httpReadOnly));
addExtension(ext, "allowExampleUrls", new BooleanType(this.allowExampleUrls));
addExtension(ext, "txServer", new UriType(this.txServer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,15 @@ private void configureValidationEngine(final MatchboxEngine validator,
} catch (final Exception e) {
throw new TerminologyServerException("Error while setting the terminology server cache: " + getTxCachePath(cli.getTxServer()), e);
}

try {
if (cli.isClearTxCache()) {
validator.getContext().getTxCache().clear();
}
} catch (final Exception e) {
throw new TerminologyServerException("Error while setting while trying to clear the terminology cache", e);
}

}

validator.setDebug(cli.isDoDebug());
Expand Down Expand Up @@ -531,6 +540,7 @@ private void configureValidationEngine(final MatchboxEngine validator,
validator.setWantInvariantInMessage(cli.isWantInvariantsInMessages());
validator.setSecurityChecks(cli.isSecurityChecks());
validator.setCrumbTrails(cli.isCrumbTrails());
validator.setShowMessageIds(cliContext.isShowMessageIds());
validator.setForPublication(cli.isForPublication());
validator.setShowTimes(true);
validator.setAllowExampleUrls(cli.isAllowExampleUrls());
Expand Down

0 comments on commit 0da03d3

Please sign in to comment.