Amazon Simple Work Flow ( http://aws.amazon.com/swf/ ) is a programmable workflow engine. Workflows can create child work flows, etc. So, one could create a workflow that involves ordering a blood test, checking that it has been done, checking for normality, deciding whether to send a copy to the patient, or some other action, and perhaps triggering some checklist for patients who are diabetic if the test is a blood sugar. Actions can be performed by agents, or people, and from any device that has an internet connection. Would be a lot of work but would be interesting in tying everything together.
This is a video that explains how SWF works. Workflows can last up to 1 year, and if you need longer, you can run again.
So, let's consider a HbA1c workflow. DM patient detected ( at consult, when diagnosis added, or when DB scanned ) A serial HbA1c workflow is initiated HbA1c is ordered -> result is waited ( has timeout at 7 months ) -> result received -> workflow terminates, and new serial HbA1c workflow is initiated If result waiting times out, alert is sent to user, and workflow is cancelled ( eg. patient deceased or left the practice ) Or email reminder send to patient Or user increases timeout If result is abnormal Alert is sent to user All the decision making is made by the decider process which could be running on any CPU, and worker processes likewise. But they need a way to interrogate the Synapse database Decider, and workers can ask for input from users So, you could have potentially 1000s of workers and workflows running to automate the practice. What happens if the CPU running a worker, or decider crashes? Nothing. Workflows are stateless and can be restarted at any time.
After working on this for a couple of days I have made some progress and can now call the Amazon SWF api. Now to see if I can get anything else working ....
Can start a workflow, schedule a task, complete the task and then close the workflow down. You need to be signed up to Amazon SWF to use this. Note that tasks can be done by any software or person that can interact with the Amazon SWF api. So you could have a task like review an abnormal result and you could do that on your smart phone ...
Sounds cool I'd like to be able to do this from a Synapse popup. .... as fast as possible. Control + t (New task on this patient). order bone density for this patient. Indication: osteoporosis. [enter] (popup automatically closes).
So, have to make some decisions on how this works. Order-future-investigation workflow Date for when investigation has to be ordered ( can be years in the future though workflows only last 1 year, can just create a child workflow for the next year) Person for whom the test is being ordered Person who has to order the test ie. complete the task Another task to notify patient Another task to check for when test is done somehow ... Close workflow.
Beginning to think this is just for office tasks .. and keep ticklers separate. Can now schedule a workflow but working this out on how to effectively integrate is proving difficult.
Simple Workflow or Task Engine This is for passing tasks to the secretary/receptionist or whoever. It is not for ticklers. So, a task might be to make an appt for someone, contact them etc. You need to sign up to Amazon Simple Workflow ( http://aws.amazon.com/swf/ ) and we are hoping to stay within the free level Make sure that your keys are saved in Settings/User/Backup S3 (AWS keys ) which are the same keys used for backups In the SWF console ( https://console.aws.amazon.com/swf/home ) create a domain named "867530903" used for all the workflows. We can change this later on, but it is currently hard coded into Synapse Click on Workflow types, select 867530903 from the Domain dropdown, and register a new workflow type named "BookOurApptsWorkflow" version 1.0 Use these values Task List: mainTaskList Execution Start To Close Timeout: 7 days Task Start To Close Timeout: 10 minutes Child Policy: TERMINATE Register a new activity type named "bookOurAppt" version 1.0 Task List: mainTaskList Task Schedule To Start Timeout: 5 minutes Task Start To Close Timeout: 10 minutes (page 2 items) Task Schedule To Close Timeout: 7 days Task Heartbeat Timeout: Not Specified Download the decider.exe from http://synapsebeta.s3.amazonaws.com/decider.exe and run it once. It will produce an error message (just press enter) and will create a template config file (called: swf-config-skeleton.r). Open this in a text editor and save it as swf-config.r (make sure it ends in .r not .r.txt) This program will run 24/7. Update Synapse to 218 B93 which has the task management Running the Synapse Task Manager In Settings/Lists/SWF, click on "Get Temporary Credentials" ( might need to do that twice ) so that the keys appear. These keys can last 24 hours or less depending on what master keys you used Click on "list active workflows" to ensure that your keys work Click on in the functions list, the "Tasks, Manage" entry Click on "Office Task" for a non-patient entry Enter the task in the "Data" line, and then "Start Workflow" Close the task manager To see the active workflows, go to Settings/list/swf and click on "list active workflows" You can click on anyone of them, and then the task history appears. To perform the task, go to Settings/list/swf, and click on "Work a task". Once you have the task up, you MUST either cancel, complete or postpone. If it's a patient task, you can't complete until the patient is selectedThe workflow definition above lasts a week. After that it times out and is cancelled. There is no way in Synapse to track timed out tasks so you'll need the Amazon SWF console in the meantime. To bring up the task manager in a consult, with the cursor on some text, click Control-T to bring up the task manager, and the underlying text is transferred to the task screen. Why is this so complex? Because you can have unlimited Synapse clients working on tasks, and you can write your own client for use on a phone, web page etc.
Although the definition for a task above can only last 10 mins, the tasks created by Synapse will last 7 days before timing out. If they timeout I don't know what happens as I haven't been there yet!! Let's see how this works before I make it more configurable.
BTW, currently this runs independently of the Synapse database. Once we have some experience we can figure out what we need to capture as opposed to leaving it all on Amazon.
Can now postpone tasks so that they don't appear for upto 6 days. No point going beyond that as the workflow only lasts 7 days.