Skip to content

Update to Platform 2.7.3 and Support Java 21#13

Merged
dkayiwa merged 1 commit intoopenmrs:masterfrom
wikumChamith:CALC-58
Apr 1, 2025
Merged

Update to Platform 2.7.3 and Support Java 21#13
dkayiwa merged 1 commit intoopenmrs:masterfrom
wikumChamith:CALC-58

Conversation

@wikumChamith
Copy link
Copy Markdown
Member

@wikumChamith wikumChamith requested a review from dkayiwa March 26, 2025 14:02
@wikumChamith wikumChamith force-pushed the CALC-58 branch 2 times, most recently from e3137f8 to d7d5494 Compare March 26, 2025 14:04
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>legacyui-omod</artifactId>
<version>1.22.0</version>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't we add scope?

api/pom.xml Outdated
<artifactId>groovy-all</artifactId>
<groupId>org.openmrs.module</groupId>
<artifactId>reportingcompatibility-api</artifactId>
<version>2.0.6</version>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't we add scope?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added the scope

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking at this again, do you mean the calculation module depends on the reportingcompatibility module?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

PatientSetService was removed in OpenMRS Platform 2.0.0, so I used the reporting compatibility module to replace it.

Replaced:

Context.getPatientSetService().getObservations(new Cohort(cohort), whichConcept);

with

Context.getService(ReportingCompatibilityService.class).getObservations(new Cohort(cohort), whichConcept);

https://openmrs.atlassian.net/browse/TRUNK-4874
https://talk.openmrs.org/t/we-should-remove-patientsetservice-in-openmrs-core-in-platform-2-0/6173

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The calculation module is supposed to be very light weight and hence should not depend on the reporting compatibility module. The reportingcompatibilty module is being deprecated.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@dkayiwa I removed the reporting compatibility module from this

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Mar 27, 2025

We are also going to bump the major version on the master branch and create a new branch for older versions of the platform.

@wikumChamith
Copy link
Copy Markdown
Member Author

We are also going to bump the major version on the master branch and create a new branch for older versions of the platform.

should we create a separate PR for that?

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Mar 27, 2025

We are also going to bump the major version on the master branch and create a new branch for older versions of the platform.

should we create a separate PR for that?

We can do the version bump as part of this pull request. What do you think about it?

@wikumChamith
Copy link
Copy Markdown
Member Author

wikumChamith commented Mar 27, 2025

We are also going to bump the major version on the master branch and create a new branch for older versions of the platform.

should we create a separate PR for that?

We can do the version bump as part of this pull request. What do you think about it?

I agree. What is the name I should give for the legacy branch? For now, I created a branch called master-2.x. We could change the name if you don't like it.

https://github.com/openmrs/openmrs-module-calculation/tree/master-2.x

@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Mar 27, 2025

Can you follow the same branch naming convention as we have done before?

@wikumChamith
Copy link
Copy Markdown
Member Author

I updated the name to 1.x

}

private Map<Integer, List<Obs>> getObservations(Cohort cohort, Concept concept) {
if (cohort == null || concept == null || cohort.getMemberIds().isEmpty()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't getMemberIds deprecated?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@dkayiwa I updated this.

</dependency>

<dependency>
<groupId>org.codehaus.groovy</groupId>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason why you changed it from org.codehaus.groovy?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, org.codehaus.groovy has been relocated to org.apache.groovy. https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Which one are we using in platform 2.7.3?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

org.codehaus.groovy:2.4.21. Should I update it there or remove it from here?

https://github.com/openmrs/openmrs-core/blob/02babbcd3d63f717d3f1a118e790b5b957dfa11d/api/pom.xml#L244-L248

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can update the one in core

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you also update the version?

<groupId>org.apache.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovyVersion}</version>
<type>jar</type>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The same goes for changing jar to pom

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@wikumChamith wikumChamith force-pushed the CALC-58 branch 2 times, most recently from 28b876b to bf8b10d Compare March 31, 2025 13:18
return Collections.emptyMap();
}

return cohort.getMemberships().stream()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I find this to be a very inefficient replacement when compared to the original implementation: https://github.com/openmrs/openmrs-core/blob/1.12.x/api/src/main/java/org/openmrs/api/db/hibernate/HibernatePatientSetDAO.java#L1092-L1141

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

should we update this to do a Hibernate query?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Whatever you find better than the current code.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@dkayiwa, does performance matter much in this case since it's only used in tests?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That is a very good point and you are indeed correct. 😊

@dkayiwa dkayiwa merged commit 58a8541 into openmrs:master Apr 1, 2025
1 check passed
@dkayiwa
Copy link
Copy Markdown
Member

dkayiwa commented Jun 9, 2025

@wikumChamith can you add the rest of the Java versions?

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.

2 participants