Edit the Vitals Form in Reference Application

I would like to add Blood Glucose (CIEL:887) to the Vitals Form in the Reference Application. When I add the field to the form, it appears in the preview initially, but soon gets overwritten with the original vitals form. My new field on the vitals form never appears in the UI where a provider would enter vitals.

Is there a way to edit this form? Or should I just replace it with my own vitals form?

1 Like

You need to replace it with your own vitals form.

The built-in forms are defined in code (though they are copied to the database) so you can’t edit them.

1 Like

No problem. Thanks for the direction!

I have created another form to collect my vitals. It works great, with the new vitals appearing in the patient summary (so long as the Encounter Type for the replacement form is set to Vitals).

I can turn off referenceapplication.vitals, but the integrated “Capture Vitals” link still appears on the patient dashboard. How can I remove the link to “Capture Vitals” from the UI?

The “referenceapplication.vitals” app actually refers to the top-level Capture Vitals app that’s on the home page. So turning that off is not going to solve your problem.

Peeking at the code, I don’t think it’s possible to do this through the UI. The problem is that all of the built-in form links are defined as free-standing extensions in this file

but we don’t have a Manage Extension page in the UI. (Could you create a ticket in the RA project to ask for one?)

I think there are two things you can do:

  1. Via the groovy module, call AppFrameworkService.disableExtension ( https://github.com/openmrs/openmrs-module-appframework/blob/master/api/src/main/java/org/openmrs/module/appframework/service/AppFrameworkService.java#L64 )
  2. I think that @mogoodrich and PIH have built an approach where you can control this from a json configuration file via your runtime properties file, but I don’t know if that is documented or not.

Dear @darius, thanks so much for your helpful information.

I created the ticket for the Manage Extension page in the UI.

I tried the Groovy method, but had trouble running Groovy scripts. Not sure why.

I found a ticket where it was made possible to control extensions from a json configuration file.

I tried creating the appframework-configuration.json file in the same folder as the global property file. I gave it the same permissions as the global property file too. I put the following in the json file…

{
    "appsEnabledByDefault": true,
    "appConfiguration": {
        "id_of_app": {
            "enabled": true
            // eventually we can support overriding appConfig here
        }
    },
    "extensionConfiguration": {
        "referenceapplication.realTime.vitals": {
            "enabled": false
        }
    }
}

I restarted Tomcat, but the legacy vitals link was still there. The catalina.out log didn’t mention anything about the json file.

Perhaps @mogoodrich would be kind enough to share some documentation for this.

Hmm… this (AF-31) is old functionality that we no longer use. It should still be functioning, but, since we no longer use it, I don’t have an example of it.

@arbaughj, based on your other post re: using the address hierarchy, it looks like you are going to need to do a level of customization not possible (at least currently) without modifying the various json files within the reference app module.

Based on what @darius said in another post, my advice would be to fork that module, and create your own build of it. (This, unfortunately, does mean you’d have to set up your own development environment, but hopefully you can get away with just building the reference app module). Then go ahead and modify/create json files to customize the app to your liking. In this case, you’ve remove the “vitals” block from:

Dear @mogoodrich, that you so much for this information. I’ll let you know when I get stuck (or succeed)!

Do we still need to edit the built-in forms and customize the reference app module or we can do this from UI?

@hpardess are you referring to this? https://issues.openmrs.org/browse/RA-435

I want to add a new field in discharge form. How can I replace the built in form with my own designed form?

@hpardess, the idea is that you have to disable the extension which is attaching the current form, and then you’d add your own alternative discharge form just like adding any other form.

In Java code you can call AppFrameworkService.disableExtension(...), or else you can probably do this directly in the database.

I replaced the built-in discharge form with my customized discharge form directly from database.

htmlformentry_html_form table > xml_data column

For first time i saw my customized form when i tried to edit the discharge encounter but my customized form is automatically replaced back with built-in from. why?

Just looking for an easy way like a global variable (like Maintenance>Settings) to set as false and it should stop replacing the build-in forms again :thinking:

I tried another approach which meets my requirements to some extend but still I need to apply condition when this form should appear.

Steps:

  1. I have created a Discharged Form v2 in HTML Form Entry
  2. Also I set the correct UUID value for formUuid and formEncounterType attributes in Discharged Form v2. (you can get UUID from Forms>Manage Forms)
  3. I have Retired the built-in form ( Discharge (Sample) ). When i retired the built-in form it is disappeared from Current Visit Actions.
  4. Set the UI location for Discharged Form v2 in Home>Configure Metadata>Manage Forms

My form (Discharged Form v2) appears in Current Visit Actions but I want this form should appear only when the patient is admitted as inpatient.

How can I use “Show If” field to display the form only if it is inpatient?

.

Finally I found this in wiki (https://wiki.openmrs.org/display/docs/Conditionally+displaying+Apps+and+Extensions)

Just add following line and the Discharge form will be visible only in active visit when the patient is admitted.

visit.admitted && visit.active

@dkayiwa, I have created a customized form of Discharge and it is visible in Current Visit Actions when patient is admitted. But I don’t want this form to be displayed in Form Entry of XForm.

How about just removing the xforms module?