Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FML parsing improvement #324

Merged
merged 8 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2025/01/xx Release 3.9.10
- Performance improvement fml [#323](parsing https://github.com/ahdis/matchbox/issues/323)
- Update org.hl7.fhir.core to 6.5.4 and hapi-fhir to 7.6.1
- Update integration tests with correct url
- make autoinstall new ig [#325](https://github.com/ahdis/matchbox/issues/325)

2024/12/09 Release 3.9.9

- Upgrade org.hl7.fhir.core to 6.4.4 and hapi-fhir to 7.6.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public class MatchboxEngine extends ValidationEngine {
protected PassiveExpiringSessionCache sessionCache = new PassiveExpiringSessionCache();

static protected ValidationEngine nullEngine;

static protected SimpleWorkerContext fmlParseContext = null;


static {
try {
Expand Down Expand Up @@ -934,20 +937,17 @@ public IBaseResource getCanonicalResourceById(final String type, final @NonNull
* @return parsed StructureMap resource
* @throws FHIRException FHIR Exception
*/
public org.hl7.fhir.r5.model.StructureMap parseMapR5(String content) throws FHIRException {
SimpleWorkerContext context = null;
try {
context = this.getContextForFhirVersion("5.0.0");
} catch (FHIRException e) {
log.error("error creating context",e);
return null;
} catch (IOException e) {
log.error("error creating context",e);
return null;
public org.hl7.fhir.r5.model.StructureMap parseMapR5(String content) throws IOException, FHIRException {
if (MatchboxEngine.fmlParseContext == null) {
if ("5.0.0".equals(this.getContext().getVersion())) {
MatchboxEngine.fmlParseContext = this.getContext();
} else {
MatchboxEngine.fmlParseContext = MatchboxEngine.createR5WorkerContext();
}
}
List<Base> outputs = new ArrayList<>();
StructureMapUtilities scu = new MatchboxStructureMapUtilities(context,
new TransformSupportServices(context, outputs), this);
StructureMapUtilities scu = new MatchboxStructureMapUtilities(fmlParseContext,
new TransformSupportServices(fmlParseContext, outputs), this);
org.hl7.fhir.r5.model.StructureMap mapR5 = scu.parse(content, "map");
mapR5.getText().setStatus(NarrativeStatus.GENERATED);
mapR5.getText().setDiv(new XhtmlNode(NodeType.Element, "div"));
Expand All @@ -964,9 +964,10 @@ public org.hl7.fhir.r5.model.StructureMap parseMapR5(String content) throws FHIR
*
* @param content FHIR Mapping Language text
* @return parsed StructureMap resource
* @throws IOException FHIR Exception
* @throws FHIRException FHIR Exception
*/
public org.hl7.fhir.r4.model.StructureMap parseMap(String content) throws FHIRException {
public org.hl7.fhir.r4.model.StructureMap parseMap(String content) throws IOException, FHIRException {
org.hl7.fhir.r5.model.StructureMap mapR5 = parseMapR5(content);
return (org.hl7.fhir.r4.model.StructureMap) VersionConvertorFactory_40_50.convertResource(mapR5);
}
Expand Down

Large diffs are not rendered by default.

Loading
Loading