cqframework / cqf-tooling

Tooling for CQL and IG Authors
Apache License 2.0
19 stars 23 forks source link

cqf-tooling issue with Bundle Extraction #537

Open reza-smilecdr opened 2 weeks ago

reza-smilecdr commented 2 weeks ago

an error occurred while attempting to extract a MAT bundle "CMS124FHIR-v0-0-005-FHIR-4-0-1.json" , attached, using cqf-tooling (tooling-cli-3.6.0.jar).

Steps to reproduce the behavior:

  1. download the jar file tooling-cli-3.6.0.jar

  2. copy MAT bundle and jar file into the same directory and change to the directory (make sure java has been installed on the local Windows machine)

  3. Run with command ' java -jar "tooling-cli-3.6.0.jar" -ExtractMatBundle "CMS124FHIR-v0-0-005-FHIR-4-0-1.json" -v=r4

  4. Looks as result 'Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 26 at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4608) at java.base/java.lang.String.substring(String.java:2711) at org.opencds.cqf.tooling.operation.ExtractMatBundleOperation.moveAndRenameFiles(ExtractMatBundleOperation.java:301) at org.opencds.cqf.tooling.operation.ExtractMatBundleOperation.processSingleFile(ExtractMatBundleOperation.java:265) at org.opencds.cqf.tooling.operation.ExtractMatBundleOperation.execute(ExtractMatBundleOperation.java:144) at org.opencds.cqf.tooling.cli.Main.main(Main.java:303) ... 8 more'

We expect to extract FHIR resources plus cql files

CMS124FHIR-v0-0-005-FHIR-4-0-1.json

reza-smilecdr commented 8 hours ago

Looks like it works as expected on MAC if the path includes '/bundles', This is likely due to an expectation for use with IG repository directory structure. thanks @c-schuler for his time on this issue.

However, I tested it on Windows and Linux(Ubuntu) but it ended up with empty subfolders for the input folder.

Windows as an administrator: java -jar "C:\Workspace\Alphora\Tools\MATExtraction\tooling-cli-3.6.0.jar" -ExtractMatBundle "C:\Workspace\Alphora\Tools\MATExtraction\bundles\CMS124FHIR-v0-0-005-FHIR-4-0-1.json" -op="C:\Workspace\Alphora\Tools\MATExtraction\bundles" -v=r4

Linux as a root account: sudo java -jar /home/reza/bundles/tooling-cli-3.6.0.jar -ExtractMatBundle /home/reza/bundles/CMS124FHIR-v0-0-005-FHIR-4-0-1.json -v=r4

FWIW, it is not a blocker for HEDIS extraction as I do part of the process using Python on Windows to complete the extraction. cc: @jbyrdevans

c-schuler commented 7 hours ago

Thanks @reza-smilecdr ! I will look further into this issue and repro on a Windows environment to ensure compatibility.

To outline potential improvements to the operation, the following enhancements are recommended:

  1. Eliminate the assumption that an IG directory structure will always be present.
  2. Use a trusted library for all file path manipulations to ensure consistent cross-platform support.
  3. Enhance and expand the test suite to improve coverage and robustness.
  4. Document the tooling’s limitations, specifically detailing the minimal permissions required to successfully generate output.
c-schuler commented 7 hours ago

@echicoine-icf as it appears that you are the main developer for this bit of tooling, I would appreciate your input.

echicoine-icf commented 7 hours ago

No problem! I can look into it immediately.