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

Tag New Release of 0.5.0 #76

Merged
merged 78 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
67e276c
Removed type signatures + fixed docstrings; lowercased table names an…
TheCedarPrince Jul 29, 2022
be60895
Added TODO's for what tests to write
TheCedarPrince Jul 29, 2022
b05f4a5
Removed type signatures and added TODO for futures
TheCedarPrince Jul 29, 2022
7fb55e7
Removed type signatures
TheCedarPrince Jul 29, 2022
564d9e9
Removed type signatures
TheCedarPrince Jul 29, 2022
b5100e0
Raised proposal to CDM maintainers and am awaiting feedback before mo…
TheCedarPrince Aug 3, 2022
aa9bbc8
Removed type signatures and fixed bug with GetPatientVisits to correc…
TheCedarPrince Aug 3, 2022
df26222
Changed docstring in StateFilterPersonIDs and enforced uppercasing fo…
TheCedarPrince Aug 3, 2022
f77547b
Added and updated CHANGELOG
TheCedarPrince Aug 3, 2022
a7238a9
Bumped project version numbers for new release
TheCedarPrince Aug 3, 2022
b960d17
Removed as it was an early testing prototype file
TheCedarPrince Aug 3, 2022
77855bf
Merge branch 'dev'
TheCedarPrince Aug 5, 2022
c83835c
Began revising tutorial documentation
TheCedarPrince Aug 5, 2022
76ccd9e
Removed Manifest file for package
TheCedarPrince Aug 5, 2022
62bd9d8
Added Dates and TimeZones deps for managing age groups
TheCedarPrince Aug 5, 2022
c968798
Disallowed some exports and created new function for generating defaults
TheCedarPrince Aug 5, 2022
ac7862e
Added new deps Dates and TimeZones for time management
TheCedarPrince Aug 5, 2022
a50b1e2
Began refactoring of GetPatientAgeGroup
TheCedarPrince Aug 5, 2022
06dd9ab
Refactored GetPatientAgeGroup to correctly get age group of patients
TheCedarPrince Aug 5, 2022
79441f3
Removed AgeGroupFilter in favor of supporting GetPatientAgeGroup and …
TheCedarPrince Aug 5, 2022
5a4218a
Added SampleData compat and dependency
TheCedarPrince Aug 7, 2022
0b90d2b
Renamed files and fixed docs
TheCedarPrince Aug 7, 2022
4188193
Fixed documentation and fixed methods for calculating age
TheCedarPrince Aug 7, 2022
7c3cb31
Added helper function to determine year
TheCedarPrince Aug 7, 2022
7c041c7
Started adding first batch of tests
TheCedarPrince Aug 7, 2022
9e4ce81
Added helpers file
TheCedarPrince Aug 7, 2022
8d63857
Removed entry for SampleHealthData until merge of package occurs
TheCedarPrince Aug 8, 2022
e631492
Converted this function to internal helper function
TheCedarPrince Aug 8, 2022
348a290
Added new tests and dependencies
TheCedarPrince Aug 8, 2022
eb5c8cf
Added tests for GetPatientGender, GetPatientAgeGroup, GetPatientRace,…
TheCedarPrince Aug 8, 2022
de480a9
Added ignore for various Julia artifacts
TheCedarPrince Aug 8, 2022
4559b62
Initial drafting of full tutorial
TheCedarPrince Aug 8, 2022
444e7d4
Merge branch '0.1.0' into docs
TheCedarPrince Aug 8, 2022
f2879a0
Finished initial beginner tutorial
TheCedarPrince Aug 8, 2022
4c3968c
Updated README with badges and documentation link
TheCedarPrince Aug 8, 2022
b4a3291
Modified footer
TheCedarPrince Aug 8, 2022
1061eda
Updated landing page
TheCedarPrince Aug 8, 2022
fd0f974
Reordered pages on sidebar
TheCedarPrince Aug 8, 2022
8bd33dc
Updated changelog for new release
TheCedarPrince Aug 8, 2022
449c788
Beginning draft of submission
TheCedarPrince Sep 13, 2022
07c47cc
Creating header affiliations
TheCedarPrince Sep 13, 2022
5926070
Autogenerated or compiled files
TheCedarPrince Sep 13, 2022
e53b586
Ruby routine for generating header.tex
TheCedarPrince Sep 13, 2022
4c35047
Removed Memoization dependency for user flexibility
TheCedarPrince Sep 13, 2022
2879630
Added dispatches to render SQL; found bug in GetPatientAgeGroup
TheCedarPrince Sep 14, 2022
17a91c3
Added get function for ethnicity
TheCedarPrince Sep 21, 2022
35c457b
Cherry picking some files to resolve conflicts
TheCedarPrince Oct 12, 2022
bacba83
Merge branch 'main' into dev
TheCedarPrince Oct 12, 2022
da3e5f2
Initial Tests for Getters, Filters, and Executors (#24)
VarshC Oct 12, 2022
ba0a93e
Began process of major refactor to enable SQL rendering
TheCedarPrince Oct 18, 2022
419c768
Simplify Age Calculations (#27)
TheCedarPrince Oct 19, 2022
8cb40d9
Updated tests for helper functions
TheCedarPrince Oct 23, 2022
796f7b1
Added Additional Test Coverage for Getters and Helpers (#28)
TheCedarPrince Oct 23, 2022
94e52f3
Fix to Docs Deployment (#29)
TheCedarPrince Oct 23, 2022
70146eb
Update to Beginner Tutorial and Minor Refactor of Tutorials Layout (#30)
TheCedarPrince Oct 23, 2022
60cf9ac
Overhaul of Docs (#31)
TheCedarPrince Oct 24, 2022
8b1707c
Updated and fixed Citation file (#32)
TheCedarPrince Oct 24, 2022
e4218dc
Expanded CI to test on Windows & OSX and Julia Versions 1, Nightly, a…
TheCedarPrince Nov 5, 2022
32fe5d4
Merge branch 'main' into dev
TheCedarPrince Nov 5, 2022
5341bca
Added function to get place of service information (#39)
TheCedarPrince Nov 6, 2022
7c6e333
Added GetVisitConcept getter function (#41)
TheCedarPrince Nov 6, 2022
e0341a4
issue #44 add GetVisitDate (#45)
VarshC Feb 22, 2023
06af0cd
Adding the column name (#43)
Farreeda Feb 25, 2023
22f5e48
Bumped compat and release version
TheCedarPrince Feb 28, 2023
57f9a8a
Updated CHANGELOG for new release
TheCedarPrince Feb 28, 2023
e0a20e5
Bumped release version
TheCedarPrince Feb 28, 2023
e3fd1ce
Merge branch 'main' into dev
TheCedarPrince Feb 28, 2023
fff44e6
Resolve merge conflicts
TheCedarPrince Oct 26, 2023
c0df24d
Added GetVisitProcedure associated with someones visit (#59)
Jay-sanjay Oct 26, 2023
abd9f5c
Resolving `ExecuteAudit` function getting Breaked Easily (#60)
Jay-sanjay Oct 26, 2023
5a0a09a
renamed to GetDrugExposureIDs (#63)
Jay-sanjay Nov 11, 2023
3200fd1
Creating Queries That Return Cohort Information (#61)
Jay-sanjay Nov 24, 2023
df10325
Merge with latest release
TheCedarPrince Jan 15, 2024
15b8500
Added GetDrugExposureEndDate function (#71)
Jay-sanjay Jan 15, 2024
bd6739f
Added GetDrugExposureStartDate function (#72)
Jay-sanjay Jan 25, 2024
824afbe
Added a better Default for GetPatientAgeGroup (#75)
Jay-sanjay Feb 21, 2024
dd7254e
Bumped compat entry for FunSQL
TheCedarPrince Feb 22, 2024
678f7d2
updates for new release
Jay-sanjay Feb 22, 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
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [0.5.0] - February 23rd, 2024

Patch release to add in some new features and fixes

### Added

- Added Getters for Drug Exposures

* GetDrugExposureStartDate

* GetDrugExposureEndDate

- Misc

* Minor fixes in GetPatientAgeGroup Function

- Extensive test suite for new features


## [0.4.0] - December 1st, 2023

Patch release to add in some new features and fixes
Expand Down
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors:
given-names: Fareeda
- family-names: Sanjay
given-names: Jay
title: "OMOPCDMCohortCreator 0.4.0"
version: 0.4.0
title: "OMOPCDMCohortCreator 0.5.0"
version: 0.5.0
doi: 10.5281/zenodo.7052105
date-released: 2023-12-01
date-released: 2024-02-23
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OMOPCDMCohortCreator"
uuid = "f525a15e-a73f-4eef-870f-f901257eae22"
authors = ["Jacob Zelko <[email protected]>", "Fareeda Abdelazeez", "Varshini Chinta", "Jay Sanjay <[email protected]>"]
version = "0.4.0"
version = "0.5.0"

[deps]
DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965"
Expand Down
2 changes: 2 additions & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ GetCohortSubjects
GetCohortSubjectStartDate
GetCohortSubjectEndDate
GetVisitProcedure
GetDrugExposureEndDate
GetDrugExposureStartDate
```

## Filters
Expand Down
198 changes: 189 additions & 9 deletions src/getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@
[80, 89],
],
tab = person,
ungrouped_label = "Unspecified"
)

Finds all individuals in age groups as specified by `age_groupings`.
Expand All @@ -451,6 +452,8 @@
- any year provided by a user as long as it is an `Integer` (such as 2022, 1998, etc.)

- `tab` - the `SQLTable` representing the Person table; default `person`

- `ungrouped_label` - the label to assign persons who do not fit to a provided matching age group; default label "Unspecified"

# Returns

Expand Down Expand Up @@ -483,10 +486,11 @@
[70, 79],
[80, 89],
],
tab=person
tab=person,
ungrouped_label = "Unspecified"
)

df = DBInterface.execute(conn, GetPatientAgeGroup(ids; minuend=minuend, age_groupings=age_groupings, tab=tab)) |> DataFrame
df = DBInterface.execute(conn, GetPatientAgeGroup(ids; minuend=minuend, age_groupings=age_groupings, tab=tab, ungrouped_label=ungrouped_label)) |> DataFrame

return df

Expand All @@ -504,7 +508,9 @@
[60, 69],
[70, 79],
[80, 89],
], tab = person)
],
tab = person,
ungrouped_label = "Unspecified")

Given a `DataFrame` with a `:person_id` column, return the `DataFrame` with an associated `:ageGroup` for each person in the `DataFrame`

Expand All @@ -515,13 +521,13 @@
df::DataFrame,
conn;
minuend=:now,
tab=person
tab=person,
ungrouped_label = "Unspecified"
)

df_ids= df[:,"person_id"]


return outerjoin(GetPatientAgeGroup(df_ids, conn; minuend=minuend, tab=tab), df, on = :person_id)
return outerjoin(GetPatientAgeGroup(df_ids, conn; minuend=minuend, tab=tab, ungrouped_label=ungrouped_label), df, on = :person_id)
end

"""
Expand All @@ -540,6 +546,7 @@
[80, 89],
],
tab = person,
ungrouped_label = "Unspecified"
)

Return SQL statement that assigns an age group to each patient in a given patient list.
Expand All @@ -559,6 +566,8 @@

- `tab` - the `SQLTable` representing the Person table; default `person`

- `ungrouped_label` - the label to assign persons who do not fit to a provided matching age group; default label "Unspecified"

# Returns

- `df::DataFrame` - a two column `DataFrame` comprised of columns: `:person_id` and `:age_group`
Expand Down Expand Up @@ -589,7 +598,8 @@
[70, 79],
[80, 89],
],
tab=person
tab=person,
ungrouped_label = "Unspecified"
)

minuend = _determine_calculated_year(minuend)
Expand All @@ -603,7 +613,7 @@
sql = From(tab) |>
Where(Fun.in(Get.person_id, ids...)) |>
Select(Get.person_id, :age => minuend .- Get.year_of_birth) |>
Define(:age_group => Fun.case(age_arr...)) |>
Define(:age_group => Fun.case(age_arr..., ungrouped_label)) |>
Select(Get.person_id, Get.age_group) |>
q -> render(q, dialect=dialect)

Expand Down Expand Up @@ -1885,4 +1895,174 @@

end

export GetDatabasePersonIDs, GetPatientState, GetPatientGender, GetPatientRace, GetPatientAgeGroup, GetPatientVisits, GetMostRecentConditions, GetMostRecentVisit, GetVisitCondition, GetPatientEthnicity, GetDatabaseYearRange, GetVisitPlaceOfService, GetVisitConcept, GetVisitDate, GetDrugExposures, GetDrugConceptIDs, GetDrugAmounts, GetVisitProcedure, GetDatabaseCohorts, GetCohortSubjects, GetCohortSubjectStartDate, GetCohortSubjectEndDate, GetDrugExposureIDs
"""
function GetDrugExposureEndDate(drug_exposure_ids, conn; tab = drug_exposure)

Given a list of drug_exposure IDs, find their exposure end dates.

# Arguments:

- `drug_exposure_ids` - list of `drug_exposure_id`'s; each ID must be of subtype `Float64`

- `conn` - database connection using DBInterface


# Keyword Arguments:

- `tab` - the `SQLTable` representing the Drug Exposure table; default `drug_exposure`

# Returns

- `df::DataFrame` - a two column `DataFrame` comprised of columns: `:drug_exposure_id` and `:drug_exposure_end_date`
"""

function GetDrugExposureEndDate(
drug_exposure_ids,
conn;
tab = drug_exposure
)

df = DBInterface.execute(conn, GetDrugExposureEndDate(drug_exposure_ids; tab=tab)) |> DataFrame

return df
end

"""
function GetDrugExposureEndDate(df:DataFrame, conn; tab = drug_exposure)

Given a DataFrame with a :drug_exposure_id column, return the DataFrame with an associated :drug_exposure_end_date corresponding to a given drug_exposure_id in the DataFrame.

Multiple dispatch that accepts all other arguments like in ` GetDrugExposureEndDate(ids, conn; tab = drug_exposure)`
"""

function GetDrugExposureEndDate(

Check warning on line 1938 in src/getters.jl

View check run for this annotation

Codecov / codecov/patch

src/getters.jl#L1938

Added line #L1938 was not covered by tests
df::DataFrame,
conn;
tab = drug_exposure
)

df_ids = df[:,"drug_exposure_id"]

Check warning on line 1944 in src/getters.jl

View check run for this annotation

Codecov / codecov/patch

src/getters.jl#L1944

Added line #L1944 was not covered by tests

return outerjoin(GetDrugExposureEndDate(df_ids, conn; tab=tab), df, on = :drug_exposure_id)

Check warning on line 1946 in src/getters.jl

View check run for this annotation

Codecov / codecov/patch

src/getters.jl#L1946

Added line #L1946 was not covered by tests

end

"""
function GetDrugExposureEndDate(drug_exposure_ids; tab = drug_exposure)

Given a list of drug_exposure IDs, find their corresponding drug_exposure_end_date ID.

# Arguments:

- `drug_exposure_ids` - list of `drug_exposure_id`'s; each ID must be of subtype `Float64`


# Keyword Arguments:

- `tab` - the `SQLTable` representing the Drug Exposure table; default `drug_exposure`

# Returns

- SQL statement comprised of: `:drug_exposure_id` and `:drug_exposure_end_date`
"""
function GetDrugExposureEndDate(
drug_exposure_ids;
tab = drug_exposure
)

sql =
From(tab) |>
Where(Fun.in(Get.drug_exposure_id, drug_exposure_ids...)) |>
Select(Get.drug_exposure_id, Get.drug_exposure_end_date) |>
q -> render(q, dialect=dialect)

return String(sql)

end

"""
function GetDrugExposureStartDate(drug_exposure_ids, conn; tab = drug_exposure)

Given a list of drug_exposure IDs, find their exposure start dates.

# Arguments:

- `drug_exposure_ids` - list of `drug_exposure_id`'s; each ID must be of subtype `Float64`

- `conn` - database connection using DBInterface


# Keyword Arguments:

- `tab` - the `SQLTable` representing the Drug Exposure table; default `drug_exposure`

# Returns

- `df::DataFrame` - a two column `DataFrame` comprised of columns: `:drug_exposure_id` and `:drug_exposure_start_date`
"""

function GetDrugExposureStartDate(
drug_exposure_ids,
conn;
tab = drug_exposure
)

df = DBInterface.execute(conn, GetDrugExposureStartDate(drug_exposure_ids; tab=tab)) |> DataFrame

return df
end

"""
function GetDrugExposureStartDate(df:DataFrame, conn; tab = drug_exposure)

Given a DataFrame with a :drug_exposure_id column, return the DataFrame with an associated :drug_exposure_start_date corresponding to a given drug_exposure_id in the DataFrame.

Multiple dispatch that accepts all other arguments like in ` GetDrugExposureStartDate(ids, conn; tab = drug_exposure)`
"""
function GetDrugExposureStartDate(

Check warning on line 2022 in src/getters.jl

View check run for this annotation

Codecov / codecov/patch

src/getters.jl#L2022

Added line #L2022 was not covered by tests
df::DataFrame,
conn;
tab = drug_exposure
)

df_ids = df[:,"drug_exposure_id"]

Check warning on line 2028 in src/getters.jl

View check run for this annotation

Codecov / codecov/patch

src/getters.jl#L2028

Added line #L2028 was not covered by tests

return outerjoin(GetDrugExposureStartDate(df_ids, conn; tab=tab), df, on = :drug_exposure_id)

Check warning on line 2030 in src/getters.jl

View check run for this annotation

Codecov / codecov/patch

src/getters.jl#L2030

Added line #L2030 was not covered by tests

end

"""
function GetDrugExposureStartDate(drug_exposure_ids; tab = drug_exposure)


Given a list of drug_exposure IDs, find their corresponding drug_exposure_start_date ID.

# Arguments:

- `drug_exposure_ids` - list of `drug_exposure_id`'s; each ID must be of subtype `Float64`


# Keyword Arguments:

- `tab` - the `SQLTable` representing the Drug Exposure table; default `drug_exposure`

# Returns

- SQL statement comprised of: `:drug_exposure_id` and `:drug_exposure_start_date`
"""
function GetDrugExposureStartDate(
drug_exposure_ids;
tab = drug_exposure
)

sql =
From(tab) |>
Where(Fun.in(Get.drug_exposure_id, drug_exposure_ids...)) |>
Select(Get.drug_exposure_id, Get.drug_exposure_start_date) |>
q -> render(q, dialect=dialect)

return String(sql)

end

export GetDatabasePersonIDs, GetPatientState, GetPatientGender, GetPatientRace, GetPatientAgeGroup, GetPatientVisits, GetMostRecentConditions, GetMostRecentVisit, GetVisitCondition, GetPatientEthnicity, GetDatabaseYearRange, GetVisitPlaceOfService, GetVisitConcept, GetVisitDate, GetDrugExposures, GetDrugConceptIDs, GetDrugAmounts, GetVisitProcedure, GetDatabaseCohorts, GetCohortSubjects, GetCohortSubjectStartDate, GetCohortSubjectEndDate, GetDrugExposureIDs, GetDrugExposureEndDate, GetDrugExposureStartDate
40 changes: 37 additions & 3 deletions test/sqlite/getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ end
push!(age_groups, default_age_grouping_values[idx])
break
elseif ismissing(grouping)
push!(age_groups, missing)
push!(age_groups, "Unspecified")
end
end
end
Expand All @@ -74,7 +74,7 @@ end
default_test = default_test[!, [:person_id, :age_group]]
default_test.age_group = convert(Vector{Union{Missing,String}}, default_test.age_group)

minuend_now_test = DataFrame(:person_id => [6.0, 123.0, 129.0, 16.0, 65.0, 74.0, 42.0, 187.0, 18.0, 111.0], :age_group => ["55 - 59", "70 - 74", "45 - 49", "50 - 54", "55 - 59", "50 - 54", missing, "75 - 79", "55 - 59", "45 - 49"])
minuend_now_test = DataFrame(:person_id => [6.0, 123.0, 129.0, 16.0, 65.0, 74.0, 42.0, 187.0, 18.0, 111.0], :age_group => ["55 - 59", "70 - 74", "45 - 49", "50 - 54", "55 - 59", "50 - 54", "Unspecified", "75 - 79", "55 - 59", "45 - 49"])

@test isequal(default_test, GetPatientAgeGroup(test_ids, sqlite_conn; minuend=default_minuend, age_groupings=default_age_grouping))
@test isequal(minuend_now_test, GetPatientAgeGroup(test_ids, sqlite_conn; minuend=minuend_now, age_groupings=test_age_grouping_2))
Expand Down Expand Up @@ -341,7 +341,7 @@ end
push!(age_groups, default_age_grouping_values[idx])
break
elseif ismissing(grouping)
push!(age_groups, missing)
push!(age_groups, "Unspecified")
end
end
end
Expand Down Expand Up @@ -526,6 +526,40 @@ end
@test test_ids == new[1:1]
end

@testset "GetDrugExposureEndDate" begin

test_drug_exposure_ids = [1.0, 2.0, 3.0, 4.0, 5.0]

test_drug_exposure_end_date_ids = [-364953600, 31449600, -532483200, -80006400, 1330387200]

res = sort(GetDrugExposureEndDate(test_drug_exposure_ids, sqlite_conn))
test_df1 = DataFrame(drug_exposure_id = test_drug_exposure_ids, drug_exposure_end_date = res.drug_exposure_end_date[1:5])

new = GetDrugExposureEndDate(test_df1[:,"drug_exposure_id"], sqlite_conn)

@test test_drug_exposure_end_date_ids == res.drug_exposure_end_date[1:5]
@test new.drug_exposure_end_date[1:5] == test_df1.drug_exposure_end_date[1:5]
@test isa(GetDrugExposureEndDate(test_drug_exposure_ids, sqlite_conn), DataFrame)

end

@testset "GetDrugExposureStartDate" begin

test_drug_exposure_ids = [1.0, 2.0, 3.0, 4.0, 5.0]

test_drug_exposure_start_date_ids = [-3.727296e8, 2.90304e7, -5.333472e8, -8.18208e7, 1.3291776e9]

res = sort(GetDrugExposureStartDate(test_drug_exposure_ids, sqlite_conn))
test_df1 = DataFrame(drug_exposure_id = test_drug_exposure_ids, drug_exposure_start_date = res.drug_exposure_start_date[1:5])

new = GetDrugExposureStartDate(test_df1[:,"drug_exposure_id"], sqlite_conn)

@test test_drug_exposure_start_date_ids == res.drug_exposure_start_date[1:5]
@test new.drug_exposure_start_date[1:5] == test_df1.drug_exposure_start_date[1:5]
@test isa(GetDrugExposureStartDate(test_drug_exposure_ids, sqlite_conn), DataFrame)

end

@testset "GetVisitProcedure Tests" begin
test_visit_occurrence_ids = [22951.0, 23670.0, 26205.0, 26759.0, 27401.0, 28537.0, 29330.0, 30237.0, 31282.0, 32616.0]

Expand Down
Loading