GSOC 2023: Improving the OpenMRS Developer Experience: Updating the SDK - Updates and Discussion

Hi,

I’ll be working on the project Improving the OpenMRS Developer Experience: Updating the SDK. This aims to improve the OpenMRS SDK to support the evolving needs of OpenMRS development.

I’ll use this thread to give updates and discuss the project.

Mentors

Primary mentor: @dkayiwa

Backup mentor: @jnsereko

6 Likes

I am incredibly excited about the remarkable results we hope to achieve in this project.

4 Likes

I am getting the following integration test failures when running mvn clean install on the SDK.

[ERROR] BuildDistroIntegrationTest.testBuildDistroFromDistroFile:21->AbstractSdkIntegrationTest.assertFilePresent:222->AbstractSdkIntegrationTest.assertPathPresent:244 Expected /home/wikum/Documents/openmrs-sdk/integration-tests/target/test-classes/integration-test/target/web/frontend/index.html to be an existing file or directory Expected: an existing file or directory but: does not exist

[ERROR] SetupIntegrationTest.setup_shouldInstallServerFromDistroPropertiesDir:165->AbstractSdkIntegrationTest.assertPathPresent:244 Expected /home/wikum/Documents/openmrs-sdk/integration-tests/target/test-classes/integration-test/49914bf5-71d7-4755-a2e7-f597502f39d5/frontend/index.html to be an existing file or directory Expected: an existing file or directory but: does not exist

Could you give me some guidance on how to fix this issue?

cc: @dkayiwa @jnsereko

1 Like

Are you using jdk 1.8 or above? I think you should strictly use 1.7

Those tests may require a version of Node (16) to be installed on your computer and the default on the $PATH. (They run a somewhat outdated version of the CLI and there were some breaking changes between Node 16 and Node 18 to do with peer dependency resolution and the MD4 hash).

I tried with jdk1.7.0_80 but still getting the same test failures.

Then i think try out @ibacher’s suggestion I also faced the same issue as i was trying out these project but i remember switching java versions cc @dkayiwa

1 Like

I tried to deploy O3 with different methods for the last few days.

  1. I set up the OpenMRS server using maven openmrs-sdk: setup
  2. Then I deployed the necessary modules using a distro.properties file. distro.properties · GitHub
  3. I ran the server and tried to access http://localhost:8080/openmrs/spa/login. But I am getting a 404 error. When I tried to deploy O3 with Tomcat I got stuck in the same place. Am I missing some steps? Any leads are highly appreciated.

Which instructions are you following for this setup? And which exact command did you use to deploy? Give as much details as you can.

Also, if you have the output of the commands you ran, that’s likely to have something very useful. It may also be necessary to run more up-to-date versions of things. Core 3.3.1 is from 2020 and a lot has changed since then.

With the guide of openmrs3-helpme. I tried to deploy O3 using Tomcat by following these instructions.

https://wiki.openmrs.org/pages/viewpage.action?pageId=224527013#O3ImplementerDocumentation:SetUp,Configure&Deploy-Part1:BuildandDeploytheOpenMRS3Frontend

https://ohri.atlassian.net/wiki/external/276922382/OTViMGVlMTY3NDBmNDQwNmI3OGRmYzk1YzAwYWUwZGM Here are the details of what I tried and the outputs I got.

Java version: openjdk version “1.8.0_362”

Tomcat version: 9.0.74

node version: v16.13.0

npm version: 6.14.15

  1. Installed Tomcat on /opt/tomcat.

  2. Installed OpenMrs platform 2.5 on Tomcat

  3. build distro.properties file with mvn openmrs-sdk:build-distro -Ddistro=distro.properties : Output - Pastebin.com

  4. Build and assemble openmrs frontend using npx openmrs@next build --api-url /openmrs && npx openmrs@next assemble --mode config --config importmap.json: Output - Pastebin.com

  5. copy the generated modules folder and dist folder into /var/lib/OpenMRS

 cp -r * /var/lib/OpenMRS/frontend/
 cp -r modules/ /var/lib/OpenMRS/
  1. Restart the Tomcat service

  2. When I go to the link http://localhost:8080/openmrs/spa I am getting the following error.

No file with path ‘/var/lib/OpenMRS/frontend/import-map.json’ exists

  1. I have importmap.json on the given location. So I renamed the file as import-map.json. Now I am getting these two errors on browser console.

Uncaught (in promise) Error: Unable to resolve specifier '@openmrs/esm-root-config' from http://localhost:8080/openmrs/spa/

