-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function to get periodPriorToIndex
#1
Comments
Just copying our discussion from Slack to here so we don't lose the ideas:
I think this approach sounds great! For the first version of this function, we'll want to be able to pass it a connection object, a list of cohorts to examine (like in OCC), and a date time object. A potential API might look like this: function period_prior_to_index(cohort_ids::Vector, conn; date_prior::DateTime = 100 Days)
#=
Code that does neat stuff
=#
#=
Code that will do something approximately like this:
1. Reads selected patient cohorts from the cohort table
2. Find each patients entry date
3. Apply period prior to each patient entry date
=#
end Two more interesting dispatches will be if we do not have defined cohorts. This would be much more tricky to do but I think very useful and interesting. Here is how these dispatches would work: The first dispatch would only care about the following: function period_prior_to_index(person_ids::Vector, conn; index_date::Symbol, date_prior::DateTime = 100 Days)
#=
Code that reads some defaults for index_date.
These defaults could be things like:
:last_observation -- the index date of each patient is their last recorded observation
:last_visit -- the index date of each patient is their last recorded visit
:last_refill -- the index date of each patient is their last recorded refill
And then the code would need to handle these defaults
=#
#=
Code that will do something approximately like this:
1. Queries desired patients from person table
2. Calculates index_date default per patient
3. Applies date_prior to each patient index date
=#
end The final dispatch I have in mind is somehow both easier and harder than the previous one. What this accepts for the index_date is a function defined by the user that calculates the index date; it can pass the connection object and vector of person ids to this function and should return a dataframe of index dates per person_id. Here's how it looks: function period_prior_to_index(person_ids::Vector, conn; index_date::Function, date_prior::DateTime = 100 Days)
#=
Apply the index_date function like this:
patient_date_indices = index_date(person_ids, conn)
=#
#=
Code that will do something approximately like this:
1. Queries desired patients from person table
2. Calculates index_date default per patient
3. Applies date_prior to each patient index date
=#
end Finally, it will be curious to see how well all the dispatches will be able to parallelize. We will want to test that out at some point too. Hope this helps @Jay-sanjay! |
Hi @TheCedarPrince here is the way I have thought for the first two dispatches using FunSQL:
and
|
Also I here is the first dispatch I have tried using TIderDB
|
Hey @Jay-sanjay , after spending some time experimenting with your implementations, I think the overall dispatch ideas look great. I'm looking forward to chatting further tomorrow on this to hear your opinions and thoughts here! |
Shri !!
The first decision that needs to be made is the moment in time from which selected treatments of interest should be included in
the treatment pathway.
periodPriorToIndex
specifies the period (i.e. number of days) prior to the index date from whichtreatments should be included.
The text was updated successfully, but these errors were encountered: