GSoC 2024 @ OpenMRS: Week 7 | Multiple Dynamic Patient Identifier & Room Database๐
Hey everyone! ๐
GSoC 2024 @ OpenMRS: Week 7 | Multiple Dynamic Patient Identifier & Room Database๐

Hey everyone! ๐
I hope youโre all doing great! This week has been quite an exciting one for me, packed with new enhancements and some cool implementations. Letโs dive right into the updates! ๐ค
Last week, we successfully implemented custom patient identifier selection in our app. This week, we took it a step further by adding multiple patient identifier type selections. This feature required some significant enhancements to our application.
๐ ๏ธ Implementation Details
Previously, we were using preferences to store the single selected identifier type and the list of fetched unique identifiers. However, to support multiple identifier types and their corresponding lists of fetched unique identifiers, using preferences became too messy. So, we decided to integrate a database into our application.
๐พ Database Integration
We integrated RoomDatabase with our Android app, following the steps mentioned in the official documentation.
Entities Created:
- IdentifierType
- IdentifierTypeModels
We wrote the required queries (based on our business logic) to the DAO.
๐งฉ IdentifierManager & PatientIdentifierManager Modifications
Based on our new data layer, we modified the IdentifierManager to store the fetched identifier types in the database. We also updated the logic for fetching the NextIdentifier so that once an identifier value is fetched from the database, it is deleted to ensure only unique identifiers are added to the patient resource.
๐ Embedding Identifiers in the Questionnaire
When a questionnaire is fetched by the user, we embed it with non-unique identifier type questions (e.g., Hospital ID number). Initially, these were not converting well when extracted from the questionnaire response and saved to the patient resource.
To resolve this, we now modify the identifier to the appropriate format before saving it as a patient resource, ensuring compatibility with the OpenMRS backend.
For unique identifier types that require server-fetching, these are embedded before the patient is saved, with the help of PatientIdentifierManager.



๐ Complete Flow
- Installation: The app automatically fetches the available identifier types from the server.
- Selection: Users can select the required identifier types using the identifier type selection screen.
- Fetching Identifiers: If unique identifiers are needed, they are fetched from the server.
- Questionnaire: When a user opens a questionnaire, non-unique identifier types are embedded.
- Saving: Once the questionnaire is saved, identifiers are modified, and unique identifier types are embedded.
- Final Save: The patient is saved with the appropriate identifiers.
Check out the code changes. ๐งโ๐ป
๐ฅ Demo Video
Weโve reached the halfway point in our GSoC 2024 journey! All contributors at OpenMRS presented their projectsโ progress in wonderful presentation videos. These videos are very insightful and give a glimpse into ongoing developments at OpenMRS and in the healthcare domain. You can check them out here.
[embed]
๐ฎ Plans for Next Week
- Redesigning the sync functionality of the app.
- Enhancing the offline functionalities of the application.
Thanks for following along on this journey! Stay tuned for more updates. ๐
Thank you for reading! Please feel free to reach out to me regarding absolutely anything! Especially anything regarding healthcare, full stack development, FHIR, OpenMRS Android, Open Health Stack, a song recommendation, etc. ๐ต
You can find me on LinkedIn or OpenMRS Talk and check out my projects on GitHub.๏ฟฝ
๋ฉํ๋ฐ์ดํฐ
- post_id
- 4e7af2ed24b2
- slug
- gsoc-2024-openmrs-week-6-multiple-dynamic-patient-identifier-room-database-4e7af2ed24b2
- url
- https://medium.com/@panchalparth_91743/gsoc-2024-openmrs-week-6-multiple-dynamic-patient-identifier-room-database-4e7af2ed24b2
- canonical_url
- https://medium.com/@panchalparth_91743/gsoc-2024-openmrs-week-6-multiple-dynamic-patient-identifier-room-database-4e7af2ed24b2
- author_url
- https://medium.com/@panchalparth_91743
- status
- ok
- fetched_at
- 2026-06-17 12:55:42