Uncaught (in promise) Error: Unable to resolve specifier ‘@openmrs/esm-styleguide’ from http://localhost:8080/openmrs/spa/

openmrs.log: WARN - OpenmrsUtil.getApplicationDataDirectory(1085) |2023-05-16T16:21:23,666| U - Pastebin.com

So a couple of things:

  1. You seem to be using an old version of module-spa that supplied it’s own SPA page. Update to the latest version.
  2. Update to a newer version of the esm libraries.

I forgot to share my new distro.properties file.

I found the latest version for module-spa here: Releases · openmrs/openmrs-module-spa · GitHub. Is there a newer version of module-spa? Where can I find it?

Could you give me more information on updating the esm libraries?

Yes. You can see it in the tags. As a general rule, we don’t use GitHub Releases to track releases of modules.

From your distro.properties:

spa.core=4.4.1
spa.frontendModules.@openmrs/esm-login-app=3.3.1
spa.frontendModules.@openmrs/esm-patient-chart-app=3.1.0
spa.frontendModules.@openmrs/esm-home=2.1.0

@openmrs/esm-login-app should be the same version as core, but, you probably want the latest versions. The latest versions running on dev3 can be found in this link. Alternatively, the last released versions (what runs on test3) can be found in this link.

I updated and built the distro.properties file. After that when I tried localhost:8080/openmrs/spa/login I got the following error message.

No mapping for GET /openmrs/importmap.json

So I pasted a copy of importmap.json to /opt/tomcat/webapps/openmrs. After that /spa/login works fine but when it continues to the home page I am getting the following errors.

I installed the spa.frontendModules.@openmrs/esm-framework=4.4.1. Now I am getting this error.

Should I manually set value to spa.publicUrl in distro.properties file? What is the value for it should be?

@dkigen can you kindly help out here

You should try to make your environment as close to dev3 as possible. Try to add most modules

spa.frontendModules.@openmrs/esm-form-entry-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-patient-attachments-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-home-app=4.1.1-pre.211
spa.frontendModules.@openmrs/esm-patient-banner-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-login-app=4.4.2-pre.712
spa.frontendModules.@openmrs/esm-offline-tools-app=4.4.2-pre.712
spa.frontendModules.@openmrs/esm-implementer-tools-app=4.4.2-pre.712
spa.frontendModules.@openmrs/esm-primary-navigation-app=4.4.2-pre.712
spa.frontendModules.@openmrs/esm-patient-appointments-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-patient-allergies-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-dispensing-app=1.0.1-pre.196
spa.frontendModules.@openmrs/esm-openconceptlab-app=3.0.1-pre.30
spa.frontendModules.@openmrs/esm-patient-forms-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-cohort-builder-app=3.0.1-pre.115
spa.frontendModules.@openmrs/esm-generic-patient-widgets-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-devtools-app=4.4.2-pre.712
spa.frontendModules.@openmrs/esm-patient-biometrics-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-patient-conditions-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-patient-notes-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-patient-vitals-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-patient-programs-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-patient-medications-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-patient-chart-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-patient-test-results-app=4.5.1-pre.1491
spa.frontendModules.@openmrs/esm-active-visits-app=4.4.1-pre.1557
spa.frontendModules.@openmrs/esm-patient-search-app=4.4.1-pre.1557
spa.frontendModules.@openmrs/esm-patient-list-app=4.4.1-pre.1557
spa.frontendModules.@openmrs/esm-fast-data-entry-app=1.0.1-pre.87
spa.frontendModules.@openmrs/esm-form-builder-app=1.0.3-pre.335
spa.frontendModules.@openmrs/esm-patient-registration-app=4.4.1-pre.1557
spa.frontendModules.@openmrs/esm-appointments-app=4.4.1-pre.1557
spa.frontendModules.@openmrs/esm-outpatient-app=4.4.1-pre.1557

I have also seen replacing the version with next, ie *@openmrs/esm-outpatient-app=4.4.1-pre.1557 with *@openmrs/esm-outpatient-app=next but i don’t have alot of information about it

I added modules according to dev3 . Here is my new distro.properties file. : gist:175987ce6fb8cdffeeed8218c33d6213 · GitHub.

After logging in, I get an empty location list with the following console error.

Does your distro.properties file have all the modules mentioned here? openmrs-distro-referenceapplication/pom.xml at main · openmrs/openmrs-distro-referenceapplication · GitHub

I was missing a few modules. I added them but I am still getting the empty location list with the console error

.