-
Notifications
You must be signed in to change notification settings - Fork 3
Create ETL to sync FDUs from eCAPRIS EDP dataset to Moped DB #1716
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
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
56d102b
Mock out script and start Docker stack and readme
mddilley 57cc6d5
Sketch out ETL steps
mddilley edca201
Fill in query, logging, request, and env_template; request eCAPRIS ids
mddilley ebccef7
Update service name and remove Oracle lib and connect
mddilley 1f43f4c
Add migration to switch on sync; fetch project ids and unique ecapris…
mddilley 485eed9
Add sodapy and fetch all records
mddilley f3f9f6f
Build list of upserts
mddilley 739fe5a
Test upsert and add TODO for dry run flag
mddilley 3447eba
Add handling to prevent duplicating imported or manually created FDUs
mddilley f39c6ad
Update mutation and constraint to prevent duplicate synced records
mddilley 01c4e7f
Update constraint name and fix syntax
mddilley b6dcd17
Fix payload issues and update project query to actually include exist…
mddilley df4bbb2
Add args module and add dry run to skip mutation
mddilley 40854b7
Add TODO
mddilley 2cf0768
Merge branch 'mike/24593_fund_sync_db' into mike/24674_fund_sync_etl
mddilley 82188a2
Add eCAPRIS subproject funding table to hold immutable FDU records
mddilley 3b7a2a5
Update migration with combined funding DB view
mddilley 643f1d8
Remove unneeded migration and fix table/view references
mddilley 8e6c578
Update ETL script to upsert into ecapris_subproject_funding
mddilley 0c88fad
Track new table and view; update permissions
mddilley 268a976
Update funding upsert mutation
mddilley dcfc2b3
Fix col bug in combined view, update down migration, and col name in …
mddilley d463281
🤖 Export view for 24674_fund_sync_etl
f8aa554
Update ecapris funding view and permissions
mddilley b596987
Disable Hasura event triggers using moped_admin permissions
mddilley 15977ac
Disable project updated at trigger too
mddilley 235782a
Add indexes and update trigger disable to work with the seed data
mddilley 354d0d4
Finish readme, update env template
mddilley e0aa7a0
Update down migration to remove added indexes
mddilley 9554c2a
Merge branch 'mike/24593_fund_sync_db' into mike/24674_fund_sync_etl
mddilley 37d7ba5
🤖 Export view for 24674_fund_sync_etl
bbb2c19
Update comments and formatting
mddilley 3719682
Update view to include sync status
mddilley 7c2bdde
Add permissions
mddilley cd09132
🤖 Export view for 24674_fund_sync_etl
fa4bb7d
Update script to use python 3.14 and add fund sync to project event t…
mddilley 8b959b8
Split out updates needed launch day
mddilley 726b1ff
🤖 Export view for 24674_fund_sync_etl
04a3dc8
Update secrets to match our secret store entries
mddilley e6cff46
Merge branch 'mike/24593_fund_sync_db' into mike/24674_fund_sync_etl
mddilley 8d44b6d
Merge main and fix down migration to remove view that depends on fdu …
mddilley 8a91434
🤖 Export view for 24674_fund_sync_etl
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
61 changes: 61 additions & 0 deletions
61
moped-database/metadata/databases/default/tables/public_combined_project_funding_view.yaml
This file contains hidden or 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,61 @@ | ||
| table: | ||
| name: combined_project_funding_view | ||
| schema: public | ||
| select_permissions: | ||
| - role: moped-admin | ||
| permission: | ||
| columns: | ||
| - amount | ||
| - created_at | ||
| - description | ||
| - ecapris_subproject_id | ||
| - fao_id | ||
| - fdu | ||
| - id | ||
| - is_synced_from_ecapris | ||
| - original_id | ||
| - program_name | ||
| - project_id | ||
| - source_name | ||
| - status_name | ||
| - updated_at | ||
| filter: {} | ||
| comment: "" | ||
| - role: moped-editor | ||
| permission: | ||
| columns: | ||
| - amount | ||
| - created_at | ||
| - description | ||
| - ecapris_subproject_id | ||
| - fao_id | ||
| - fdu | ||
| - id | ||
| - is_synced_from_ecapris | ||
| - original_id | ||
| - program_name | ||
| - project_id | ||
| - source_name | ||
| - status_name | ||
| - updated_at | ||
| filter: {} | ||
| comment: "" | ||
| - role: moped-viewer | ||
| permission: | ||
| columns: | ||
| - amount | ||
| - created_at | ||
| - description | ||
| - ecapris_subproject_id | ||
| - fao_id | ||
| - fdu | ||
| - id | ||
| - is_synced_from_ecapris | ||
| - original_id | ||
| - program_name | ||
| - project_id | ||
| - source_name | ||
| - status_name | ||
| - updated_at | ||
| filter: {} | ||
| comment: "" |
3 changes: 3 additions & 0 deletions
3
moped-database/metadata/databases/default/tables/public_ecapris_subproject_funding.yaml
This file contains hidden or 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,3 @@ | ||
| table: | ||
| name: ecapris_subproject_funding | ||
| schema: public |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ insert_permissions: | |
| updated_by_user_id: x-hasura-user-db-id | ||
| columns: | ||
| - dept_unit | ||
| - ecapris_funding_id | ||
| - fdu | ||
| - fund | ||
| - funding_amount | ||
|
|
@@ -36,6 +37,7 @@ insert_permissions: | |
| updated_by_user_id: x-hasura-user-db-id | ||
| columns: | ||
| - dept_unit | ||
| - ecapris_funding_id | ||
| - fdu | ||
| - fund | ||
| - funding_amount | ||
|
|
@@ -65,7 +67,6 @@ select_permissions: | |
| - funding_source_id | ||
| - funding_status_id | ||
| - is_deleted | ||
| - is_editable | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer needed. All records in the |
||
| - is_legacy_funding_record | ||
| - proj_funding_id | ||
| - project_id | ||
|
|
@@ -91,7 +92,6 @@ select_permissions: | |
| - funding_source_id | ||
| - funding_status_id | ||
| - is_deleted | ||
| - is_editable | ||
| - is_legacy_funding_record | ||
| - proj_funding_id | ||
| - project_id | ||
|
|
@@ -117,7 +117,6 @@ select_permissions: | |
| - funding_source_id | ||
| - funding_status_id | ||
| - is_deleted | ||
| - is_editable | ||
| - is_legacy_funding_record | ||
| - proj_funding_id | ||
| - project_id | ||
|
|
@@ -131,6 +130,7 @@ update_permissions: | |
| permission: | ||
| columns: | ||
| - dept_unit | ||
| - ecapris_funding_id | ||
| - fdu | ||
| - fund | ||
| - funding_amount | ||
|
|
@@ -150,6 +150,7 @@ update_permissions: | |
| permission: | ||
| columns: | ||
| - dept_unit | ||
| - ecapris_funding_id | ||
| - fdu | ||
| - fund | ||
| - funding_amount | ||
|
|
||
This file contains hidden or 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 hidden or 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
32 changes: 0 additions & 32 deletions
32
moped-database/migrations/default/1761074353404_ecapris_funding/down.sql
This file was deleted.
Oops, something went wrong.
68 changes: 0 additions & 68 deletions
68
moped-database/migrations/default/1761074353404_ecapris_funding/up.sql
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
moped-database/migrations/default/1763481385375_ecapris_funding/down.sql
This file contains hidden or 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,23 @@ | ||
| -- Drop combined_project_funding_view | ||
| DROP VIEW IF EXISTS combined_project_funding_view; | ||
|
|
||
| -- Remove funding sync flag from projects table | ||
| ALTER TABLE moped_project | ||
| DROP COLUMN should_sync_ecapris_funding; | ||
|
|
||
| -- Remove added columns from moped_proj_funding table | ||
| ALTER TABLE moped_proj_funding | ||
| DROP COLUMN ecapris_funding_id, | ||
| DROP COLUMN is_legacy_funding_record, | ||
| DROP COLUMN fdu, | ||
| DROP COLUMN unit_long_name; | ||
|
|
||
| -- Drop added indexes | ||
| DROP INDEX IF EXISTS idx_moped_proj_funding_fdu_not_deleted; | ||
| DROP INDEX IF EXISTS idx_moped_proj_funding_project_id; | ||
| DROP INDEX IF EXISTS idx_moped_proj_funding_status_id; | ||
| DROP INDEX IF EXISTS idx_moped_proj_funding_source_id; | ||
| DROP INDEX IF EXISTS idx_moped_proj_funding_program_id; | ||
|
|
||
| -- Drop ecapris_subproject_funding table | ||
| DROP TABLE IF EXISTS public.ecapris_subproject_funding; |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
This is the same column as
fao_idin the eCAPRIS data and will be populated with the unique id that we can trace back to a specific FDU's data if needed. I'm torn about the rename butfao_idis hard to parse imo. I'd love thoughts!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.
what does fao stand for?
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.
I don't know what fao stands for but can ask. FSD just let us know that this is the unique id for FDUs in their DB. What I do know is that it always makes me think of FAO Schwarz 🧸 😆
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.
I was just curious. I also think of FAO Schwarz 🚂