Skip to content

Commit

Permalink
support for bundle option #348
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveregger committed Feb 18, 2025
1 parent 26d6235 commit 0476e04
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [




Expand Down Expand Up @@ -86,6 +87,15 @@
"vmArgs": "-Dspring.config.additional-location=file:with-elm/application.yaml",
"cwd": "${workspaceFolder}/matchbox-server"
},
{
"type": "java",
"name": "Launch Matchbox-Server (ips)",
"request": "launch",
"mainClass": "ca.uhn.fhir.jpa.starter.Application",
"projectName": "matchbox-server",
"vmArgs": "-Dspring.config.additional-location=file:with-ips/application.yaml",
"cwd": "${workspaceFolder}/matchbox-server"
},
{
"type": "java",
"name": "Launch Matchbox-Server (ch)",
Expand Down
3 changes: 2 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Unreleased
2025/03/xx Release 3.9.13

- No more GUI version mismatch [#346](https://github.com/ahdis/matchbox/issues/346)
- Support for bundle option to validate directly a resource within the bundle [#348](https://github.com/ahdis/matchbox/issues/348)

2025/02/05 Release 3.9.12

Expand Down
39 changes: 34 additions & 5 deletions matchbox-server/src/main/java/ch/ahdis/matchbox/CliContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,16 @@ public CliContext setExtensions(List<String> extensions) {
// @JsonProperty("outputStyle")
// private String outputStyle = null;

// TODO: Mark what goes here?
// private List<BundleValidationRule> bundleValidationRules = new ArrayList<>();

@JsonProperty("jurisdiction")
private String jurisdiction = JurisdictionUtilities.getJurisdictionFromLocale(Locale.getDefault().getCountry());

@JsonProperty("check-ips-codes")
private boolean checkIpsCodes = false;

@JsonProperty("bundle")
private String bundle = null;


private String igsPreloaded[];

public String[] getIgsPreloaded() {
Expand Down Expand Up @@ -686,6 +690,23 @@ public void setDisableDefaultResourceFetcher(boolean disableDefaultResourceFetch
this.disableDefaultResourceFetcher = disableDefaultResourceFetcher;
}

public boolean isCheckIpsCodes() {
return this.checkIpsCodes;
}

@JsonProperty("check-ips-codes")
public void setCheckIpsCodes(boolean checkIpsCodes) {
this.checkIpsCodes = checkIpsCodes;
}

public String getBundle() {
return this.bundle;
}

@JsonProperty("bundle")
public void setBundle(String bundle) {
this.bundle = bundle;
}

@Override
public boolean equals(final Object o) {
Expand Down Expand Up @@ -735,7 +756,9 @@ public boolean equals(final Object o) {
&& Arrays.equals(igsPreloaded, that.igsPreloaded)
&& checkReferences == that.checkReferences
&& Objects.equals(resolutionContext, that.resolutionContext)
&& disableDefaultResourceFetcher == that.disableDefaultResourceFetcher;
&& disableDefaultResourceFetcher == that.disableDefaultResourceFetcher
&& checkIpsCodes == that.checkIpsCodes
&& bundle == that.bundle;
}

@Override
Expand Down Expand Up @@ -781,7 +804,9 @@ public int hashCode() {
xVersion,
checkReferences,
resolutionContext,
disableDefaultResourceFetcher);
disableDefaultResourceFetcher,
checkIpsCodes,
bundle);
result = 31 * result + Arrays.hashCode(igsPreloaded);
return result;
}
Expand Down Expand Up @@ -832,6 +857,8 @@ public String toString() {
", checkReferences=" + checkReferences +
", resolutionContext=" + resolutionContext +
", disableDefaultResourceFetcher=" + disableDefaultResourceFetcher +
", checkIpsCodes=" + checkIpsCodes +
", bundle=" + bundle +
'}';
}

Expand Down Expand Up @@ -887,6 +914,8 @@ public void addContextToExtension(final Extension ext) {
addExtension(ext, "check-references", new BooleanType(this.checkReferences));
addExtension(ext, "resolution-context", new StringType(this.resolutionContext));
addExtension(ext, "disableDefaultResourceFetcher", new BooleanType(this.disableDefaultResourceFetcher));
addExtension(ext, "check-ips-codes", new BooleanType(this.checkIpsCodes));
addExtension(ext, "bundle", new StringType(this.bundle));
for( var extension : this.extensions) {
addExtension(ext, "extensions", new StringType(extension));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,18 @@ private void configureValidationEngine(final MatchboxEngine validator,
validator.setForPublication(cli.isForPublication());
validator.setShowTimes(true);
validator.setAllowExampleUrls(cli.isAllowExampleUrls());

validator.setCheckIPSCodes(cli.isCheckIpsCodes());
if (cli.getBundle() != null) {
validator.setQuestionnaireMode(cli.getQuestionnaireMode());
String[] bundle = cli.getBundle().split(" ");
if (bundle.length != 2) {
log.error("Bundle parameter must have two values, the rule and the profile, ignoring the bundle parameter");
} else {
String rule = bundle[0];
String profile = bundle[1];
validator.getBundleValidationRules().add(new org.hl7.fhir.r5.utils.validation.BundleValidationRule().setRule(rule).setProfile(profile));
}
}
if (!cli.isDisableDefaultResourceFetcher()) {
StandAloneValidatorFetcher fetcher = new StandAloneValidatorFetcher(validator.getPcm(), validator.getContext(),
validator);
Expand All @@ -568,7 +579,6 @@ private void configureValidationEngine(final MatchboxEngine validator,
// validator.setPolicyAdvisor(fetcher);
// refpol = ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS;
}
// validator.getBundleValidationRules().addAll(cliContext.getBundleValidationRules());
validator.setJurisdiction(CodeSystemUtilities.readCoding(cli.getJurisdiction()));
// TerminologyCache.setNoCaching(cliContext.isNoInternalCaching());

Expand Down
28 changes: 28 additions & 0 deletions matchbox-server/with-ips/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
server:
port: 8080
servlet:
context-path: /matchboxv3
hapi:
fhir:
server_address: http://localhost:8080/matchboxv3/fhir
implementationguides:
fhir_r4_core:
name: hl7.fhir.r4.core
version: 4.0.1
url: classpath:/hl7.fhir.r4.core.tgz
fhir_terminology:
name: hl7.terminology.r4
version: 6.2.0
url: classpath:/hl7.terminology.r4#6.2.0.tgz
fhir_extensions:
name: hl7.fhir.uv.extensions.r4
version: 1.0.0
url: classpath:/hl7.fhir.uv.extensions.r4#1.0.0.tgz
ch-ips:
name: hl7.fhir.uv.ips
version: 1.1.0
matchbox:
fhir:
context:
fhirVersion: 4.0.1
txServer: http://tx.fhir.org

0 comments on commit 0476e04

Please sign in to comment.