Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Hide dashboard cards option #7192

Closed

Conversation

juggernautsei
Copy link
Member

@juggernautsei juggernautsei commented Jan 25, 2024

Fixes #7191

Short description of what this resolves:

Creates the ability to turn off cards that are not being used by the clinic

Changes proposed in this pull request:

Create a list of cards and use it in an array to to display or hide the card. This is what the dashboard looks like with the cards turned off.

image

below added by @bradymiller :
UpForGrabs demo for testing this PR is at: https://www.open-emr.org/wiki/index.php/Development_Demo#Alpha_-_Up_For_Grabs_Demo

@@ -614,3 +614,16 @@ CREATE TABLE `fee_schedule` (
UNIQUE KEY `ins_plan_code_mod_type_date` (`insurance_company_id`, `plan`, `code`, `modifier`, `type`, `effective_date`)
) ENGINE=InnoDb AUTO_INCREMENT=1;
#EndIf

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @juggernautsei, no need for this file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not a part of my PR.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the changes in this script

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to remove this from the PR just copy the raw file into the file in this branch

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to happen.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adunsulag
@stephenwaite removed this. It was not apart of my PR.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still here. You can't simply remove, you have to commit the correct version.
You really need to pull and merge master in your local then push.

You know, better yet @juggernautsei, close this and push new PR with correct files for the feature option. I'm not sure what happened to this PR but it is a mess. For sure get rid of new table and list options so really no need to push any database/upgrade changes.
Since now in globals with hard coded select options I foresee only two or three files for feature.
This IMO is easiest way to get this in....

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juggernautsei Did you see this above?

@@ -113,3 +113,15 @@
ALTER TABLE `form_encounter` ADD `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
#EndIf

#IfNotRow2D list_options list_id lists option_id default_open_tabs
-- Create new list Default Open Tabs
INSERT INTO `list_options` (`list_id`, `option_id`, `title`) VALUES ('lists', 'Hide_Dashboard_Cards', 'Hide Dashboard Cards');
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above should be looking for option id Hide_Dashboard_Cards

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this what it should be
#IfNotRow lists option_id Hide_Dashboard_Cards

@stephenwaite
Copy link
Sponsor Member

Should this take into account the ACL of the user so that way any medical info could not be put out of reach of a physician or clinician?

@bradymiller
Copy link
Sponsor Member

Pretty neat way to turn certain things off for a practice.

  • Are all the cards given this functionality or just some of them? If not, would support for all the current cards
  • In the list editor, would give this list a little customization and would change the Table Header (in list editor gui) for Active to Hide and then have it hidden when active setting is 1.

@juggernautsei
Copy link
Member Author

This only hide certain cards. I don't understand the second part of your question but the list can be added to. I did the ones that I am most often asked to remove. The core dashboard cards I left. These are the ones that everyone uses.
I think I know what you are saying for the second. Change the list editor to display Hide instead of Active for this list to match what is being done. I will dive into that and see if I can figure that one out.

@juggernautsei
Copy link
Member Author

juggernautsei commented Jan 27, 2024

Should this take into account the ACL of the user so that way any medical info could not be put out of reach of a physician or clinician?

@stephenwaite I understand your concern but the clinic that does this is usually a none primary care. If it is a primary care clinic or a clinic that needs those cards. Why would they turn them off? I deal with behavioral health a lot and most of them do not need or use those cards. But the psychiatrist that prescribes. We leave the prescription card on for them and the medication card stays on. The ACL component can be added so that no matter what a provider would still see the cards. But kind of defeats the purpose. The person that turns these cards off would need admin privileges. It is hard to prevent malicious or ignorant actors in a clinic. I can see expanding the feature so that only those that need to see the cards will see them by ACL. A front desk member would not need to see medications while an MA would. It may be worth pursuing. Good thought.

@juggernautsei
Copy link
Member Author

Bump. Can we get this into the next patch?

@@ -74,6 +74,7 @@
// want smart support in their system.
$smartLaunchController = new SMARTLaunchController($GLOBALS["kernel"]->getEventDispatcher());
$smartLaunchController->registerContextEvents();
$activeCards = getActiveDashboardCards();
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$hiddenCards = getHiddenDashboardCards();

@@ -1079,7 +1080,9 @@ function filterActiveIssues(array $i): array
'btnLink' => "return load_location('{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=allergy')"
];
echo "<div class=\"$col\">";
echo $t->render('patient/card/allergies.html.twig', $viewArgs);
if (in_array('card_allergies', $activeCards)) {
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!in_array('card_allergies', $hiddenCards)) {

@@ -142,3 +142,13 @@ function setListTouch($patient_id, $type)
sqlStatement("INSERT INTO `lists_touch` ( `pid`,`type`,`date` ) VALUES ( ?, ?, NOW() )", array($patient_id,$type));
}
}

function getActiveDashboardCards()
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function getHiddenDashboardCards()

#IfNotRow2D list_options list_id lists option_id Hide_Dashboard_Cards
-- Create new list Hide Dashboard Cards
INSERT INTO `list_options` (`list_id`, `option_id`, `title`) VALUES ('lists', 'Hide_Dashboard_Cards', 'Hide Dashboard Cards');
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`,`activity`) VALUES ('Hide_Dashboard_Cards', 'card_allergies', 'Allergies', 10, 1);
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set all the active settings from 1 to 0

@@ -13638,3 +13638,13 @@ INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`) VALUES('nationality_with_country', 'YE', 'Yemeni', '2480', '0', '0', '', 'Yemen', 'YEM:887');
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`) VALUES('nationality_with_country', 'ZM', 'Zambian', '2490', '0', '0', '', 'Zambia', 'ZMB:894');
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`) VALUES('nationality_with_country', 'ZW', 'Zimbabwean', '2500', '0', '0', '', 'Zimbabwe', 'ZWE:716');

INSERT INTO `list_options` (`list_id`, `option_id`, `title`) VALUES ('lists', 'Hide_Dashboard_Cards', 'Hide Dashboard Cards');
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set all the active settings from 1 to 0

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this file as its no longer being used due to the globals setting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is gone. I can't find it in the PR. I just looked.

@bradymiller
Copy link
Sponsor Member

  • Since the point is to Hide cards, see my above recommendations (i think this is much more clear since the list is for hiding cards and the list does not include every single possible card).
  • Then need to modify the column name for the hide list in the list editor from Active to Hide (can see other examples in that list editor script where column names are changed dependent on the list). This then makes the user turn the toggle on to hide it (note the database active will then be set to 1 when the user wants to hide the card).

@@ -162,6 +162,11 @@
<div class= "row" id="section3">
<div class="col-sm-12">
<h4 class="oe-help-heading"><?php echo xlt("Data Section"); ?><a href="#"><i class="fa fa-arrow-circle-up oe-pull-away oe-help-redirect" aria-hidden="true"></i></a></h4>

<p><?php echo xlt("The some of the cards on the dashboard can be turned off if not being utilized by the clinic");?></p>
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the 'The some' to 'Some'

@bradymiller
Copy link
Sponsor Member

Note the above proposed strategy will also then make it easier to support adding tthe other cards to this mechanism without hiding them by mistake. For example, can place the conditionals around the other cards, and they will still show by default even if they are not yet listed in the Hide list.

@bradymiller
Copy link
Sponsor Member

review complete :)

@stephenwaite
Copy link
Sponsor Member

hi @juggernautsei , check out https://github.com/openemr/openemr/blob/master/interface/super/edit_list.php#L1251 for where you can change active to hide

@@ -1079,7 +1080,9 @@ function filterActiveIssues(array $i): array
'btnLink' => "return load_location('{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=allergy')"
];
echo "<div class=\"$col\">";
echo $t->render('patient/card/allergies.html.twig', $viewArgs);
if (in_array('card_allergies', $hiddenCards)) {
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should be if (!in_array

@sjpadgett
Copy link
Sponsor Member

A front desk member would not need to see medications while an MA would. It may be worth pursuing. Good thought.

The card themselves have acl's so should not need in list options.
Also now'd be a good time to add lists by user id! Maybe a new table that references the list by list id and user id!
You'd be doing the project a huge favor if you have time or inclination Sherwin. Then could be used in start up tabs and several future features that you may even run across. I'd help when I have a minute.

@juggernautsei
Copy link
Member Author

juggernautsei commented Mar 2, 2024

Ok, Jerry, if this will be a huge favor, I will take the time to plan this out some more and see what I can do with the suggestion. I am going to need a little bit more details of operations to hammer this out. How do you see this working from the UI?

@surfacehazard
Copy link
Contributor

The ability to hide cards would provide significant utility to my clinics. User-specific lists, while a worthy enhancement, represents a large expansion of the bike shed. Suggest to merge #7192 first..

@@ -1103,7 +1106,9 @@ function filterActiveIssues(array $i): array
'btnLink' => "return load_location('{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=medical_problem')"
];
echo "<div class=\"$col\">";
echo $t->render('patient/card/medical_problems.html.twig', $viewArgs);
if (in_array('card_medicalproblems', $hiddenCards)) {
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also needs !in_array

@@ -1125,7 +1130,9 @@ function filterActiveIssues(array $i): array
'btnLink' => "return load_location('{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=medication')"
];
echo "<div class=\"$col\">";
echo $t->render('patient/card/medication.html.twig', $viewArgs);
if (in_array('card_medication', $hiddenCards)) {
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also needs !in_array

@bradymiller
Copy link
Sponsor Member

Added UpForGrabs demo for testing this PR at: https://www.open-emr.org/wiki/index.php/Development_Demo#Alpha_-_Up_For_Grabs_Demo

@juggernautsei
Copy link
Member Author

It is testing well for me in the up for grabs

Comment on lines 650 to 652
echo " <select multiple class='form-control' name='form_{$i}[]' id='form_{$i}[]' size='3'>\n";
while ($row = sqlFetchArray($res)) {
echo " <option value='" . attr($row['card_abrev']) . "'";
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a default none or empty so user can select to hide 0 cards. Currently once you select cards you will always have to select at least one card.
<option value="">attr("Hide None")</option>
Or something like after select echo.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I suppose a ctrl click will work so maybe okay the way you have it.
Thanks for the effort Sherwin.

@bradymiller
Copy link
Sponsor Member

bradymiller commented Mar 23, 2024

hi @juggernautsei , This is definitely headed in the right direction with the multiselect global.

  1. Why not just now have a simple list in the list_options called 'dashboard_cards' that is used to populate the global selector (rather than creating a new table just to store and id and title, which list_options already does nicely and then have a ui where can add new ones when needed). Creating new tables for simple lists will get tedious and note list_options is made for this use (can add new elements via ui, practice have control of the titles, and in database so can be different if using multisite function for different practices, and good internationalization support).
  2. Can populate your multi global like do for 'language_menu_other' at https://github.com/openemr/openemr/blob/master/interface/globals.php#L382. This will then allow to create a simple isHiddenDashboardCard('cardname') function that use in the 'if' calls to see if it is hidden.

@sjpadgett
Copy link
Sponsor Member

Just hardcode the multilist. It will not need to be dynamic

@bradymiller
Copy link
Sponsor Member

bradymiller commented Mar 23, 2024

hi @juggernautsei and @sjpadgett ,
Agree with hardcoding the list as a php array instead of in list_options.

@juggernautsei
Copy link
Member Author

Hi @bradymiller can this be resolved and brought into the code base

@stephenwaite
Copy link
Sponsor Member

hi @juggernautsei , looks like you have that conflict with the upgrade script?

@juggernautsei
Copy link
Member Author

Ok I will pull it back and take a look at it. I was being lazy. Thx @stephenwaite

@adunsulag adunsulag added this to the 7.0.2.1 milestone Apr 22, 2024
Copy link
Sponsor Member

@adunsulag adunsulag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's some cleanup that needs to occur with all of the changes. Unless that happens today, we'll need to bump this to the next patch.


<p><?php echo xlt("Some of the cards on the dashboard can be turned off if not being utilized by the clinic");?></p>

<p><?php echo xlt("To see which cards can be hidden, go to Admin, Forms, Lists, then search for Hide Dashboard Cards");?>.</p>
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description is no longer accurate as it looks like settings are now done in the globals configuration.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address this!

@@ -1283,6 +1283,13 @@ function lister() {
<th><?php echo xlt('Check In'); ?>&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th><?php echo xlt('Check Out'); ?></th>
<th><?php echo xlt('Code(s)'); ?></th>
<?php elseif ($list_id == 'Hide_Dashboard_Cards') : ?>
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since config is now in globals, this file needs to be reverted.

@@ -614,3 +614,16 @@ CREATE TABLE `fee_schedule` (
UNIQUE KEY `ins_plan_code_mod_type_date` (`insurance_company_id`, `plan`, `code`, `modifier`, `type`, `effective_date`)
) ENGINE=InnoDb AUTO_INCREMENT=1;
#EndIf

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to happen.

@@ -112,4 +112,8 @@
#IfMissingColumn form_encounter last_update
ALTER TABLE `form_encounter` ADD `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
#EndIf
#IfNotRow4D supported_external_dataloads load_type CQM_VALUESET load_source NIH_VSAC load_release_date 2023-05-04 load_filename ec_only_cms_20230504.xml.zip
INSERT INTO `supported_external_dataloads` (`load_type`, `load_source`, `load_release_date`, `load_filename`, `load_checksum`) VALUES
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here, not sure how it even made it into this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of those GitHub things. Not is my PR.

@@ -13638,3 +13638,13 @@ INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`) VALUES('nationality_with_country', 'YE', 'Yemeni', '2480', '0', '0', '', 'Yemen', 'YEM:887');
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`) VALUES('nationality_with_country', 'ZM', 'Zambian', '2490', '0', '0', '', 'Zambia', 'ZMB:894');
INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`) VALUES('nationality_with_country', 'ZW', 'Zimbabwean', '2500', '0', '0', '', 'Zimbabwe', 'ZWE:716');

INSERT INTO `list_options` (`list_id`, `option_id`, `title`) VALUES ('lists', 'Hide_Dashboard_Cards', 'Hide Dashboard Cards');
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this file as its no longer being used due to the globals setting.

@juggernautsei
Copy link
Member Author

Everything that @adunsulag addresses has been corrected and moved. There is nothing for me to do here. @sjpadgett

@sjpadgett
Copy link
Sponsor Member

Okay thanks @juggernautsei . Let me test and review again and i'll let you know.

@@ -645,6 +645,22 @@ function checkBackgroundServices()
echo "</option>\n";
}
echo " </select>\n";
} elseif ($fldtype == GlobalSetting::DATA_TYPE_MULTI_DASHBOARD_CARDS) {
$res = sqlStatement("SELECT * FROM dashboard_card_visibility");
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were supposed to get rid of table and hard code these options!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sjpadgett eye eye captain

Comment on lines 648 to 663
} elseif ($fldtype == GlobalSetting::DATA_TYPE_MULTI_DASHBOARD_CARDS) {
$res = sqlStatement("SELECT * FROM dashboard_card_visibility");
echo " <select multiple class='form-control' name='form_{$i}[]' id='form_{$i}[]' size='3'>\n";
while ($row = sqlFetchArray($res)) {
echo " <option value='" . attr($row['card_abrev']) . "'";
foreach ($glarr as $glrow) {
if ($glrow['gl_value'] == $row['card_abrev']) {
echo " selected";
break;
}
}
echo ">";
echo xlt($row['card_name']);
echo "</option>\n";
}
echo " </select>\n";
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juggernautsei I don't understand what is going here. This is the preferred way you strove for! Just needed to hard code the options that current are in the new table then revert table.
Did you accidently push an older version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accident.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got the code and will start a new PR for clarity sake.

@juggernautsei
Copy link
Member Author

Going to start a new PR.

@adunsulag adunsulag changed the title Hide dashboard cards option feat: Hide dashboard cards option May 18, 2024
@adunsulag adunsulag removed this from the 7.0.2.1 milestone May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Hide cards in the patient dashboard
6 participants