Skip to content

Commit b5a63a8

Browse files
committed
Merge branch 'main' into mike/19293_remove_unused_styles
2 parents 611ae9c + ae6b3d3 commit b5a63a8

43 files changed

Lines changed: 1668 additions & 996 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Build eCapris statuses ETL Docker image and push to DockerHub"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- production
7+
paths:
8+
- ".github/workflows/etl_ecapris_statuses_docker.yml"
9+
- "moped-etl/ecapris-statuses/**"
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
jobs:
13+
build:
14+
name: Build eCapris status sync ETL docker image
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
- name: Login to DockerHub
20+
uses: docker/login-action@v2
21+
with:
22+
username: ${{ secrets.DOCKER_USERNAME }}
23+
password: ${{ secrets.DOCKER_TOKEN }}
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
26+
- name: Build and push image
27+
uses: docker/build-push-action@v4
28+
with:
29+
platforms: linux/amd64
30+
push: true
31+
tags: atddocker/atd-moped-etl-ecapris-statuses:${{ github.ref_name }}
32+
context: ./moped-etl/ecapris-statuses

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Before you begin, make sure you have the following installed on your system:
105105
- [ArcGIS Moped Database Viewer](https://austin.maps.arcgis.com/apps/webappviewer/index.html?id=404d31d56b57491abe53ccfd718fcaee) - GIS map application that includes Moped Project Data as a layer (requires ArcGIS Online permissions)
106106
- [API](./moped-api/README.md) - serverless Flask API, handling data operations and API requests
107107
- [auth](./moped-auth/README.md) - manages authentication using AWS Cognito, including JWT token generation and validation for secure access control
108-
- [etl](./moped-etl/README.md) - integration scripts for ArcGIS & Knack Data Tracker
108+
- [etl](./moped-etl/README.md) - integration scripts for ArcGIS, Knack Data Tracker, and eCapris
109109
- [toolbox](./moped-toolbox/README.md) - collection of utilities and scripts designed for ad-hoc maintenance tasks
110110

111111
## License

moped-database/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Architecture Independent Docker Stack Components for Moped Development Environment
22
services:
33
hasura:
4-
image: hasura/graphql-engine:v2.47.0
4+
image: hasura/graphql-engine:v2.48.0
55
depends_on:
66
- moped-pgsql
77
expose:
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
table:
2+
name: ecapris_subproject_statuses
3+
schema: public
4+
object_relationships:
5+
- name: moped_user
6+
using:
7+
foreign_key_constraint_on: created_by_user_id
8+
select_permissions:
9+
- role: moped-admin
10+
permission:
11+
columns:
12+
- sub_project_status_desc
13+
- ecapris_subproject_id
14+
- reviewed_by_email
15+
- reviewed_by_name
16+
- created_by_user_id
17+
- updated_by_user_id
18+
- current_status_fl
19+
- summary_description
20+
- subproject_name
21+
- id
22+
- review_timestamp
23+
- created_at
24+
- updated_at
25+
- subproject_status_id
26+
- subproject_status_impacts
27+
filter: {}
28+
comment: ""
29+
- role: moped-editor
30+
permission:
31+
columns:
32+
- sub_project_status_desc
33+
- ecapris_subproject_id
34+
- reviewed_by_email
35+
- reviewed_by_name
36+
- created_by_user_id
37+
- updated_by_user_id
38+
- current_status_fl
39+
- summary_description
40+
- subproject_name
41+
- id
42+
- review_timestamp
43+
- created_at
44+
- updated_at
45+
- subproject_status_id
46+
- subproject_status_impacts
47+
filter: {}
48+
comment: ""
49+
- role: moped-viewer
50+
permission:
51+
columns:
52+
- sub_project_status_desc
53+
- ecapris_subproject_id
54+
- reviewed_by_email
55+
- reviewed_by_name
56+
- created_by_user_id
57+
- updated_by_user_id
58+
- current_status_fl
59+
- summary_description
60+
- subproject_name
61+
- id
62+
- review_timestamp
63+
- created_at
64+
- updated_at
65+
- subproject_status_id
66+
- subproject_status_impacts
67+
filter: {}
68+
comment: ""

moped-database/metadata/databases/default/tables/public_moped_component_tags.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,29 @@ select_permissions:
1313
- role: moped-admin
1414
permission:
1515
columns:
16-
- is_deleted
16+
- full_name
1717
- id
18+
- is_deleted
1819
- name
1920
- slug
2021
- type
2122
filter: {}
2223
- role: moped-editor
2324
permission:
2425
columns:
25-
- is_deleted
26+
- full_name
2627
- id
28+
- is_deleted
2729
- name
2830
- slug
2931
- type
3032
filter: {}
3133
- role: moped-viewer
3234
permission:
3335
columns:
34-
- is_deleted
36+
- full_name
3537
- id
38+
- is_deleted
3639
- name
3740
- slug
3841
- type

moped-database/metadata/databases/default/tables/public_moped_project.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ select_permissions:
185185
- project_sponsor
186186
- project_website
187187
- public_process_status_id
188+
- should_sync_ecapris_statuses
188189
- updated_at
189190
filter: {}
190191
allow_aggregations: true
@@ -207,6 +208,7 @@ select_permissions:
207208
- project_sponsor
208209
- project_website
209210
- public_process_status_id
211+
- should_sync_ecapris_statuses
210212
- updated_at
211213
filter: {}
212214
allow_aggregations: true
@@ -229,6 +231,7 @@ select_permissions:
229231
- project_sponsor
230232
- project_website
231233
- public_process_status_id
234+
- should_sync_ecapris_statuses
232235
- updated_at
233236
filter: {}
234237
allow_aggregations: true
@@ -250,6 +253,7 @@ update_permissions:
250253
- project_sponsor
251254
- project_website
252255
- public_process_status_id
256+
- should_sync_ecapris_statuses
253257
- updated_at
254258
filter: {}
255259
check: {}
@@ -272,6 +276,7 @@ update_permissions:
272276
- project_sponsor
273277
- project_website
274278
- public_process_status_id
279+
- should_sync_ecapris_statuses
275280
- updated_at
276281
filter: {}
277282
check: {}
@@ -285,7 +290,6 @@ event_triggers:
285290
columns: '*'
286291
update:
287292
columns:
288-
- ecapris_subproject_id
289293
- project_id
290294
- date_added
291295
- added_by
@@ -294,11 +298,13 @@ event_triggers:
294298
- parent_project_id
295299
- interim_project_id
296300
- project_lead_id
301+
- public_process_status_id
302+
- should_sync_ecapris_statuses
297303
- project_name
298304
- project_description
305+
- ecapris_subproject_id
299306
- project_website
300307
- knack_project_id
301-
- public_process_status_id
302308
- project_name_secondary
303309
retry_conf:
304310
interval_sec: 10

moped-database/metadata/databases/default/tables/tables.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- "!include deprecated_moped_types.yaml"
33
- "!include public_component_arcgis_online_view.yaml"
44
- "!include public_current_phase_view.yaml"
5+
- "!include public_ecapris_subproject_statuses.yaml"
56
- "!include public_exploded_component_arcgis_online_view.yaml"
67
- "!include public_feature_drawn_lines.yaml"
78
- "!include public_feature_drawn_points.yaml"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Remove should_sync_ecapris_statuses column from moped_project table
2+
ALTER TABLE moped_project
3+
DROP COLUMN should_sync_ecapris_statuses;
4+
5+
-- Drop ecapris_status_updates table
6+
DROP TABLE IF EXISTS public.ecapris_subproject_statuses;
7+
8+
-- Drop function to match user email and set created_by_user_id
9+
DROP FUNCTION IF EXISTS public.find_user_match_by_email;
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
-- Update moped_project table with should_sync_ecapris_statuses column and comment
2+
ALTER TABLE moped_project
3+
ADD COLUMN should_sync_ecapris_statuses BOOLEAN NOT NULL DEFAULT TRUE;
4+
5+
-- Add comment for the new column
6+
COMMENT ON COLUMN moped_project.should_sync_ecapris_statuses IS 'Indicates if project statuses should be synced with eCapris';
7+
8+
9+
-- Create ecapris_status_updates table with column comments
10+
CREATE TABLE public.ecapris_subproject_statuses (
11+
id SERIAL PRIMARY KEY,
12+
ecapris_subproject_id TEXT NOT NULL,
13+
subproject_name TEXT NOT NULL,
14+
subproject_status_id INTEGER NOT NULL UNIQUE,
15+
current_status_fl BOOLEAN NOT NULL,
16+
sub_project_status_desc TEXT,
17+
review_timestamp TIMESTAMP WITH TIME ZONE NOT NULL,
18+
subproject_status_impacts TEXT,
19+
summary_description TEXT,
20+
reviewed_by_name TEXT NOT NULL,
21+
reviewed_by_email TEXT,
22+
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
23+
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
24+
created_by_user_id INTEGER REFERENCES moped_users (user_id) ON DELETE RESTRICT ON UPDATE CASCADE,
25+
updated_by_user_id INTEGER REFERENCES moped_users (user_id) ON DELETE RESTRICT ON UPDATE CASCADE
26+
);
27+
28+
COMMENT ON TABLE public.ecapris_subproject_statuses IS 'Stores eCAPRIS subproject status records synced from the FSD Data Warehouse to supplement the moped_proj_notes table records.';
29+
COMMENT ON COLUMN public.ecapris_subproject_statuses.id IS 'Primary key for the table';
30+
COMMENT ON COLUMN public.ecapris_subproject_statuses.ecapris_subproject_id IS 'eCapris subproject ID number';
31+
COMMENT ON COLUMN public.ecapris_subproject_statuses.subproject_name IS 'Name of eCapris subproject';
32+
COMMENT ON COLUMN public.ecapris_subproject_statuses.subproject_status_id IS 'Unique ID of subproject status from eCapris';
33+
COMMENT ON COLUMN public.ecapris_subproject_statuses.current_status_fl IS 'Is this the current and most recent status?';
34+
COMMENT ON COLUMN public.ecapris_subproject_statuses.sub_project_status_desc IS 'Content of the subproject status';
35+
COMMENT ON COLUMN public.ecapris_subproject_statuses.review_timestamp IS 'Timestamp of the status update - MM/DD/YYYY HH:MM:SS format';
36+
COMMENT ON COLUMN public.ecapris_subproject_statuses.subproject_status_impacts IS 'Updates on project blockers';
37+
COMMENT ON COLUMN public.ecapris_subproject_statuses.summary_description IS 'More of a public-ready status could be used down the road; nullable in eCapris';
38+
COMMENT ON COLUMN public.ecapris_subproject_statuses.reviewed_by_name IS 'First and last name of author; nullable in eCapris';
39+
COMMENT ON COLUMN public.ecapris_subproject_statuses.reviewed_by_email IS 'Email of author';
40+
COMMENT ON COLUMN public.ecapris_subproject_statuses.created_at IS 'Timestamp when the record was created';
41+
COMMENT ON COLUMN public.ecapris_subproject_statuses.updated_at IS 'Timestamp when the record was last updated';
42+
COMMENT ON COLUMN public.ecapris_subproject_statuses.created_by_user_id IS 'ID of the user who created the record';
43+
COMMENT ON COLUMN public.ecapris_subproject_statuses.updated_by_user_id IS 'ID of the user who updated the record';
44+
45+
-- Create trigger to set updated_at audit column before update
46+
CREATE TRIGGER set_ecapris_subproject_statuses_updated_at BEFORE UPDATE ON public.ecapris_subproject_statuses FOR EACH ROW EXECUTE FUNCTION public.set_updated_at();
47+
48+
COMMENT ON TRIGGER set_ecapris_subproject_statuses_updated_at ON public.ecapris_subproject_statuses IS 'Trigger to set updated_at on row update';
49+
50+
-- Create function to search for eCapris subproject status author match by email and set created_by_user_id if found
51+
CREATE OR REPLACE FUNCTION public.find_ecapris_user_match_by_email()
52+
RETURNS TRIGGER AS $$
53+
BEGIN
54+
-- Try to find matching user by email (case-insensitive) email
55+
NEW.created_by_user_id := (
56+
SELECT user_id
57+
FROM moped_users
58+
WHERE LOWER(email) = LOWER(NEW.reviewed_by_email)
59+
LIMIT 1
60+
);
61+
62+
RETURN NEW;
63+
END;
64+
$$ LANGUAGE plpgsql;
65+
66+
COMMENT ON FUNCTION public.find_ecapris_user_match_by_email() IS 'Function to attempt matching eCapris status author email to Moped users by email';
67+
68+
-- Create trigger to call function to try match author (if there is one) before insert
69+
CREATE TRIGGER find_ecapris_user_match_by_email BEFORE INSERT ON public.ecapris_subproject_statuses
70+
FOR EACH ROW EXECUTE FUNCTION public.find_ecapris_user_match_by_email();
71+
72+
COMMENT ON TRIGGER find_ecapris_user_match_by_email ON public.ecapris_subproject_statuses IS 'Trigger to attempt match of eCapris author to Moped user by email on insert';

0 commit comments

Comments
 (0)