Difference between revisions of "Our prescriptions are not clearing automatically"

From TMS Support Wiki
Jump to navigation Jump to search
(Created page with "The prescription lifecycle is highly configurable by system administrators. Sometimes, due to a misconfiguration, prescriptions may not organically disappear from your user views even though they are considered "done". =Symptoms= Despite completing every activity in the sequence, the prescription remains on the user view/homepage, causing clutter. Given enough time the sheer number of prescriptions starts to cause performance problems. =Cause= PTS is web based software a...")
 
 
(24 intermediate revisions by the same user not shown)
Line 1: Line 1:
The prescription lifecycle is highly configurable by system administrators. Sometimes, due to a misconfiguration, prescriptions may not organically disappear from your user views even though they are considered "done".
The prescription lifecycle is highly configurable by system administrators. Sometimes, due to a misconfiguration, prescriptions may not organically disappear from your user views even though they are considered "done".
=Symptoms=
=Symptoms=
Despite completing every activity in the sequence, the prescription remains on the user view/homepage, causing clutter. Given enough time the sheer number of prescriptions starts to cause performance problems.
Despite a prescription being considered finished, the prescription remains on the user view/homepage, causing confusion and clutter. As a result staff may find themselves regularly clearing all prescriptions off throughout the day - indeed over the years we've encountered a number users who have assumed this is normal.
=Cause=
PTS is web based software and while this confers huge benefits PTS is also exposed to the nature of the web in that sessions can and will time out, or be otherwise terminated if a page is left open and not interacted with for some time. This normally results in the user being returned to the login screen when they next try to use parts of the system.


As the booking in screen is typically left open for long periods of time - sometimes overnight - it is particularly vulnerable to this unavoidable aspect of the web. PC's going to sleep and users being logged out of Windows while the page is open can cause the same problem.
Given enough time the sheer number of prescriptions building up can even start to cause performance problems.


Whatever the reason, if the session is terminated in the background while the booking in screen is still open, and somebody then books something in without reloading the page, the start time of the prescription can be assigned the time when the session was last active.
=Causes=
[[File:CollectButton.png|250px|thumb|Hover over the progress button to determine what the prescription is waiting for you to do. In this example, the prescription is waiting for collection.]]
The underlying cause is that not all of the activities or tasks that have been configured for the prescription type are being done. Or less likely, the user view is set up in a way that it displays completed prescriptions.


=Solution=
The task that is at the heart of the issue can be determined by looking at one of the prescriptions that is "stuck". The clearest indication is to look at what the green "progress" button is currently expecting. Make a note of what the majority of the prescriptions are waiting for, and then move on to the appropriate solution below.
Do not attempt to interact with a web page that potentially has an expired session behind it, whether due to session time out or another reason, without closing the page and reloading it (this is not bad advice for the web in general). However we acknowledge that the PTS workflow encourages the booking in screen to be left open on certain PCs, therefore the issue was addressed at the API level in PTS v5.0.3.4, and prescription start times are now not allowed to be set to before the creation time except in very specific circumstances.


To fix the problem retroactively, this T-SQL script will correct the start time of any applicable prescriptions and set it to be the same as the creation time, and retain the delta between the start time and the target times:
Whether the task should be completed, or if the task is surplus to requirements and should be removed, is a discussion for pharmacy management, but both avenues are discussed below.


<blockquote><nowiki>UPDATE Prescriptions SET [Started] = [Created], [Requested] = [Created], [TargetCompletionTime] = DATEADD(ss, DATEDIFF(ss, [Started], [TargetCompletionTime]), [Created]), [TargetDeliveryTime] = DATEADD(ss, DATEDIFF(ss, [Started], [TargetDeliveryTime]), [Created]) WHERE ([created] > [Started] OR [created] > Requested) AND DATEDIFF(ss, [Started], [Created]) > 60 AND [Requested] = [Started]</nowiki></blockquote>
=Solutions=
<ol>


