Skip to content

BDMS-658: add location properties and contact summaries to well responses#632

Open
jirhiker wants to merge 2 commits intostagingfrom
BDMS-658-well-api-updates
Open

BDMS-658: add location properties and contact summaries to well responses#632
jirhiker wants to merge 2 commits intostagingfrom
BDMS-658-well-api-updates

Conversation

@jirhiker
Copy link
Copy Markdown
Member

@jirhiker jirhiker commented Mar 30, 2026

Why

This PR addresses the following problem / context:

  • The wells list and related thing responses exposed coordinates from the current location, but not the location metadata already stored on Location.
  • The wells list also omitted associated contact summaries needed by the UI.
  • The list response needed to include contact data without introducing N+1 queries.

How

Implementation summary - the following was changed / added / removed:

  • Added county, state, and quad_name to GeoJSONProperties and populated them in LocationGeoJSONResponse.populate_fields.
  • Added a compact contacts summary field to WellResponse with id, name, organization, contact_type, and role.
  • Extended the existing well loader options to eagerly load contact_associations -> contact so the well list response can include contacts efficiently.
  • Updated shared test fixtures and added focused response tests for the new location metadata and well-list contact summary.

Notes

Any special considerations, workarounds, or follow-up work to note?

  • Validation run: pytest tests/test_thing.py -k "includes_location_properties or includes_contact_summary or details_payload or get_water_well_by_id_404_not_found or get_water_well_by_id_404_wrong_type or get_spring_by_id_404_not_found or get_spring_by_id_404_wrong_type"
  • black passed on the touched files.
  • flake8 on the touched files has an existing baseline of E501 and F403/F405; after removing the one new actionable warning from this change, targeted lint with those baseline rules ignored passed.

Copilot AI review requested due to automatic review settings March 30, 2026 20:41
@jirhiker jirhiker changed the title feat: add location properties to water well response and enhance test coverage BDMS-658: add location properties and contact summaries to well responses Mar 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds additional location metadata and contact summaries to the water well API responses, and extends tests/fixtures to validate the new response shape.

Changes:

  • Expose county, state, and quad_name under current_location.properties in GeoJSON responses.
  • Include a contacts summary list in WellResponse and eager-load contact associations for well queries.
  • Add/extend tests and fixtures to cover the new response fields.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
schemas/location.py Adds county/state/quad_name to GeoJSON properties and populates them during response shaping.
schemas/thing.py Introduces WellContactSummaryResponse and adds contacts to WellResponse.
services/thing_helper.py Eager-loads Thing.contact_associations -> contact for water well queries to avoid lazy-load issues.
tests/conftest.py Updates the location fixture to include county/state/quad_name.
tests/test_thing.py Adds tests asserting location properties on well-by-id and contact summaries on the well list endpoint.

@jirhiker jirhiker requested a review from jeremyzilar March 30, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants