Skip to content

BDMS-783 -- add contacts to CSV Export on Map pages#270

Merged
jeremyzilar merged 11 commits intostagingfrom
BDMS-783
Apr 28, 2026
Merged

BDMS-783 -- add contacts to CSV Export on Map pages#270
jeremyzilar merged 11 commits intostagingfrom
BDMS-783

Conversation

@jeremyzilar
Copy link
Copy Markdown
Contributor

@jeremyzilar jeremyzilar commented Apr 28, 2026

What is changing

Map Export visible for water wells now produces a CSV whose column titles match the Ocotillo Wells list where the same field exists, with extra columns only for map export. Rows are enriched from thing/water-well/{id}/details when the feature has a numeric thing id. Column order is no longer driven only by alphabetical property keys: buildLayerCsv accepts a preferred key order so important columns lead the file. Optional VITE_OCOTILLO_PUBLIC_APP_URL documents how to control the Well detail page link base in exports.

image image

What changed

  • src/well-list/wellListColumnLabels.ts
    Single source of truth for DataGrid headerName strings on the water well list and for shared map CSV headers.

  • src/utils/wellPublicUrls.ts
    Helpers to build absolute well show URLs (default production host; override via env).

# Optional: base URL for well detail links in map CSV export (defaults to https://ocotillo.newmexicowaterdata.org)
# VITE_OCOTILLO_PUBLIC_APP_URL=https://ocotillo.newmexicowaterdata.org
  • src/well-export/wellMapCsvExport.ts
    Map CSV label maps (WellListColumnLabels + WellMapCsvOnlyLabels), preferred header order, row builder (buildWellMapCsvValues), enrichment-failure row, site name resolution (API, OGC site_name, Unknown alternate IDs), and cleanup of legacy detail_* / redundant OGC id fields on features.

  • src/utils/layerExport.ts
    preferredPropertyColumnOrder: emit those property keys first (when present), then remaining keys sorted A–Z, then geometry columns.

  • src/utils/wellMapExport.ts
    Batches fetches to thing/water-well/{id}/details and merges flattened CSV fields into each feature’s properties for export.

  • src/pages/ocotillo/thing/list.tsx
    Well list columns use WellListColumnLabels for headerName values.

  • src/pages/ocotillo/map/list.tsx
    Export path uses buildMapExportPreferredColumnOrder() and enrichMapFeaturesWithWellDetails.

  • src/components/WellShow/Contacts.tsx
    Contact block uses inline caption text again (not shared export constants) so the well detail UI stays independent of CSV label modules.

  • .env.production.example
    Comment block for optional VITE_OCOTILLO_PUBLIC_APP_URL.

How to test

  1. Wells list (thing/list): confirm grid headers match expectations (same strings as WellListColumnLabels).
  2. Map, water well layer, select an area, Export visible: open CSV and check:
    • Well ID, Name, and other shared fields use the same titles as the list.
    • Well detail page URLs are correct; with VITE_OCOTILLO_PUBLIC_APP_URL set, links use that origin.
    • No stray detail_* columns or duplicate OGC id columns if you saw them before.
  3. Optional: set VITE_OCOTILLO_PUBLIC_APP_URL locally, rebuild, re-export, confirm link host.

@jeremyzilar jeremyzilar self-assigned this Apr 28, 2026
@jeremyzilar jeremyzilar added the enhancement New feature or request label Apr 28, 2026
@jirhiker jirhiker self-requested a review April 28, 2026 20:00
@github-actions
Copy link
Copy Markdown

Preview Deployment

Preview URL: https://preview-bdms-783-auejgdbofq-uc.a.run.app

Note: This preview uses the staging API endpoints.

@jeremyzilar jeremyzilar merged commit b30b4d5 into staging Apr 28, 2026
3 of 4 checks passed
@jeremyzilar jeremyzilar deleted the BDMS-783 branch April 28, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants