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

LUI-197 UI for saving concept reference ranges #196

Open
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

dicksonmulli
Copy link

@dicksonmulli dicksonmulli commented Aug 27, 2024

@dkayiwa
Copy link
Member

dkayiwa commented Aug 27, 2024

Do you have a screenshot of how this looks like?

@dicksonmulli
Copy link
Author

Do you have a screenshot of how this looks like?

It's not showing up yet. I have am using the current built version. Am I missing something?

@dkayiwa
Copy link
Member

dkayiwa commented Aug 27, 2024

Do you try compile and update the module install?

@dicksonmulli
Copy link
Author

Screenshot : When no reference ranges added:

Screenshot 2024-09-02 at 16 43 53

Screenshot: Reference ranges:

Screenshot 2024-09-02 at 16 45 40

Screenshot: Concept screen:

Screenshot 2024-09-02 at 16 46 45

@dkayiwa
Copy link
Member

dkayiwa commented Sep 4, 2024

@dicksonmulli in the hibernate mapping file, did you try map concept reference ranges the same way as concept mappings?

@dicksonmulli
Copy link
Author

@dicksonmulli in the hibernate mapping file, did you try map concept reference ranges the same way as concept mappings?

Yes, but I am still getting the same error : org.hibernate.exception.ConstraintViolationException: could not execute batch

@dkayiwa
Copy link
Member

dkayiwa commented Sep 5, 2024

Yes, but I am still getting the same error : org.hibernate.exception.ConstraintViolationException: could not execute batch

What value do you have in the cascade attribute for referenceRanges?

@dicksonmulli
Copy link
Author

What value do you have in the cascade attribute for referenceRanges?

I changed to all,delete-orphan,evict but I was experiencing the same error. I however got it to work by adding inverse="true" 👍

@dicksonmulli dicksonmulli changed the title [WIP] LUI-197 UI for saving concept reference ranges LUI-197 UI for saving concept reference ranges Sep 22, 2024
@dkayiwa
Copy link
Member

dkayiwa commented Sep 25, 2024

@dicksonmulli i think we have one more remaining bug here.
Add a first reference range row, then add a second one, and then remove the first one, finally save the concept. You will get an ugly error.

@dicksonmulli
Copy link
Author

@dicksonmulli i think we have one more remaining bug here. Add a first reference range row, then add a second one, and then remove the first one, finally save the concept. You will get an ugly error.

Fixed now.

@dkayiwa
Copy link
Member

dkayiwa commented Sep 28, 2024

@dicksonmulli did you forget to make the commit?

@dkayiwa
Copy link
Member

dkayiwa commented Sep 29, 2024

@dicksonmulli i have noticed that the order of insertion of reference ranges is preserved only when they are added to an existing concept. But when you create a new one and immediately add the reference ranges before saving it, the order is not preserved.

@dkayiwa
Copy link
Member

dkayiwa commented Oct 3, 2024

@dicksonmulli i also noticed that when i run this on platform versions before 2.7, i get this in the logs when i save a concept: https://pastebin.com/wcDCXc8P

Secondly, i also see the Reference Ranges label together with the Add a Reference Range button yet these are supposed to show only on platform 2.7 and above.

@dicksonmulli
Copy link
Author

i also noticed that when i run this on platform versions before 2.7, i get this in the logs when i save a concept: https://pastebin.com/wcDCXc8P

Yes, this is is the expected behaviour because we are catching the exception incase the version is not compatible - so that the application will not fail to run. However, we can change the log from error to info if that is okay.

@dkayiwa
Copy link
Member

dkayiwa commented Oct 4, 2024

Two things:

  1. The add reference ranges label and button should not be visible to lower versions of the platform.

  2. There is totally nothing wrong with someone running versions of the platform lower than 2.7 and hence it does not add value to clutter logs with this, even a mere logging of info does not help in any way.

setMethodValue(cn, "removeReferenceRange", platformReferenceRange);
}
catch (Exception exception) {
logger.warn("Failed to remove concept reference range. "
Copy link
Member

@dkayiwa dkayiwa Oct 8, 2024

Choose a reason for hiding this comment

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

The logs will be filled with many of these warnings for those running platform versions lower than 2.7
I do not find it a good practice to fill logs with such warnings when there is completely nothing wrong about running lower versions of the platform.

* @return true if current version is greater or equal to 2.7.0 and false otherwise
* @since 1.17.0
*/
public static boolean isTwoPointSevenAndAbove() {
Copy link
Member

Choose a reason for hiding this comment

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

This is cimplicated and brittle. Why don't you use the same trick of trying to load a class like concept reference range which was added in 2.7?

Copy link
Author

Choose a reason for hiding this comment

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

This boolean is used in UI/JSP hence the need to check the version instead of loading a particular class. I think this will be reliable as long as we have the version constant(s).

Copy link
Member

Choose a reason for hiding this comment

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

We can still have a boolean with loading a particular class.

public static boolean isTwoPointSevenAndAbove() {
try {
Class<?> referenceRangeClass = Class.forName("org.openmrs.ConceptReferenceRange");
referenceRangeClass.getMethod("getCriteria");
Copy link
Member

@dkayiwa dkayiwa Oct 17, 2024

Choose a reason for hiding this comment

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

What value does line 85 add? Do we have cases where that class exists but not the method?

@dkayiwa
Copy link
Member

dkayiwa commented Oct 18, 2024

@dicksonmulli i have noticed that with the changes in this pull request, when i am creating a new concept, the Set Members textarea is displayed even before clicking the Is Set checkbox. Do you mind correcting that?

@dkayiwa
Copy link
Member

dkayiwa commented Oct 18, 2024

@dicksonmulli and FWIW, this incorrect display happens only on platform versions lower than 2.7

@dkayiwa
Copy link
Member

dkayiwa commented Oct 24, 2024

@dicksonmulli now when a concept is saved with the Is Set checkbox clicked, on opening it again, the textarea for set members is no longer displayed by default. This problem happens only on platform versions below 2.7

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