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

Refresh IG Group file POST addition & messaging improvements #506

Merged

Conversation

echicoine-icf
Copy link
Contributor

This pull request covers the following changes:

  • Refresh IG POST expanded to include other resources such as group files.
  • Duplicate bundle files during refresh fixed.
  • added -x as possible argument during Refresh IG to show expanded reporting for errors, warnings, and information messages.
    • Boolean "verboseMessaging" can be found throughout methods and when true, extra information is appended to output such as cql translation.
  • Bundle Test Cases enhanced with multithreading optimizations.
  • General enhancements to message output for readability.
  • Renamed AbstractResourceProcessor to AbstractBundler.
    • Decoupled MeasureProcessor from AbstractBundler, extends BaseProcessor
    • Created MeasureBundler, extends AbstractBundler
    • Renamed PlanDefinitionProcessor to PlanDefinitionBundler
    • Renamed QuestionnaireProcessor to QuestionnaireBundler
  • Improved readability and complexity behind IGBundleProcessor instantiation.
  • Adjusted CqlTranslatorException to use List
  • -Cql translation results adjusted for output such as:

image

  • Github Issue:
  • I've read the contribution guidelines
  • Code compiles without errors
  • Tests are created / updated
  • Documentation is created / updated

By creating this PR you acknowledge that your contribution will be licensed under Apache 2.0

Evan Chicoine added 7 commits December 13, 2023 20:01
Duplicate bundle files during refresh fixed.
-x added as possible argument during Refresh IG to show expanded reporting for errors, warnings, and information messages.
Bundle Test Cases enhanced with multithreading optimizations.
General enhancements to message output for readability.
…rious methods during bundling process, to relay exception messages to uusers
@echicoine-icf echicoine-icf changed the title Refresh messaging improvements Refresh IG Group file POST addition Dec 14, 2023
Copy link
Contributor

@ddieppois ddieppois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small changes regarding use of log/Sysout. Very interesting to see a massive refactoring and the new functionalities being more explained.

