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

Select person id from patient table #896

Merged
merged 23 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
826b850
release v1.0.4
DanPaseltiner May 17, 2023
cab7781
merge
DanPaseltiner May 18, 2023
b4fa1f4
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner May 24, 2023
26400e4
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner May 26, 2023
091d8bf
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Jun 27, 2023
2a17700
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Jul 20, 2023
21bbe1c
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Jul 26, 2023
6b4b7f3
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Aug 9, 2023
05b0681
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Aug 14, 2023
0a74978
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Aug 24, 2023
2bc93d8
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Sep 6, 2023
32ddc81
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Sep 9, 2023
61f6b61
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Sep 19, 2023
30037cb
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Sep 29, 2023
fc24734
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Oct 5, 2023
5c20504
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Oct 11, 2023
ed715b7
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Oct 24, 2023
6bd1b8a
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Oct 26, 2023
c580d31
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Oct 30, 2023
1cef661
Merge branch 'main' of https://github.com/CDCgov/phdi into main
DanPaseltiner Oct 31, 2023
271b97b
Select person_id from patient table instead of person table.
DanPaseltiner Oct 31, 2023
a0cd141
Updated expected query in test_get_base_query
DanPaseltiner Oct 31, 2023
d4e9480
Merge branch 'main' into select-person_id-from-patient-table
DanPaseltiner Oct 31, 2023
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
3 changes: 1 addition & 2 deletions phdi/linkage/mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def _get_base_query(self) -> Select:
query = (
select(
self.dal.PATIENT_TABLE.c.patient_id,
self.dal.PERSON_TABLE.c.person_id,
self.dal.PATIENT_TABLE.c.person_id,
self.dal.PATIENT_TABLE.c.dob.label("birthdate"),
self.dal.PATIENT_TABLE.c.sex,
id_sub_query.c.mrn,
Expand Down Expand Up @@ -406,7 +406,6 @@ def _get_base_query(self) -> Select:
#
# .outerjoin(phone_sub_query)
.outerjoin(self.dal.ADDRESS_TABLE)
.outerjoin(self.dal.PERSON_TABLE)
)
return query

Expand Down
5 changes: 2 additions & 3 deletions tests/linkage/test_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_get_base_query():
MPI: DIBBsMPIConnectorClient = _init_db()
base_query = MPI._get_base_query()
expected_query = (
"SELECT patient.patient_id, person.person_id, patient.dob AS"
"SELECT patient.patient_id, patient.person_id, patient.dob AS"
+ " birthdate, patient.sex, ident_subq.mrn, name.last_name, "
+ "gname_subq.given_names AS first_name, address.line_1 AS "
+ "address, address.zip_code AS zip, address.city, address.state"
Expand All @@ -188,8 +188,7 @@ def test_get_base_query():
+ " AS given_names"
+ " FROM given_name GROUP BY given_name.name_id) AS gname_subq ON name.name_id "
+ "= gname_subq.name_id LEFT OUTER JOIN address ON patient.patient_id = "
+ "address.patient_id LEFT OUTER JOIN person ON person.person_id = "
+ "patient.person_id"
+ "address.patient_id"
)
assert base_query is not None
assert isinstance(base_query, Select)
Expand Down
Loading