Skip to content

Temporal annual distribution functionality#271

Merged
ginberg merged 12 commits intoOHDSI:developfrom
odysseusinc:temporal-annual-distribution
Mar 19, 2025
Merged

Temporal annual distribution functionality#271
ginberg merged 12 commits intoOHDSI:developfrom
odysseusinc:temporal-annual-distribution

Conversation

@alex-odysseus
Copy link

Supporting OHDSI/WebAPI#2331 to enable temporal annual distribution extending the existing temporal functionality

Temporal annual distribution will be effective for Feature Analyses specified in newly added PrespecTemporalAnnualAnalysis.csv

The idea of the functionality is to extract an underlying year for a Covariate of interest so that it can be easily grouped by in Cohort Characterization result visualization in WebAPI / ATLAS

Minor refactoring using Stream and StreamSupport classes

Standard Java formatting applied in a few places (hopefully acceptable)

Referencing SqlRender 1.18.1 in pom.xml

Targeting feature for 3.7.0 (for an unknown reason there is still 3.5.1-SNAPSHOT in 'develop' pom.xml even though 3.6.0 has been officially released

wivern and others added 5 commits February 21, 2024 19:09
Referencing SqlRender 1.18.1

Version 3.7.0-SNAPSHOT as 3.6.0 has been released even though there were no changes to pom.xml

Merge remote-tracking branch 'remotes/origin/ATL-10' into develop

# Conflicts:
#	inst/java/featureExtraction-3.3.0-SNAPSHOT.jar
#	java/org/ohdsi/featureExtraction/FeatureExtraction.java
@alex-odysseus
Copy link
Author

@anthonysena Anthony, I can't assign reviewers, please do so

@anthonysena anthonysena self-assigned this Sep 9, 2024
Copy link
Collaborator

@anthonysena anthonysena left a comment

Choose a reason for hiding this comment

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

@alex-odysseus - I've provided some feedback on this PR for your review. I have not reviewed the other associated PRs so I'm unsure of the impact this proposed change would have on this feature. That said, here is my feedback:

  1. We need to make sure any enhancements to FeatureExtraction are done so that users from the R side can access this functionality. As it currently stands, I don't see a way that an R user could invoke this functionality.
  2. I think we can simplify the way in which this feature is invoked by simply passing in an option to perform the annual distribution as noted in the comments.
  3. All R command checks and unit tests must pass for this to be considered in a state for merging into the develop branch.

Thanks!

row_id,
1 AS covariate_value
}
{@temporal_annual} ? {, event_year}
Copy link
Collaborator

@anthonysena anthonysena Sep 9, 2024

Choose a reason for hiding this comment

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

The temporal_annual appears to be the way in which a user would indicate to FeatureExtraction to compute the annual distribution yet this parameter is never exposed to the user best I can tell. In reviewing the code, the approach appears to be: specify the analysis IDs in the PrespecTemporalAnnualAnalysis.csv and then the Java layer will then inject the temporal_annual parameter value.

Copy link
Author

Choose a reason for hiding this comment

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

PrespecTemporalAnnualAnalysis.csv contains Feature Analysis entries (for instance, demographics related) which were intentionally omit in a new CSV file being created

In OHDSI/SkeletonCohortCharacterization#46 CCBuilder.buildSettings there are separate Maps for that reason not to mix up

I would propose to leave it separate

@anthonysena
Copy link
Collaborator

@alex-odysseus thanks for reviewing this with me on Atlas/WebAPI WG call. Here are some specific tasks from our discussion:

  • Remove inst/csv/PrespecTemporalAnnualAnalysis.csv as it is redundant with the analyses already defined in the package.
  • Add an annualPrevalence parameter to the getDbCovariateData function to expose the ability to compute the annual prevalence. Make sure this is passed to the Java layer so it can properly pass this to the SQL layer...
  • Tidy up the Java class based on the feedback above. For the createQuerySql function of that class, expose an annualPrevalence parameter to enable passing in the parameter from R and the SkeletonCohortCharacterization layers respectively.