This fix is also a component of the [[Database Maintenance Script]]. Please ensure that a database backup is taken first in case you do not like the results.
<li>Prescriptions are <strong>waiting for collection</strong>:<br/>
<i>(By a long way, this is the most common situation)</i>
<ol type="a">
<li><i>[[Progressing_a_Prescription_%26_Scanning_Barcodes#Collect_a_prescription_or_bag|Collect the prescriptions]], or:</i></li>
<li><i>In the prescription type's setup page, [[Prescription_Types#Type_details_tab|turn off "record collection"]].</i></li>
</ol>
</li>


If a PTS update is not available to you for some reason, this script will create a trigger to run the fix on new prescriptions whenever they are inserted into the database:
<li>Prescriptions are <strong>waiting for delivery</strong>:
<ol type="a">
<li><i>Use the mobile app to [[Mobile_App_User_Guide|deliver the prescriptions]], or:</i></li>
<li><i>In the prescription type's setup page, [[Prescription_Types#Type_details_tab|turn off "record delivery"]].</i></li>
</ol>
</li>


<blockquote><nowiki>CREATE TRIGGER [dbo].[FixStartRequestedTimes] ON [dbo].[Prescriptions] AFTER INSERT AS BEGIN SET NOCOUNT ON; UPDATE Prescriptions SET [Started] = [Created], [Requested] = [Created], [TargetCompletionTime] = DATEADD(ss, DATEDIFF(ss, [Started], [TargetCompletionTime]), [Created]), [TargetDeliveryTime] = DATEADD(ss, DATEDIFF(ss, [Started], [TargetDeliveryTime]), [Created]) WHERE ([created] > [Started] OR [created] > Requested) AND DATEDIFF(ss, [Started], [Created]) > 60 AND [Requested] = [Started] AND PrescriptionID = (SELECT PrescriptionID FROM inserted) END</nowiki></blockquote>
<li>Prescriptions are <strong>waiting for an activity</strong> e.g. Start Labelling:
<ol type="a">
<li><i>[[Progressing_a_Prescription_%26_Scanning_Barcodes#Progressing_a_prescription|Record the activity]], or:</i></li>
<li><i>In the prescription type's setup page, [[Prescription_Types#Scanning_sequence_tab|remove the activity from the scanning sequence]].</i></li>
</ol>
</li>


Be sure to disable this trigger if and when you update beyond PTS v5.0.3.4.
<li>Prescriptions are waiting for <strong>"Start Completion", "Start Prescription Complete", "Start Final Check Complete"</strong> or similar:<br/>
<i>(For context these are the most common examples of [[Activities#Instant_activity_examples|instant activities]] set up by users to provide a firm stopping point to the end of the prescription lifecycle)</i>
<ol type="a">
<li><i>[[Progressing_a_Prescription_%26_Scanning_Barcodes#Progressing_a_prescription|Record the activity]], or:</i></li>
<li><i>Find the activity in the activities setup page, and make sure it is configured as an instant activity, and:</i></li>
<li><i>In the prescription type's setup page, [[Prescription_Types#Scanning_sequence_tab|make sure the activity is at the end of the scanning sequence]], or:</i></li>
<li><i>In the prescription type's setup page, [[Prescription_Types#Scanning_sequence_tab|remove the activity from the scanning sequence]].</i></li>
</ol>
</li>
 
</ol>
 
If none of these examples apply, it's possible (though much less likely) that the user view has been incorrectly configured to return completed prescriptions. If you are sure that the prescriptions are not waiting for any further input, yet are still erroneously showing up, see the [[Setting_Up_User_Views#Filters_tab|filters tab]] of the [[Setting Up User Views]] page to learn how to ensure the user views are set up correctly.

Latest revision as of 15:41, 20 December 2023

The prescription lifecycle is highly configurable by system administrators. Sometimes, due to a misconfiguration, prescriptions may not organically disappear from your user views even though they are considered "done".

Symptoms

Despite a prescription being considered finished, the prescription remains on the user view/homepage, causing confusion and clutter. As a result staff may find themselves regularly clearing all prescriptions off throughout the day - indeed over the years we've encountered a number users who have assumed this is normal.

Given enough time the sheer number of prescriptions building up can even start to cause performance problems.

Causes

Hover over the progress button to determine what the prescription is waiting for you to do. In this example, the prescription is waiting for collection.

The underlying cause is that not all of the activities or tasks that have been configured for the prescription type are being done. Or less likely, the user view is set up in a way that it displays completed prescriptions.

The task that is at the heart of the issue can be determined by looking at one of the prescriptions that is "stuck". The clearest indication is to look at what the green "progress" button is currently expecting. Make a note of what the majority of the prescriptions are waiting for, and then move on to the appropriate solution below.

Whether the task should be completed, or if the task is surplus to requirements and should be removed, is a discussion for pharmacy management, but both avenues are discussed below.

Solutions

  1. Prescriptions are waiting for collection:
    (By a long way, this is the most common situation)
    1. Collect the prescriptions, or:
    2. In the prescription type's setup page, turn off "record collection".
  2. Prescriptions are waiting for delivery:
    1. Use the mobile app to deliver the prescriptions, or:
    2. In the prescription type's setup page, turn off "record delivery".
  3. Prescriptions are waiting for an activity e.g. Start Labelling:
    1. Record the activity, or:
    2. In the prescription type's setup page, remove the activity from the scanning sequence.
  4. Prescriptions are waiting for "Start Completion", "Start Prescription Complete", "Start Final Check Complete" or similar:
    (For context these are the most common examples of instant activities set up by users to provide a firm stopping point to the end of the prescription lifecycle)
    1. Record the activity, or:
    2. Find the activity in the activities setup page, and make sure it is configured as an instant activity, and:
    3. In the prescription type's setup page, make sure the activity is at the end of the scanning sequence, or:
    4. In the prescription type's setup page, remove the activity from the scanning sequence.

If none of these examples apply, it's possible (though much less likely) that the user view has been incorrectly configured to return completed prescriptions. If you are sure that the prescriptions are not waiting for any further input, yet are still erroneously showing up, see the filters tab of the Setting Up User Views page to learn how to ensure the user views are set up correctly.