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

cqf-tooling issue with Bundle Extraction #537

Open
reza-smilecdr opened this issue Nov 4, 2024 · 5 comments
Open

cqf-tooling issue with Bundle Extraction #537

reza-smilecdr opened this issue Nov 4, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@reza-smilecdr
Copy link

reza-smilecdr commented Nov 4, 2024

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

  • OS: Windows 10 Business
  • Java Version: "17.0.10" 2024-01-16 LTS

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

@reza-smilecdr reza-smilecdr added the bug Something isn't working label Nov 4, 2024
@reza-smilecdr
Copy link
Author

reza-smilecdr commented Nov 18, 2024

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
Copy link
Contributor

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
Copy link
Contributor

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

@echicoine-icf
Copy link
Contributor

No problem! I can look into it immediately.

@echicoine-icf
Copy link
Contributor

@c-schuler a PR has been created here: #539

This change enhances how we establish the bundles folder and it's corresponding parent folder, and if such checks don't pass, the process will use the location of the bundle file itself as the location to output the extraction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants