-
Notifications
You must be signed in to change notification settings - Fork 47
Adding db column for satellite_lab_name and UI changes for using Satellite Name instead of Id #143
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
Conversation
dishahpatel
commented
Apr 6, 2025
- Adding new columns for satellite lab name to the user and patient tables
- Updating the user creation and user update forms to include Satellite Lab Name
- Updating the patient creation form to display satellite lab name instead of satellite lab id
- Updating the patient update form to display satellite lab name instead of satellite lab id
- Updating the field name to Satellite Lab Name when viewing a patient profile
htdocs/includes/db_lib.php
Outdated
|
||
# Retrieves all user IDs corresponding to $LIS_SATELLITE_LAB_USER from the user table | ||
$saved_db = DbUtil::switchToGlobal(); | ||
$query_string = "SELECT satellite_lab_id FROM user WHERE satellite_lab_name = '$satellite_lab_name'"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this kind of highlights a possible issue - get_satellite_lab_id_by_name
implicitly uses the User
table in blis_revamp
as the source of truth.
So, imagine we have a backup of a lab. When we restore a backup, we restore the blis_[lab id]
database, not blis_revamp
, because we don't want to overwrite the existing usernames and passwords for other labs, and other shared data, because eg. a country director might be importing backups for many labs. But this also means we'll be importing a patient
table filled with a lot of satellite_lab_id
s that don't (necessarily) line up to the IDs and names in the user
table.
I don't think we have any labs where this would be an issue at the moment. But it does make the backup/restore issue more complicated, and it would be a point towards making the "source of truth" of lab IDs and names in the blis_[lab id]
database (eg. maybe use the patient table for these functions if you want to keep satellite_lab_name
as a column on both patient and user?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed during the mentor meeting, this function should be querying the patient table. The issue with querying the patient table for the satellite lab name is that you would be querying for a name corresponding to the ID in the table before the record is inserted. Since this would not be found as the patient record does not exist yet and thus, an associated satellite id and lab name are not present, satellite lab name ends up being null.
@mrysav what do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I see what you mean... this would be an issue for the first patient for a particular satellite lab. Okay, we can merge the code as-is, since the majority of the use cases that I know of are a single-lab setup, so this shouldn't cause issues there.