-
Notifications
You must be signed in to change notification settings - Fork 2
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
AB2D-5819/Create cron job to run AttributionDataShare procedure on the database #1296
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3147ee2
Creating the new partitions for the new coverage table
smirnovaae 8f69a26
Add pg_cron schedule
smirnovaae 8c7afb0
Add pg_cron schedule
smirnovaae c145ad4
addressing pr comment
smirnovaae a5f2ba2
addressing pr comment
smirnovaae a9dc954
testing on dev
smirnovaae fc8d219
testing on dev
smirnovaae cc2cf8f
testing on dev
smirnovaae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
common/src/main/resources/db/changelog/v2023/create_current_mbi_procedure.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
CREATE OR REPLACE PROCEDURE update_current_mbi_2023() | ||
LANGUAGE plpgsql | ||
AS $$ | ||
begin | ||
INSERT INTO current_mbi | ||
SELECT DISTINCT current_mbi from coverage_anthem_united_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_bcbs_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_centene_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_cigna1_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_cigna2_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_cvs_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_centene_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_humana_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_misc_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_mutual_dean_clear_cambia_rite_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_united1_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_united_2023 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_default | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from sandbox_2023 | ||
ON CONFLICT DO NOTHING; | ||
end; | ||
$$; | ||
-- | ||
-- CREATE OR REPLACE PROCEDURE update_current_mbi_2024() | ||
-- LANGUAGE plpgsql | ||
-- AS $$ | ||
-- begin | ||
-- INSERT INTO current_mbi | ||
-- SELECT DISTINCT current_mbi from coverage_anthem_united_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_bcbs_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_centene_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_cigna1_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_cigna2_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_cvs_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_centene_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_humana_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_misc_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_mutual_dean_clear_cambia_rite_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_united1_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_united_2024 | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from coverage_default | ||
-- UNION DISTINCT | ||
-- SELECT DISTINCT current_mbi from sandbox_2024 | ||
-- ON CONFLICT DO NOTHING; | ||
-- end; | ||
-- $$; | ||
-- |
32 changes: 32 additions & 0 deletions
32
common/src/main/resources/db/changelog/v2023/create_current_mbi_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
CREATE TABLE IF NOT EXISTS public.current_mbi (mbi VARCHAR(32) NOT NULL); | ||
CREATE UNIQUE INDEX unique_mbi ON public.current_mbi(mbi); | ||
|
||
INSERT INTO public.current_mbi | ||
SELECT DISTINCT current_mbi from coverage_anthem_united | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_bcbs | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_centene | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_cigna1 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_cigna2 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_cvs | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_centene | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_humana | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_misc | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_mutual_dean_clear_cambia_rite | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_united1 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_united2 | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from coverage_default | ||
UNION DISTINCT | ||
SELECT DISTINCT current_mbi from sandbox | ||
ON CONFLICT DO NOTHING |
2 changes: 2 additions & 0 deletions
2
common/src/main/resources/db/changelog/v2023/create_pg_cron_extension.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- run job every night at 1:00 am | ||
SELECT cron.schedule ('update_current_mbis','0 1 * * *','call update_current_mbi()'); |
59 changes: 59 additions & 0 deletions
59
common/src/main/resources/db/changelog/v2023/extend_coverage_partition.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
create table sandbox_2024 partition of sandbox | ||
for values in (2024); | ||
create table sandbox_2025 partition of sandbox | ||
for values in (2025); | ||
|
||
create table coverage_anthem_united_2024 partition of coverage_anthem_united | ||
for values in (2024); | ||
create table coverage_anthem_united_2025 partition of coverage_anthem_united | ||
for values in (2025); | ||
|
||
create table coverage_bcbs_2024 partition of coverage_bcbs | ||
for values in (2024); | ||
create table coverage_bcbs_2025 partition of coverage_bcbs | ||
for values in (2025); | ||
|
||
create table coverage_centene_2024 partition of coverage_centene | ||
for values in (2024); | ||
create table coverage_centene_2025 partition of coverage_centene | ||
for values in (2025); | ||
|
||
create table coverage_cigna1_2024 partition of coverage_cigna1 | ||
for values in (2024); | ||
create table coverage_cigna1_2025 partition of coverage_cigna1 | ||
for values in (2025); | ||
|
||
create table coverage_cigna2_2024 partition of coverage_cigna2 | ||
for values in (2024); | ||
create table coverage_cigna2_2025 partition of coverage_cigna2 | ||
for values in (2025); | ||
|
||
create table coverage_cvs_2024 partition of coverage_cvs | ||
for values in (2024); | ||
create table coverage_cvs_2025 partition of coverage_cvs | ||
for values in (2025); | ||
|
||
create table coverage_humana_2024 partition of coverage_humana | ||
for values in (2024); | ||
create table coverage_humana_2025 partition of coverage_humana | ||
for values in (2025); | ||
|
||
create table coverage_united1_2024 partition of coverage_united1 | ||
for values in (2024); | ||
create table coverage_united1_2025 partition of coverage_united1 | ||
for values in (2025); | ||
|
||
create table coverage_united_2024 partition of coverage_united2 | ||
for values in (2024); | ||
create table coverage_united_2025 partition of coverage_united2 | ||
for values in (2025); | ||
|
||
create table coverage_mutual_dean_clear_cambia_rite_2024 partition of coverage_mutual_dean_clear_cambia_rite | ||
for values in (2024); | ||
create table coverage_mutual_dean_clear_cambia_rite_2025 partition of coverage_mutual_dean_clear_cambia_rite | ||
for values in (2025); | ||
|
||
create table coverage_misc_2024 partition of coverage_misc | ||
for values in (2024); | ||
create table coverage_misc_2025 partition of coverage_misc | ||
for values in (2025); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be an option to put this in a new
v2024
directory, similar to the ones in here instead of having this commented out in thev2023/...
folder?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done