Replicating the vitals fragment on patient dashboard

Hi all

I want to to create a fragment on the patient dashboard similar to the vitals fragment. If I create a form that is attached to the vitals controller and fill the form for a patient and visit the patient dashboard I can see the newly filled form. I want to build something similar. When an html form is created for a particular encounter say encounterA and when the form is filled for a patient and I visit the patient dashboard I see the filled form on the dashboard like in the vitals section. See screenshot below. I will appreciate if it if someone can point me to code that will guide me through this process.

Thanks

It uses a “most recent encounter” widget. You can see it done here: https://github.com/openmrs/openmrs-module-coreapps/blob/f1d64cc9e7a121f565174855e5f29914269abe34/omod/src/main/resources/apps/mostRecentVitals_app.json

@ivange94 You can try the Latest Obs for Concept List dashboard widget from https://wiki.openmrs.org/display/docs/Patient+Summary+Widget+Documentation

I have also submitted https://issues.openmrs.org/browse/RA-1347 as an enhancement that may fit into your use case usage for this widget @raff thoughts?

Thanks @darius and @ssmusoke. The information you provided will be helpful. I’m going through them now.

Thanks

@darius I noticed that in the app configuration, the encounter UUID was hard coded. So if I’m to do something similar, I’d have to wait for someone to create this encounter, copy the uuid and give me then I embed in the code. I was wondering if there is a way I could use global properties. So that my app will just be reading a global property. After installing my module the user just needs to provide the uuid of the particular encounter as a global property. Not sure how this will be possible since our app config is just json.

@darius I just replicated the example you gave above inside my own module but couldn’t see any app on the patient dashboard like the Vitals. Is there something else I need to do?

[
  {
    "id": "orders.mostRecentPhysicianOrder",
    "instanceOf": "coreapps.template.mostRecentEncounter",
    "description": "Show most recent physician orders on patient dashboard",
    "label": "Physician Orders",
    "icon": "icon-user-md",
    "order": 10,
    "config": {
      "encounterTypeUuid": "67a71486-1a54-468f-ac3e-7091a9a79584",
      "encounterDateLabel": "coreapps.clinicianfacing.lastVitalsDateLabel"
    },
    "extensions": [
      {
        "id": "org.openmrs.module.coreapps.mostRecentVitals.clinicianDashboardFirstColumn",
        "appId": "orders.mostRecentPhysicianOrder",
        "extensionParams": {
          "provider": "coreapps",
          "fragment": "encounter/mostRecentEncounter"
        }
      }
    ]
  }
]

Never mind, I just realized I missed this line “extensionPointId”: “patientDashboard.firstColumnFragments”,

but my question about accessing global properties from the app still stands.

@ivange94 yes, it makes sense that you’d want to do this via a global property (or better, by using metadata mapping).

You’d need to do something like make some changes around this line and have it support other config properties like encounterTypeFromGlobalProperty or encounterTypeFromMetadataMapping.