outputResourceTracker.put(resourceFileLocation, Boolean.TRUE);

} catch (IOException e) {
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a log.error

);
writer.flush();
} catch (IOException e) {
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here "log.error"

@@ -32,12 +40,6 @@
<artifactId>model-jackson</artifactId>
</dependency>

<dependency>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we apply this change on the main pom.xml and do a refactoring of logger to complete this ticket : #333 @JPercival ?

@@ -76,8 +78,7 @@ public List<String> refreshIgLibraryContent(BaseProcessor parentContext, Encodin
}

public List<String> refreshIgLibraryContent(BaseProcessor parentContext, Encoding outputEncoding, String libraryPath, String libraryOutputDirectory, Boolean versioned, FhirContext fhirContext, Boolean shouldApplySoftwareSystemStamp) {
System.out.println("Refreshing libraries...");
// ArrayList<String> refreshedLibraryNames = new ArrayList<String>();
System.out.println("\r\n[Refreshing Libraries]\r\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to use logger here


logger.info("Refreshing measures...");
System.out.println("\r\n[Refreshing Measures]\r\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger might be better here.

@@ -250,7 +249,7 @@ public LibraryManager getLibraryManager() {
}

private void translateFolder(String folder) {
logger.logMessage(String.format("Translating CQL source in folder %s", folder));
System.out.printf("Translating CQL source in folder %s%n", folder);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here for logger with a String format that uses "folder"

@@ -343,7 +342,7 @@ public static ValidationMessage exceptionToValidationMessage(File file, CqlCompi
}

private void translateFile(LibraryManager libraryManager, File file, CqlCompilerOptions options) {
logger.logMessage(String.format("Translating CQL source in file %s", file.toString()));
// logger.logMessage(String.format("Translating CQL source in file %s", file.toString()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated line

} catch (Exception ex) {
logger.logMessage(String.format("CQL Translation succeeded for file: '%s', but ELM generation failed with the following error: %s", file.getAbsolutePath(), ex.getMessage()));
}
}

//output Success/Warn/Info/Fail message to user:
System.out.println(buildStatusMessage(translator.getErrors(), file.getName(), verboseMessaging));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger might be better here


//run collected post calls last:
if (HttpClientUtils.hasPostTasksInQueue()) {
System.out.println("\r\n[POST task(s) found in queue. POST task(s) started - " + getTime() + "]");
System.out.println("\r\n[Persisting Files to " + fhirUri + "]\r\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggesting use of logger here instead of System.out.println

@@ -172,105 +172,109 @@ public void testIg(TestIGParameters params) {

CqfmSoftwareSystem testTargetSoftwareSystem = getCqfRulerSoftwareSystem(params.fhirServerUri);

logger.info("Running IG test cases...");
System.out.println("\r\n[Running IG Test Cases]\r\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggesting use of logger here for this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The decision to use plain System.out.println came from trying to keep the console readable for the users. Logger includes a big time stamp for every entry and can clutter the console window while we try to convey useful information to the user as it all flies by.

If that sort of thing isn't as necessary as I previously thought I can revert these to use logger.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log format can be configured, and it's possible to simultaneously have different formats for different targets. For example, simple output that's redirected to the CLI output, and verbose output/formatting going to a log file. That is a separate level of configuration that's needed, but routing messaging through the logger API allows that type of configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me! I'll go ahead and adjust this to use the logger and we can revisit cleaning up the format

@echicoine-icf
Copy link
Contributor Author

Logger is now used over System.out

@echicoine-icf echicoine-icf changed the title Refresh IG Group file POST addition Refresh IG Group file POST addition & messaging improvements Mar 1, 2024
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 52.98246% with 402 lines in your changes are missing coverage. Please review.

Project coverage is 20.99%. Comparing base (d395b04) to head (69091a7).

❗ Current head 69091a7 differs from pull request most recent head 3999567. Consider uploading reports for the commit 3999567 to get more accurate results

Files Patch % Lines
...opencds/cqf/tooling/processor/AbstractBundler.java 58.05% 72 Missing and 27 partials ⚠️
...encds/cqf/tooling/processor/TestCaseProcessor.java 46.82% 58 Missing and 9 partials ⚠️
...opencds/cqf/tooling/utilities/HttpClientUtils.java 45.00% 63 Missing and 3 partials ⚠️
...opencds/cqf/tooling/processor/IGTestProcessor.java 0.00% 54 Missing ⚠️
...g/opencds/cqf/tooling/utilities/ResourceUtils.java 62.00% 16 Missing and 3 partials ⚠️
.../tooling/cql/exception/CqlTranslatorException.java 0.00% 16 Missing ⚠️
...va/org/opencds/cqf/tooling/common/ThreadUtils.java 45.83% 11 Missing and 2 partials ⚠️
...f/tooling/processor/PostBundlesInDirProcessor.java 0.00% 12 Missing ⚠️
...org/opencds/cqf/tooling/processor/IGProcessor.java 66.66% 9 Missing and 2 partials ⚠️
...rg/opencds/cqf/tooling/measure/MeasureBundler.java 75.60% 5 Missing and 5 partials ⚠️
... and 10 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #506      +/-   ##
============================================
+ Coverage     20.85%   20.99%   +0.13%     
- Complexity     1494     1520      +26     
============================================
  Files           282      283       +1     
  Lines         24090    24300     +210     
  Branches       3832     3867      +35     
============================================
+ Hits           5024     5101      +77     
- Misses        18221    18351     +130     
- Partials        845      848       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bryantaustin13 bryantaustin13 self-assigned this Mar 18, 2024
@bryantaustin13 bryantaustin13 self-requested a review March 18, 2024 20:23
@JPercival JPercival enabled auto-merge (squash) March 18, 2024 20:23
Copy link
Contributor

@bryantaustin13 bryantaustin13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JPercival JPercival merged commit dca1a3d into cqframework:master Mar 18, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants