Bahmni Connect: Registration and Clinical screen are blank

Hi Bahmni devs!

In Bahmni Connect my Registration and Clinical screens are showing empty pages.

I am not sure what happens because there is no error in the Chrome console.

Does anyone have had the same problem?

Here is the contents of the sources on the registration blank page https://localhost/bahmni-connect/registration/index.html#/search:

registration page sources

Anything obvious? Where could I start to look at?

(cc: @sumanmaity112)

Hi @mksrom,

Is it your dev environment? If yes, to build bahmni-connect-apps you have to follow given steps

  • Do the steps suggested here
  • grunt chrome
  • grunt generate-sw

Also, run the following commands in your vagrant/docker machine

  • bahmni -i <inventory file> create-connect-artifacts
  • bahmni -i <inventory file> concat-configs

I have installed Bahmni Connect within my Docker container (not a Vagrant box actually) using the inventory file as I am not doing dev work on it yet. So the installer just took care of that. And the sources seems correctly copied in /var/www/bahmni-connect-apps/

[root@bahmni /]# tree /var/www/bahmni-connect-apps/registration/
β”œβ”€β”€ index.html
β”œβ”€β”€ registration.min.css
β”œβ”€β”€ registration.min.js
└── views
    β”œβ”€β”€ addressFields.html
    β”œβ”€β”€ age.html
    β”œβ”€β”€ customIdentifierConfirmation.html
    β”œβ”€β”€ dob.html
    β”œβ”€β”€ editpatient.html
    β”œβ”€β”€ header.html
    β”œβ”€β”€ layout.html
    β”œβ”€β”€ newpatient.html
    β”œβ”€β”€ nolayoutfound.html
    β”œβ”€β”€ notimplemented.html
    β”œβ”€β”€ patientAction.html
    β”œβ”€β”€ patientcommon.html
    β”œβ”€β”€ patientDeathInformation.html
    β”œβ”€β”€ patientRelationships.html
    β”œβ”€β”€ printOptions.html
    β”œβ”€β”€ search.html
    β”œβ”€β”€ topDownAddressFields.html
    └── visit.html

1 directory, 23 files

The steps you mention refer to Bahmni Apps.

Does it mean that Bahmni Connect is just a specific build of Bahmni Apps?

If so, what is Bahmni Connect repo for? (It looks like this repo is anyway a copy of Bahmni Apps)

When doing grunt chrome:

/ui$ grunt chrome
Warning: Task "chrome" not found. Use --force to continue.

Aborted due to warnings.

Same with grunt generate-sw

/ui$ grunt generate-sw
Warning: Task "generate-sw" not found. Use --force to continue.

Aborted due to warnings.

(on master)

I have had done those steps already. Redone them just now but doesn’t change anything

The grunt tasks chrome, generate-sw, … etc are specific to Bahmni Connect (see here) and are not defined in Bahmni Apps.

I suspect that Bahmni Connect is an offline friendly subset of Bahmni Apps with ad-hoc dependencies and builds. But @sumanmaity112 will certainly clarify that.

Hi @mksrom, @mksd,

bahmni-connect repo is subset of openmrs-module-bahmniapps. bahmni-connect repo only holds specific offline (PWA and android) related client side code.

grunt chrome, grunt generate-sw etc are specific to bahmni-connect.

All the steps present here you have to do it inside bahmni-connect/ui folder

Thanks @sumanmaity112 @mksd for clarifying this.

I have now just built the bahmni-connect project following @sumanmaity112’s instructions and it went through without errors.

Then I copied the newly built sources in /opt/bahmni-offline/bahmni-connect-apps/