@chrisknoll
Copy link
Contributor

The main outstanding issue is that R-CMD-Check is not passing, so we can merge this in once the errors are cleared.

@anthonysena
Copy link
Collaborator

I'll also note that this will be a Java-only enabled feature until we find a use-case for this in the R side.

…-annual-distribution

# Conflicts:
#	java/org/ohdsi/featureExtraction/FeatureExtraction.java
#	pom.xml
temporalSequence = jsonObject.getBoolean(TEMPORAL_SEQUENCE);
} catch(Exception e) {}
boolean temporal = jsonObject.getBoolean(TEMPORAL);
boolean temporalAnnual = jsonObject.has(TEMPORAL_ANNUAL) && jsonObject.getBoolean(TEMPORAL_ANNUAL);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unit tests are failing since the TEMPORAL_ANNUAL parameter is not found in the jsonObject. I'd suggest wrapping it in a try/catch as was done for TEMPORAL_SEQUENCE (see a few lines above it). You'll also want to make sure the FeatureExtraction .jar file is recreated once you've made those changes.

Copy link
Author

Choose a reason for hiding this comment

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

Anthony, it is rather a workaround not to adapt the existing tests

For some reason
boolean temporal = jsonObject.getBoolean(TEMPORAL);
doesn't fail

Catching an exception and not having any log entry might be dangerous in the future while troubleshooting

alex-odysseus added 2 commits February 24, 2025 19:55
Referencing SqlRender 1.19.1
Targeting the 3.8.0 release
@alex-odysseus
Copy link
Author

Anthony, could you please check why some of the tests are still failing, for example test-GetCohortBasedCovariates? @anthonysena

Or test-FeatureExtractionInternal onLoad is expected to be silent

Is it possible that a version of SqlRender has an impact?

alex-odysseus added 2 commits February 24, 2025 21:01
@alex-odysseus
Copy link
Author

Anthony, Finally, I found a bug, thanks to tests! @anthonysena

So only one is failing, please help

── Failure ('test-FeatureExtractionInternal.R:6:3'): Test .onLoad() ────────────
FeatureExtraction:::.onLoad(libname = "FeatureExtraction", pkgname = "FeatureExtraction") produced warnings.

@anthonysena
Copy link
Collaborator

Nicely done @alex-odysseus! So for the last error, this is due to the jarChecksum.txt being out-of-date. Could you update it using the following code: https://github.com/OHDSI/FeatureExtraction/blob/main/extras/PackageMaintenance.R#L87-L88 and then commit the updated inst/csv/jarChecksum.txt?

@alex-odysseus
Copy link
Author

Anthony and Chris, I am getting a strange error, when I use a simple Java program to generate a checksum


import org.ohdsi.featureExtraction.JarChecksum;

public class JarChecksumGenerator {

	public static void main(String[] args) {
		System.out.println(JarChecksum.computeJarChecksum());

	}

}
java.io.FileNotFoundException: <my-source-folder-here>\FeatureExtraction\target\classes (Access is denied)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.ohdsi.featureExtraction.JarChecksum.computeJarChecksum(JarChecksum.java:29)
	at JarChecksumGenerator.main(JarChecksumGenerator.java:6)

Could you, please, try to generate it on your end? @anthonysena @chrisknoll

@oleg-odysseus
Copy link
Contributor

Hi @anthonysena @chrisknoll , could you please take a look (I`ve generated the checksum for the jar file) and merge if windows/ubuntu images check is sufficient (mac failed due to a memory limit issue) and if you have no other objections. Thank you.

@anthonysena
Copy link
Collaborator

@oleg-odysseus this looks good and the Mac error has been noted in #294 so I think we're set to merge this. Let me just tag @ginberg for awareness and we'll work to get this into a release.

@ginberg ginberg added this to the v3.8.0 milestone Mar 19, 2025
@ginberg ginberg merged commit 3f0b2f1 into OHDSI:develop Mar 19, 2025
3 of 4 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.

6 participants