Is it possible to display a fragment on the dashboard only for children?

Application Name: Reference Application Version 2.5

Question: Is it possible to display a custom fragment conditionally based on the patient’s age? We have a mostRecentEncounter fragment that displays the power of attorney information, but it’s only applicable to children under the age of ‘n’ as is defined in a global property. If it’s not possible to do it through the appFramework, should I create a fragment in my module and pass a variable through the controller?

Thanks, Craig

I have not seen this implemented. So you will need to pass a variable through your controller.

The “correct” answer is that you should make a change in the coreapps module so that the extension points on the patient dashboard respect the “require” property on your extension, and then to set "require":"patient.age < 5" in your extension config json.

I think this is as easy as adding contextModel as a second parameter to both of the getExtensionsForCurrentUser calls in:

I notice that you say that the age cutoff needs to be controlled by a global property. If that’s a requirement, I don’t think what I’ve said here will solve your situation, and you’ll need to do the controller path that you say.

For anyone who happens upon this thread it has not yet been done as of today. However, I was able to test Darius’ approach in the registration summary page with success using “require”:“patient.person.age < 18” to display the fragment only if the patient is younger than 18 years old. Here’s a sample of the fragment:

"id": "isanteplus.registration.mostRecentPoaContact",
"description": "isanteplus.registration.mostRecentPoaContact.description",
"label": "isanteplus.registration.mostRecentPoaContact.label",
"icon": "icon-user",
"order": 2,
"config": {
    "encounterTypeUuid": "873f968a-73a8-4f9c-ac78-9f4778b751b6",
    "encounterDateLabel": "isanteplus.registration.mostRecentPoaContact.encounterDateLabel",
    "definitionUiResource": "isanteplus:htmlforms/RegistrationPoa.xml",
    "editable": true,
    "editIcon": "icon-pencil",
    "edit-provider": "htmlformentryui",
    "edit-fragment": "htmlform/editHtmlFormWithStandardUi"
"extensions": [
    "id": "isanteplus.registration.mostRecentPoaContactFirstColumn",
    "appId": "isanteplus.registration.mostRecentPoaContact",
    "extensionPointId": "registrationSummary.secondColumnContentFragments",
    "extensionParams": {
      "provider": "coreapps",
      "fragment": "encounter/mostRecentEncounter"
	"require":"patient.person.age < 18"


Notice that the require field is part of the Extension, not the extensionParams.

1 Like

@craigappl Happy Dance as this has been a pain in my side for a looonng time! Thanks

1 Like

@craigappl Looks like I danced too early, I have been unable to get the require to work, at least for dashboard widgets. I am using appframework 3.10.0

Hi @ssmusoke

The registration Summary page in the registration app has the proper configuration and the extension example I gave, provides a the display only on the registration summary page. To do it, you would have to add the appContextModel to the clinician facing patient page controller as Darius mentions. You can see an example in the registrationSummary fragment. After that, you’ll be able to use the require property on the extension json.


I had missed @darius comment earlier have a ticket along with a PR

I’ve merged this in, thanks @ssmusoke @craigappl @darius