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...")
 
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 completing every activity in the sequence, the prescription remains on the user view/homepage, causing confusion and clutter. Given enough time the sheer number of prescriptions building up can even start to cause performance problems.
=Cause=
=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.
[[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 colelction.]]
Either not all of the activities or tasks that have been configured for the prescription type are being completed, or (less likely) the user view is set up in a way that it shows completed prescriptions.


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.
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.


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.
Whether the task <strong>should</strong> 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.


=Solution=
=Solution=
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:
<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>
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.
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:
<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>
Be sure to disable this trigger if and when you update beyond PTS v5.0.3.4.

Revision as of 11:26, 26 January 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 completing every activity in the sequence, the prescription remains on the user view/homepage, causing confusion and clutter. Given enough time the sheer number of prescriptions building up can even start to cause performance problems.

Cause

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

Either not all of the activities or tasks that have been configured for the prescription type are being completed, or (less likely) the user view is set up in a way that it shows 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.

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.

Solution