Skip to content

Commit

Permalink
Merge pull request #1259 from cityofaustin/jc-more-calc-fields
Browse files Browse the repository at this point in the history
Adds more fields to component view (v2)
  • Loading branch information
johnclary authored Jan 30, 2024
2 parents a282f55 + 7725d5e commit 0e1ba7a
Show file tree
Hide file tree
Showing 11 changed files with 1,197 additions and 202 deletions.
258 changes: 180 additions & 78 deletions moped-database/metadata/tables.yaml

Large diffs are not rendered by default.

454 changes: 454 additions & 0 deletions moped-database/migrations/1705115280578_more_calc_fields/down.sql

Large diffs are not rendered by default.

486 changes: 486 additions & 0 deletions moped-database/migrations/1705115280578_more_calc_fields/up.sql

Large diffs are not rendered by default.

54 changes: 38 additions & 16 deletions moped-database/views/component_arcgis_online_view.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- current_version: 1704744986000_substantial_completion_date
-- current_version: 1705115280578_more_calc_fields
DROP VIEW component_arcgis_online_view;

CREATE OR REPLACE VIEW component_arcgis_online_view AS (
Expand All @@ -8,28 +8,36 @@ CREATE OR REPLACE VIEW component_arcgis_online_view AS (
comp_geography.feature_ids,
mpc.component_id,
comp_geography.geometry,
comp_geography.line_geometry,
comp_geography.line_geometry,
comp_geography.signal_ids,
council_districts.council_districts,
'placeholder text' as council_districts_searchable,
CASE WHEN council_districts IS NULL OR council_districts = '' THEN FALSE
ELSE TRUE
END AS is_within_city_limits,
comp_geography.length_feet_total,
round((comp_geography.length_feet_total / 5280::numeric),2) AS length_miles_total,
mc.component_name,
mc.component_subtype,
mc.component_name_full,
subcomponents.subcomponents,
work_types.work_types,
'placeholder text' as component_categories,
subcomponents.subcomponents as component_subcomponents,
work_types.work_types as component_work_types,
component_tags.component_tags,
mpc.description AS component_description,
mpc.is_deleted is_project_component_deleted,
plv.is_deleted is_project_deleted,
mpc.description AS component_description,
mpc.interim_project_component_id,
mpc.completion_date,
COALESCE(mpc.completion_date, substantial_completion_date) as substantial_completion_date,
'2024-01-01T00:00:00−06:00' as substantial_completion_date_estimated,
mpc.srts_id,
mpc.location_description,
plv.project_name,
mpc.location_description as component_location_description,
plv.project_name,
'placeholder text' as project_name_descriptor,
'placeholder text' as project_name_with_descriptor,
plv.project_description,
plv.ecapris_subproject_id,
plv.updated_at,
plv.project_website,
plv.updated_at as project_updated_at,
mpc.phase_id AS component_phase_id,
mph.phase_name AS component_phase_name,
mph.phase_name_simple as component_phase_name_simple,
Expand All @@ -43,23 +51,37 @@ CREATE OR REPLACE VIEW component_arcgis_online_view AS (
plv.project_lead,
plv.public_process_status,
plv.interim_project_id,
plv.project_partner,
plv.project_partners,
plv.task_order_names,
plv.funding_source_name,
plv.type_name,
plv.project_note,
plv.project_note_date_created,
plv.project_status_update,
plv.project_status_update_date_created,
plv.construction_start_date,
plv.completion_end_date,
plv.project_inspector,
plv.project_designer,
plv.project_tags,
plv.workgroup_contractors,
plv.contract_numbers,
plv.parent_project_id,
plv.parent_project_name,
plv.parent_project_url,
'placeholder text' as parent_project_name_with_descriptor,
'placeholder text' as related_project_ids,
'placeholder text' as related_project_ids_searchable,
plv.knack_project_id as knack_data_tracker_project_record_id,
'https://mobility.austin.gov/moped/projects/' || plv.project_id :: text as project_url,
'https://mobility.austin.gov/moped/projects/' || plv.project_id :: text || '?tab=map&project_component_id=' || mpc.project_component_id :: text as component_url,
added_by
plv.project_url,
plv.project_url || '?tab=map&project_component_id=' || mpc.project_component_id :: text as component_url,
plv.project_development_status,
plv.project_development_status_date,
plv.project_development_status_date_calendar_year,
plv.project_development_status_date_calendar_year_month,
plv.project_development_status_date_calendar_year_month_numeric,
plv.project_development_status_date_calendar_year_quarter,
plv.project_development_status_date_fiscal_year,
plv.project_development_status_date_fiscal_year_quarter,
added_by as project_added_by
FROM
moped_proj_components mpc
LEFT JOIN (
Expand Down
25 changes: 18 additions & 7 deletions moped-database/views/project_list_view.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- latest version 1704744986000_substantial_completion_date
-- latest version 1705115280578_more_calc_fields
DROP VIEW project_list_view CASCADE;

CREATE OR REPLACE VIEW public.project_list_view
Expand Down Expand Up @@ -65,6 +65,7 @@ AS WITH project_person_list_lookup AS (
mp.project_name,
mp.project_description,
mp.ecapris_subproject_id,
mp.project_website,
mp.date_added,
mp.is_deleted,
mp.updated_at,
Expand All @@ -78,19 +79,29 @@ AS WITH project_person_list_lookup AS (
mp.interim_project_id,
mp.parent_project_id,
mp.knack_project_id,
proj_notes.project_note,
proj_notes.date_created as project_note_date_created,
'https://mobility.austin.gov/moped/projects/' || mp.project_id :: text as project_url,
'https://mobility.austin.gov/moped/projects/' || mp.parent_project_id :: text as parent_project_url,
proj_status_update.project_note as project_status_update,
proj_status_update.date_created as project_status_update_date_created,
work_activities.workgroup_contractors,
work_activities.contract_numbers,
work_activities.task_order_names,
work_activities.task_order_names_short,
work_activities.task_orders,
'placeholder text' as project_development_status,
'2024-01-01T00:00:00−06:00' as project_development_status_date,
9999 as project_development_status_date_calendar_year,
'placeholder text' as project_development_status_date_calendar_year_month,
'placeholder text' as project_development_status_date_calendar_year_month_numeric,
'placeholder text' as project_development_status_date_calendar_year_quarter,
999 as project_development_status_date_fiscal_year,
'placeholder text' as project_development_status_date_fiscal_year_quarter,
(SELECT project_name
FROM moped_project
WHERE project_id = mp.parent_project_id
) as parent_project_name,
cpl.children_project_ids,
string_agg(DISTINCT me2.entity_name, ', '::text) AS project_partner,
string_agg(DISTINCT me2.entity_name, ', '::text) AS project_partners,
(SELECT JSON_AGG(json_build_object('signal_id', feature_signals.signal_id, 'knack_id', feature_signals.knack_id, 'location_name', feature_signals.location_name, 'signal_type', feature_signals.signal_type, 'id', feature_signals.id))
FROM moped_proj_components components
LEFT JOIN feature_signals
Expand Down Expand Up @@ -207,7 +218,7 @@ AS WITH project_person_list_lookup AS (
WHERE mpn.project_id = mp.project_id AND mpn.project_note_type = 2 AND mpn.is_deleted = false
ORDER BY mpn.date_created DESC
LIMIT 1
) as proj_notes on true
) as proj_status_update on true
WHERE
mp.is_deleted = false
GROUP BY
Expand All @@ -234,8 +245,8 @@ AS WITH project_person_list_lookup AS (
added_by_user.last_name,
mpps.name,
cpl.children_project_ids,
proj_notes.project_note,
proj_notes.date_created,
proj_status_update.project_note,
proj_status_update.date_created,
work_activities.workgroup_contractors,
work_activities.contract_numbers,
work_activities.task_order_names,
Expand Down
88 changes: 0 additions & 88 deletions moped-editor/src/queries/signals.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,16 @@ export default function TheMap({
)
return;

const sourceFeatureId = SOURCES[clickedFeatureSource]._featureIdProp;
const databaseTableId = SOURCES[clickedFeatureSource].databaseTableId;
const source = SOURCES[clickedFeatureSource];
if (!source) {
// this can happen if the mapped is zoomed out such that AGOL/CTN feature layers are not visibile
// but the underyling draft edit component has captured a click
// we can't handle this click right now, so just return
// todo: manage layer interactivity based on zoom level + if the feature is drawn?
return;
}
const sourceFeatureId = source._featureIdProp;
const databaseTableId = source.databaseTableId;
const featureUniqueId = clickedFeature.properties[sourceFeatureId];

const featureFromAgolGeojson = findFeatureInAgolGeojsonFeatures(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const PROJECT_LIST_VIEW_EXPORT_CONFIG = {
project_sponsor: {
label: "Sponsor",
},
project_partner: {
project_partners: {
label: "Partners",
},
updated_at: {
Expand All @@ -60,7 +60,7 @@ export const PROJECT_LIST_VIEW_EXPORT_CONFIG = {
funding_source_name: {
label: "Funding",
},
project_note: {
project_status_update: {
label: "Status Update",
},
construction_start_date: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const PROJECT_LIST_VIEW_FILTERS_CONFIG = {
],
},
{
name: "project_partner",
name: "project_partners",
label: "Partners",
placeholder: "Project partners",
type: "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export const PROJECT_LIST_VIEW_QUERY_CONFIG = {
},
type: "string",
},
project_partner: {
project_partners: {
label: "Project partners",
searchable: true,
sortable: true,
Expand Down Expand Up @@ -208,7 +208,7 @@ export const PROJECT_LIST_VIEW_QUERY_CONFIG = {
defaultHidden: true,
showInTable: true,
},
project_note: {
project_status_update: {
type: "string",
sortable: true,
defaultHidden: true,
Expand Down
12 changes: 6 additions & 6 deletions moped-editor/src/views/projects/projectsListView/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,12 @@ export const useColumns = ({ hiddenColumns }) => {
},
{
title: "Partners",
field: "project_partner",
hidden: hiddenColumns["project_partner"],
field: "project_partners",
hidden: hiddenColumns["project_partners"],
emptyValue: "-",
cellStyle: { whiteSpace: "noWrap" },
render: (entry) => {
return entry.project_partner.split(",").map((partner) => (
return entry.project_partners.split(",").map((partner) => (
<span key={partner} style={{ display: "block" }}>
{partner}
</span>
Expand Down Expand Up @@ -401,11 +401,11 @@ export const useColumns = ({ hiddenColumns }) => {
},
{
title: "Status update",
field: "project_note",
hidden: hiddenColumns["project_note"],
field: "project_status_update",
hidden: hiddenColumns["project_status_update"],
emptyValue: "-",
cellStyle: { maxWidth: "30rem" },
render: (entry) => parse(String(entry.project_note)),
render: (entry) => parse(String(entry.project_status_update)),
},
{
title: "Construction start",
Expand Down

0 comments on commit 0e1ba7a

Please sign in to comment.