Skip to content

Support creation of records while not being assigned to any institution#101

Open
palagdan wants to merge 16 commits into
mainfrom
302-create-records-without-institution
Open

Support creation of records while not being assigned to any institution#101
palagdan wants to merge 16 commits into
mainfrom
302-create-records-without-institution

Conversation

@palagdan

Copy link
Copy Markdown
Collaborator

Resolve partially kbss-cvut/record-manager-ui#302.

@blcham blcham left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I refactored your code; see the last commit. Have a look and if you don't like it revert it, but i would like to address issues described there.

Comment thread src/main/java/cz/cvut/kbss/study/persistence/dao/PatientRecordDao.java Outdated
Comment thread src/main/java/cz/cvut/kbss/study/util/Configuration.java Outdated
Comment thread src/test/java/cz/cvut/kbss/study/rest/PatientRecordControllerTest.java Outdated
}
}

protected void validateRecordsAgainstCollisions(User toUpdate, User original) {

@blcham blcham Oct 31, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@palagdan, look at my last commit. I had the following issues:

    1. to me, variable names were not correct, e.g,. newInsitutionRecords ==> existingInstitutionRecords
    1. although not that important -- algorithm was of higher complexity than needed because of comparing every label with every other label, i.e., on average O(N^2) instead of O(N) on average
    1. IMPORTANT: I wanted to have a more detailed message on errors (although we don't have parametrized so we cannot navigate from the message to actual conflicting records but I would like to get there someday :)
    1. IMPORTANT: patient records --> records (we have technical debt there :( )

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • I think there might be problem within UI how to show this message due to \n in the message and how it is interpreted in HTML (did not test it)

@blcham blcham Oct 31, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if you don't like the solution, revert it and address please at least IMPORTANT bullets.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I like this solution :)

@palagdan
palagdan force-pushed the 302-create-records-without-institution branch from 909a706 to d3a0c55 Compare November 1, 2025 10:34
@palagdan
palagdan requested a review from blcham November 1, 2025 10:34
@palagdan
palagdan force-pushed the 302-create-records-without-institution branch 2 times, most recently from 967efab to 4081254 Compare November 2, 2025 12:13
palagdan and others added 14 commits March 17, 2026 15:47
…records without being assigned to any institution
… separate function and implement record collision validation
…nstitution

Records without an institution will throw NPE during save/update instead of being allowed through.
Records without an institution were excluded from paginated results because
?hasInstitution ?institution was a required triple. Made it OPTIONAL and
wrapped the GRAPH ?institutionGraph lookup in OPTIONAL as well.
…date to use URI equality

Reference equality (!=) always evaluated to true when comparing deserialized
request body institution against a DB-fetched institution, causing records to
be unnecessarily migrated on every user update. Compare by URI instead.
@blcham
blcham force-pushed the 302-create-records-without-institution branch from f7dbf08 to a318a13 Compare March 17, 2026 14:47
@blcham
blcham force-pushed the 302-create-records-without-institution branch from 183a59d to 8ca98f9 Compare March 19, 2026 04:24
@blcham
blcham force-pushed the 302-create-records-without-institution branch from 8ca98f9 to 38b926a Compare March 19, 2026 04:36

@blcham blcham left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed and it looks ok, but testing it locally showed multiple issues that needs to be solved first, follow the test scenario:

    1. substitute RM with current branch
    1. add user without institution
    1. add a record (should be success) (related issue -- #106)
    1. set records.allowedCreationWithoutInstitution: false
    1. add a record (should be fail)
    1. set user an organization (his records should migrate as well)

@blcham blcham self-assigned this Mar 19, 2026
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