Skip to content
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

Adding Period_prior_to_index function #35

Open
wants to merge 27 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
01cc575
Intiaial dispatch for period_prior_to_index function
Jay-sanjay Jun 5, 2024
6c6780c
trying to debug
Jay-sanjay Jun 5, 2024
b239985
Added the second dispatch
Jay-sanjay Jun 7, 2024
9039db8
Tests added for the second dispatch
Jay-sanjay Jun 7, 2024
a0a64b1
debugging
Jay-sanjay Jun 8, 2024
a3e1c10
debugging
Jay-sanjay Jun 8, 2024
ec9d500
print
Jay-sanjay Jun 8, 2024
f90444d
print
Jay-sanjay Jun 8, 2024
ce88cd5
Docs Strings added
Jay-sanjay Jun 12, 2024
57a4ab1
Added to api.md
Jay-sanjay Jun 12, 2024
d989ab3
Added to api.md
Jay-sanjay Jun 12, 2024
01ac533
added to api.md
Jay-sanjay Jun 12, 2024
6ce8bd3
Update preprocessing.jl
Jay-sanjay Jun 12, 2024
96f8457
Create cohort on Eunomia for testing
TheCedarPrince Jun 14, 2024
6b1e001
Merge branch 'dev' into period_prior_to_index
TheCedarPrince Jun 14, 2024
bb3856c
Update preprocessing.jl
Jay-sanjay Jun 24, 2024
3cdc4e3
added requested changes
Jay-sanjay Jun 24, 2024
65cfe3e
added more changes
Jay-sanjay Jun 24, 2024
e23dab5
added requested changes
Jay-sanjay Jun 28, 2024
0488869
Merge branch 'dev' into period_prior_to_index
Jay-sanjay Jun 30, 2024
13b1f45
Update api.md
Jay-sanjay Jun 30, 2024
f446cbc
Update preprocessing.jl
Jay-sanjay Jul 1, 2024
6fe7490
Update preprocessing.jl
Jay-sanjay Jul 1, 2024
c929d81
bug fixed
Jay-sanjay Jul 1, 2024
ac4410a
Update preprocessing.jl
Jay-sanjay Jul 1, 2024
a5f59dd
Merge branch 'dev' into period_prior_to_index
Jay-sanjay Jul 17, 2024
1432c24
Update preprocessing.jl
Jay-sanjay Jul 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added the second dispatch
  • Loading branch information
Jay-sanjay committed Jun 7, 2024
commit b239985e8181900f646c4f92d974d63c5754e9df
27 changes: 27 additions & 0 deletions src/preprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,31 @@ function period_prior_to_index(cohort_id::Vector, conn; date_prior=Day(100), tab
return df
end

"""
TODO: Add Doc-Strings.
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an example section here about how to call this function and how to pass in a function into the argument which accepts a user defined function? So show how to make a function? Thanks!

function period_prior_to_index(
person_ids::Vector,
Jay-sanjay marked this conversation as resolved.
Show resolved Hide resolved
start_date_on_person::Function,
conn;
date_prior=Day(100)
)

tables = GenerateTables(conn, inplace = false, exported=true)

sql = start_date_on_person(person_ids, tables)

df = DBInterface.execute(conn, String(sql)) |> DataFrame
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to put this line before sql to compute the cohorts.


# Check if the DataFrame is not empty
# TODO: Is it really necessary to add this check ??
Jay-sanjay marked this conversation as resolved.
Show resolved Hide resolved
if nrow(df) > 0
# Convert the cohort_start_date to DateTime and subtract the date_prior
df.cohort_start_date = DateTime.(df.cohort_start_date) .- date_prior
end

return df
end


export Dummy, period_prior_to_index
Loading