Re: EpiData-list Digest, Vol 127, Issue 9
Jamie,
Thank you so much for helpful advice - your recipe works! :-)
Defining custom command mycmd01 fas very helpful calculating hospital ward utilization starting av certain day:
CMD mycmd01 count if (inndato <= aday) and (utdato >= aday) pct=$count/9*100 //Percent utilization of a 9 bed ward type "Beds occupied on @aday : @$count Percent filled : @pct" *** Next statement adds a line to aggregate file sday = sday + $count aday = aday + 1 end
// repeating this command necessary number of times.
To take this even further, I try to produce a SPC graph of utilization rate variation over time.
I thought that I will need an aggregate file with 2 variables: Counting date (aday) and Count (of beds each day).
I have tried to use aggregate command combined with repeating the CMD segment obove, but it fails.
i have also tried to define a new REC file containing the two variables aday (or inndato) and beds=$count, and put this command into the mycmd01 block:
append aday beds /file="aggfile.rec"
I have trouble understanding the EpiDaat Process flow...
Any hints?
best regards, Vegard
2014-05-29 19:03 GMT+02:00 epidata-list-request@lists.umanitoba.ca:
Send EpiData-list mailing list submissions to epidata-list@lists.umanitoba.ca
To subscribe or unsubscribe via the World Wide Web, visit http://lists.umanitoba.ca/mailman/listinfo/epidata-list or, via email, send a message with subject or body 'help' to epidata-list-request@lists.umanitoba.ca
You can reach the person managing the list at epidata-list-owner@lists.umanitoba.ca
When replying, please edit your Subject line so it is more specific than "Re: Contents of EpiData-list digest..."
EpiData-list mailing list ___________________________________
Today's Topics:
- Community Hospital Ward utilization (epidata-list@lists.umanitoba.ca)
- Re: Community Hospital Ward utilization (epidata-list@lists.umanitoba.ca)
Message: 1 Date: Thu, 29 May 2014 00:08:58 +0200 From: epidata-list@lists.umanitoba.ca Subject: [EpiData-list] Community Hospital Ward utilization To: epidata-list@lists.umanitoba.ca Message-ID: < CAOcA-0iU6TNqJJrkPrNOtKBjwWHkhJKfUUWRZs1ib4JVUc8gBg@mail.gmail.com> Content-Type: text/plain; charset=UTF-8
Dear list, I am thinking of designing a monitoring system for a short-term community hospital ward with 9 beds
Among variables are
Patient ID indate (admission date) <dd/mm/yyyy> inhour admission hour ## outdate (discharge date) <dd/mm/yyyy> outhour discharge hour ## (not always recorded)
Age, sex diagnose1, diagnose2 diagnose3, treatment elements etc.
Does anybody have a hint on how I can monitor utilization rate, i.e. how many beds are occupied each day, and average utilization rate per week?
In Epi Info I would put up a sequence of commands that runs through the datafile for each consecutive day to count number of patients. in EpiInfo the PROCESS command would run thhrough the file and do the maths
I thought a defined variable inhouse # and a counter date gen d testdate ="01/09/2013" // Opening date
if testdate < today then if testdate >=indate and testdate <=outdate then inhouse=1 else inhouse=0 endif testdate=testdate + 1 else goto end endif
Then route to an aggregate file date, count.
PROCESS
But there seems to be no equivalent command in EpiData. I have not figured out if aggregate or stab could be used for such a purpose. Anye ideas or hints?
Best Regards Vegard Høgli Community Medical Officer Skien, Norway
Message: 2 Date: Wed, 28 May 2014 20:35:37 -0400 From: epidata-list@lists.umanitoba.ca Subject: Re: [EpiData-list] Community Hospital Ward utilization To: EpiData List epidata-list@lists.umanitoba.ca Message-ID: BLU0-SMTP92545148C20845F4C74AC1FD240@phx.gbl Content-Type: text/plain; charset="windows-1252"
In Epidata Analysis, you could do something like this for daily utilization for a whole week:
read thedatafile define aday <dd/mm/yyyy> global define sday #### global define avbed ###.#
aday = dmy(?Start day?,?Start month?,?Start year?) // allows you to set a start date // add an imif here to check validity of the start date
sday = 0 ? “Utilization for the week starting @aday"
count if (indate <= aday) and (outdate >= a day) ? “Beds used on @aday : @$count” sday = sday + $count aday = aday + 1
count if (indate <= aday) and (outdate >= a day) ? “Beds used on @aday : @$count” sday = sday + $count aday = aday + 1
// repeat last 4 steps 5 more times
avbed = float(sday)/7.0 ? “Average bed count for the week was #avbed”
Note that the 4 commands starting with count if could be used to define a cmd to simplify the program. You could also set aday this way to get the 7 previous days:
aday = today - 6
Jamie
On May 28, 2014, at 6:08 PM, epidata-list@lists.umanitoba.ca wrote:
Does anybody have a hint on how I can monitor utilization rate, i.e. how many beds are occupied each day, and average utilization rate per week?
EpiData-list@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list
End of EpiData-list Digest, Vol 127, Issue 9
As far as I can tell, there is no simple way to do this in Analysis (i.e. with a command like aggregate). The challenge is that you have patient-oriented data, with one record representing multiple bed-days and you want to massage this into day-oriented data. Aggregate is meant for data where each patient record has a variable that can take on multiple values. You don’t have any values for the days between admission and discharge.
However, I suggest the following, along the lines of what you have done already.
before you print anything, add this (outside the CMD):
set echo=off logopen “roomdata.txt” /replace type “aday, acount, apct”
Then replace your type within the CMD with:
type “ @day, @$count, @pct”
What you will print out is comma-delimited data like this:
aday, acount, apct 2014/06/10, 8, 88.888 2014/06/11, 7, 77.777 2014/06/12, 9, 100
Now, get it all back into Analysis:
logclose close set echo=on copyfile “roomdata.txt” “roomdata.csv” /replace read “roomdata.csv” * date comes in OK, but numbers are read as strings define icount ## define xpct ###.# icount = integer(acount) xpct = float(apct)
You will now have a data set in Analysis with the fields aday, acount, apct, icount, xpct date string string integer float
You can actually program your calculation of bed occupancy for an arbitrary number of days and use imid within the CMD to loop through the data. A CMD file can refer to itself! Yes, Analysis, for all its apparent simplicity, allows recursive functions! Jens and I have explained how to use this in the examples of using CMD and also on the list serve: http://lists.umanitoba.ca/pipermail/epidata-list/2009q2/001220.html Try the recursive function - I think you may have to program it to count down from the current date, as the recursive function may otherwise output the data in reverse order.
So you can accomplish all of this automatically, once you establish a start date and number of days to cover.
Jamie
On Jun 13, 2014, Vegard wrote:
Defining custom command mycmd01 fas very helpful calculating hospital ward utilization starting av certain day:
CMD mycmd01 count if (inndato <= aday) and (utdato >= aday) pct=$count/9*100 //Percent utilization of a 9 bed ward type "Beds occupied on @aday : @$count Percent filled : @pct" *** Next statement adds a line to aggregate file sday = sday + $count aday = aday + 1 end
// repeating this command necessary number of times.
To take this even further, I try to produce a SPC graph of utilization rate variation over time.
I thought that I will need an aggregate file with 2 variables: Counting date (aday) and Count (of beds each day).
I have tried to use aggregate command combined with repeating the CMD segment obove, but it fails.
i have also tried to define a new REC file containing the two variables aday (or inndato) and beds=$count, and put this command into the mycmd01 block:
append aday beds /file="aggfile.rec"
I have trouble understanding the EpiDaat Process flow...
Any hints?
best regards, Vegard
participants (1)
-
epidata-list@lists.umanitoba.ca