[root@bahmni ~]# ll /var/www/
total 24
lrwxrwxrwx 1 bahmni bahmni   31 Jan  4 17:48 bahmniapps -> /opt/bahmni-web/etc/bahmniapps/
lrwxrwxrwx 1 bahmni bahmni   34 Jan  4 17:48 bahmni_config -> /opt/bahmni-web/etc/bahmni_config/
lrwxrwxrwx 1 bahmni bahmni   40 Jan  4 17:48 bahmni-connect-apps -> /opt/bahmni-offline/bahmni-connect-apps/
drwxr-xr-x 2 bahmni bahmni 4096 Jan  4 17:47 bahmni_revisions
drwxr-xr-x 2 root   root   4096 Jan  4 17:48 cgi-bin
lrwxrwxrwx 1 bahmni bahmni   40 Jan  4 17:48 client_side_logging -> /opt/bahmni-web/etc/client_side_logging/
drwxr-xr-x 3 root   root   4096 Jan  4 17:47 error
drwxr-xr-x 2 root   root   4096 Jan 15 21:08 html
drwxr-xr-x 3 root   root   4096 Jan  4 17:47 icons
lrwxrwxrwx 1 bahmni bahmni   60 Jan  4 17:48 implementer_interface -> /opt/bahmni-implementer-interface/etc/implementer_interface/
[root@bahmni ~]# ll /var/www/bahmni-connect-apps/
total 3616
-rw-r--r--  1 bahmni bahmni 3110550 Jan 15 21:06 bahmni-connect.tar.gz
drwxrwxr-x  8 bahmni bahmni    4096 Jan 15 20:32 clinical
drwxrwxr-x 13 bahmni bahmni    4096 Jan 15 20:31 common
-rw-rw-r--  1 bahmni bahmni  196702 Jan 15 20:31 common.background.min.js
-rw-rw-r--  1 bahmni bahmni  265210 Jan 15 20:31 common.offline.min.js
drwxrwxr-x 41 bahmni bahmni    4096 Jan 15 20:31 components
-rw-rw-r--  1 bahmni bahmni    6285 Jan 15 18:37 favicon.ico
drwxrwxr-x  3 bahmni bahmni    4096 Jan 15 20:32 home
drwxrwxr-x  6 bahmni bahmni    4096 Jan 15 20:31 i18n
drwxrwxr-x  2 bahmni bahmni    4096 Jan 15 20:31 images
-rw-rw-r--  1 bahmni bahmni    1125 Jan 15 20:32 index.html
drwxrwxr-x  6 bahmni bahmni    4096 Jan 15 20:31 lib
drwxrwxr-x  3 bahmni bahmni    4096 Jan 15 20:32 offline
drwxrwxr-x  3 bahmni bahmni    4096 Jan 15 20:32 registration
-rw-rw-r--  1 bahmni bahmni     423 Jan 15 18:37 service-worker-events.js
-rw-rw-r--  1 bahmni bahmni   56782 Jan 15 20:33 service-worker.js
-rw-rw-r--  1 bahmni bahmni    3283 Jan 15 18:37 service-worker-reg.js
drwxrwxr-x  3 bahmni bahmni    4096 Jan 15 20:31 styles

No better. Continuing investigation…

Hi @mksrom,

Which folder did you copy dist or app?
If you copy app folder it will not work. You have to copy dist folder.

Can you clean browsers local storage and unregister the PWA?

Also, check network calls during initial sync is something failing or not.

After initial sync, if you go to clinical module, the network/source will look like the following image


I have copied the dist folder yes.

I have also cleared the local storage from the Chrome console, however, I haven’t β€œunregistered” the PWA, how can this be done?

What I have done too is use the β€˜Delete Connect App’ button in the β€˜logout’ menu. Not sure what that’s doing in the background though. That seems to wipe all the caches.

delete connect ap

Here is the sources after clearing all app caches etc…:

Screenshot from 2018-01-15 20-20-20

Seems to be the same as yours :confused:

Investigating more tomorrow…

Hi @mksrom,

When you click on Clinical module, what is the URL then?

It should be something like this https://<host name>/bahmni-connect/clinical/index.html#/default/patient/search

Did you changed any bahmni-connect app side? If not, can you install bahmni-connect using bahmni command and check if its working or not

Yes, the URL is right.

It seems that the problem is related to my config though. With the default config, it works fine.

When I load my config and run the bahmni concat-config on it, I get the problem.

Now I will try to strip down my config to a minimum and see if there is a particular element that triggers the problem.

Actually what is the operation bahmni concat-configs doing?

It’s copy and minify config presents in `bahmni_config/offline/openmrs/apps/".

When you run bahmni -i < inventory file name> concat-configs, its go through all the folder present in the above location (bahmni_config/offline/openmrs/apps/) and creates minified config file. The file name will be <folder name>.json.

Here I have 3 folder - clinical, home, registration. If I run bahmni -i <inventory file name> concat-configs, it will create openmrs/apps/clinical/clinical.json, openmrs/apps/dbNameCondition/dbNameCondition.json, openmrs/apps/home/home.json, openmrs/apps/registration/registration.json in bahmni_config

1 Like

Thanks for all the help.

Have had headaches for this one! :sweat:

Found that the problem is coming from my formConditions.js file.

This is because of missing β€œ;” at the end of some lines in this file. Indeed, because it is minified by the bahmni -i <inventory file name> concat-configs command the β€˜end of lines’ are removed so Javascript then does not know where a line stops of course.

-> tip of the day: always use β€œ;” at the end a of line in JS. :grimacing:


:slight_smile: and run through JSLINT

1 Like

@mksrom yes we should probably run some validation build(s) on our Bahmni configs.

@angshuonline there is not such thing for the default config though?

no. We don’t run default config through JSLINT

I suspect that we will want to do that for our configs. That’ll be the opportunity to do a PR on the default config as well.