Welcome to the project! Follow the instructions below to set up the environment and get started.
Accessing artifacts hosted on GitHub requires a GitHub account for downloading purposes. Please follow these steps:
-
Duplicate and Rename Configuration File:
- Copy the file
local.properties.defaultand rename it tolocal.properties. - Open the
local.propertiesfile and insert your GitHub account/token details.
- Copy the file
-
Modify Additional Properties:
- Modify other properties (e.g., URLs, OAuth2) only if you are using a custom OpenMRS or Keycloak setup.
You can run the OpenMRS Server and Keycloak using one of the following options:
- Use the
docker-composefile available in the root of this project. - Create a
.envfile from the provided template.env.default.
- Follow the steps provided in the OpenMRS Distro SSO repository.
- Apply any necessary changes as per your setup.
- To log in using Keycloak, use one of the predefined users listed here.
This project supports the following authentication methods:
- Basic Auth
- OAuth2
Update the auth_method property in your configuration to:
"basic"for Basic Auth"openid"for OAuth2
To enable FHIR synchronization, set the fhir_sync_urls property with the required resource URLs in your local.properties file.
Each resource type should be separated by a comma (,).
fhir_sync_urls=Location?_sort=_lastUpdated&_summary=data,Patient?_sort=_lastUpdated,Encounter?_sort=_lastUpdated,Observation?_sort=_lastUpdatedUse the optional first_fhir_sync_url property when you need a different search scope for the very first download. The app always queues all URLs from first_fhir_sync_url and fhir_sync_urls, then deduplicates them by resource type so subsequent syncs do not re-run broader first-time queries. This behavior is implemented in TimestampBasedDownloadWorkManagerImpl where the two lists are merged and filtered with distinctBy on the resource type derived from each URL.
Two properties help control how patient lists are filtered during syncs driven by group resources:
filter_patient_lists_by_group(boolean) limits Group queries to the userβs selected location by adding alocationsearch parameter when enabled.cohort-type(UUID) appends acohort-typeparameter to Group requests when provided, allowing you to scope patient lists to a specific cohort definition on both initial and incremental sync paths. Define these properties inlocal.properties(seelocal.properties.defaultfor examples and defaults).
Configure the lightweight connectivity probe using two properties:
check_server_urlis the endpoint the app pings to verify the server is reachable before launching sync or login flows.server_connectivity_timeout_secondsdefines how long the probe waits before failing; values below one second are automatically clamped to a one-second timeout before being converted to milliseconds.
Both settings live in local.properties (see local.properties.default for their default values) so you can point to custom health-check endpoints or adjust the responsiveness of the status indicator.
To Configure Patient Registration Questionnaire, set the registration_questionnaire_name property to either of the following:
resourceIdof the registration questionnaire synced from the server.file nameof the registration questionnaire in the assets folder.
Use the show_review_page_before_submit toggle to decide whether a review screen is displayed before users submit questionnaire responses. The fragment builders read this boolean and call showReviewPageBeforeSubmit(...) so disabling it skips the intermediate review page for workflows such as patient registration or encounter capture. Configure the flag in local.properties; the default value is documented in local.properties.default.
To configure patient identifier creation, set the fetch_identifiers property to either of the following:
true: fetch auto-generated identifier values on the Android app and embed them on the patient before uploading to the server.false: skip fetching auto-generated identifier values so they can be created entirely on the backend (or when you do not rely on autogenerated identifiers).
To configure the questionnaire list on click of the Create Encounter button in the patient screen, update the questionnaires & encounter_type_system_url property with the encounter type of the encounter's questionnaire:
Similar to registration questionnaire, it either takes the questionnaire from assets folder or after sync from the server.
Note:
In the questionnaires property, write the code for encounter type instead of the questionnaire.id & make sure you use the correct url value.
Reference: Example property
Encounter forms can optionally show the shared screener questionnaire before the main form renders. To enable this behavior:
- Flag any encounter questionnaire item that should surface in the screener with the
https://openmrs.org/ext/show-screenerextension. - At runtime,
GroupFormEntryViewModelinspects each encounter form, extracts those flagged items, and merges them into the screener template before handing the combined questionnaire to the UI layer. - The base template lives at
core/src/main/assets/screener-questionnaire-template.json; customize this file (or replace it entirely) to adjust the screener layout or wording.
{
"code": [
{
"system": "http://fhir.openmrs.org/code-system/encounter-type",
"code": [{"code":"<Observation code>"}],
"display": "display"
}
}To ensure application diagnostics are sent to the correct developer email upon user request:
- Open the
local.propertiesfile. - Update the
support_emailproperty with the desired email address.
You can also protect exported diagnostic archives by setting the optional diagnostics_password property. When populated, the app passes the value to the FileLoggingTree initializer so generated ZIP files require that password to be opened. Add the secret to local.properties; a placeholder entry is available in local.properties.default.
To log out of the OpenMRS web application:
http://localhost:8080/realms/main/protocol/openid-connect/logout
Note: There is an issue with the current OpenMRS installation and the SSO logout process.
A list of predefined users for OpenMRS can be found here:
Keycloak Users CSV
-
Error 404 on clicking login button:
- Ensure that the
discovery_uri's port matches your Keycloak container's port in thelocal.propertiesfile.
- Ensure that the
-
Error 404 after successful login, and sync is failing:
- Verify that the
BASE_URL's port matches your Gateway container's port in thelocal.propertiesfile.
- Verify that the
-
First sync is fetching too many resources:
- Narrow down the scope of the download sync by modifying the
fhir_sync_urlsproperty in thelocal.propertiesfile.
- Narrow down the scope of the download sync by modifying the
Keycloak can be accessed through different URLs depending on the use case:
- localhost is used to log into the OpenMRS web application.
- 10.0.0.2 is used by the Android app.
To configure this:
- Update the
KC_HOSTNAMEvariable indocker-compose.yml(line 89). - After modifying, restart using:
docker compose up -dAlternatively to restart only the Keycloak service, you can use:docker compose restart keycloak
Refer to the custom code created for OpenMRS:
Google Android FHIR OpenMRS Code
- This project is based on Google FHIR App Examples.
- For more details, see:
OpenMRS Android FHIR Project
To initiate the build workflow:
- From Git: Just create and push a tag
vX.Y.Z - From Web UI: Create a release and the related tag
vX.Y.Zand Delete immediately the Realse
the Build action should be triggered and it will create a new release containing the apk configured to use dev3.openmrs.org as the OpenMRS Backend.