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 25 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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 to api.md
  • Loading branch information
Jay-sanjay committed Jun 12, 2024
commit d989ab306b6dbda41a1b33f3729c096db33d8d84
10 changes: 5 additions & 5 deletions src/preprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end


"""
function period_prior_to_index(cohort_id::Vector, conn; date_prior=Day(100), tab=cohort)
function Period_prior_to_index(cohort_id::Vector, conn; date_prior=Day(100), tab=cohort)
Jay-sanjay marked this conversation as resolved.
Show resolved Hide resolved

Given a vector of cohort IDs, this function returna a DataFrame with the cohort_start_date adjusted by the date_prior.

Expand All @@ -79,7 +79,7 @@ function period_prior_to_index(cohort_id::Vector, conn; date_prior=Day(100), tab

- DataFrame with the cohort_start_date adjusted by the date_prior.
"""
Jay-sanjay marked this conversation as resolved.
Show resolved Hide resolved
function period_prior_to_index(cohort_id::Vector, conn; date_prior=Day(100), tab=cohort)
function Period_prior_to_index(cohort_id::Vector, conn; date_prior=Day(100), tab=cohort)

# Construct the SQL query
sql = From(tab) |>
Expand All @@ -102,7 +102,7 @@ end


"""
function period_prior_to_index(person_ids::Vector, start_date_on_person::Function, conn; date_prior=Day(100))
function Period_prior_to_index(person_ids::Vector, start_date_on_person::Function, conn; date_prior=Day(100))

Given a vector of person IDs, this function returns a DataFrame with the cohort_start_date adjusted by the date_prior.

Expand All @@ -120,7 +120,7 @@ function period_prior_to_index(person_ids::Vector, start_date_on_person::Functio

- DataFrame with the cohort_start_date adjusted by the date_prior.
"""
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(
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;
Expand All @@ -144,4 +144,4 @@ function period_prior_to_index(
end


export Dummy, period_prior_to_index, Dummy2
export Dummy, Period_prior_to_index, Dummy2
4 changes: 2 additions & 2 deletions test/Data-Preprocessing/preprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ end

test_df2 = DataFrame(person_id = test_person_ids, cohort_start_date = test_cohort_start_date)

result = period_prior_to_index(test_person_ids, sqlite_conn)
result = Period_prior_to_index(test_person_ids, sqlite_conn)

println(result)

Expand All @@ -47,7 +47,7 @@ end
return sql
end

result = period_prior_to_index(test_person_ids, start_date_on_person, sqlite_conn)
result = Period_prior_to_index(test_person_ids, start_date_on_person, sqlite_conn)

@test test_person_ids == result.cohort_definition_id[1:5]
@test test_subject_ids == result.subject_id[1:5]
Jay-sanjay marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading