Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Wondering if anyone can help on some set analysis syntax I’m trying to write.
I have a table of data that gives me all the operations performed in our operating theatres.
I’ve been able to ascertain if the operation took place in the morning or in the afternoon.
I’ve also been able to ascertain if there was 1 or more surgeons for the whole day.
The table below gives a very basic snapshot of some of the fields from my dataset.
What I’m trying to ascertain is the number of ‘Morning Only’ sessions, number of ‘Afternoon Only’ sessions and number of ‘All Day’ sessions.
Morning Only – if a surgeon performs at least one procedure in an OR in the morning session on a given date.
Afternoon Only – if a surgeon performs at least one procedure in an OR in the afternoon session on a given date.
All Day – if a surgeon performs at least one procedure in an OR in the morning AND the afternoon on a given date.
For the example above on 22/01/2020:
OR01 – Young,Steven had a morning only session, no session took place in the afternoon
OR02 – Byrne,Stefan had a morning only session, Ali,Zulfiquar had an afternoon only session
OR03 – McGoldrick,Fergal had an all day session (he had operations in both morning and afternoon)
OR04 - Allen,Mike had an all day session
I’m struggling to come up with the correct syntax to reflect this.
For morning only and similarly afternoon only sessions I had the following syntax
Count({<TimeFlag={'Morning'},Surgeons={"=Surgeons > 1"}>}Distinct OR_Date)
However this does not count the days where only a morning or only an afternoon session took place.
Really what I’m looking for is some way to write the following.
“Count all the distinct OR_Dates where (the TimeFlag is morning AND the Surgeons is greater than 1)………. OR (the TimeFlag is morning and the Surgeons is equal to 1 and there is no afternoon timeflag)”
For the all day sessions I’m looking for
“Count all the distinct OR_Dates where the Surgeons equal 1 and there is at least 1 morning timeflag and 1 afternoon timeflag.”
Could really do with someones expertise on this 😊 thanks
may be
morning-
Count({<TimeFlag={'Morning'},Surgeons={"> =1"}>}Distinct OR_Date)
afternoon-
Count({<TimeFlag={'Afternoon'},Surgeons={">= 1"}>}Distinct OR_Date)
allday-
Count({<TimeFlag={'Morning','Afternoon'},Surgeons={"> =1"}>}Distinct OR_Date)
maybe this:
= Count( {
< TimeFlag = {'Morning'}, Surgeons = {">1"} >
+
< TimeFlag = {'Morning'}, Surgeons = {"=1"}, TimeFlag -= {'Afternoon'} >
} Distinct OR_Date )
For the all day sessions:
= Count( {
< Surgeons = {"=1"}, OR_Date = {"=count( {< TimeFlag = {'Morning'} >} OR_Date ) >= 1 and count( {< TimeFlag = {'Afternoon'} >} OR_Date ) >= 1"} >
} Distinct OR_Date )
I hope it can helps.