website icon indicating copy to clipboard operation
website copied to clipboard

Migrate Place Page Functionality to Flask Service

Open dwnoble opened this issue 1 year ago • 0 comments

Migrate Place Page Functionality to Flask Service with place_charts and related_places Endpoints

This PR migrates place page functionality from the Mixer service's /v1/internal/page/place endpoint to the Flask service by introducing two new endpoints: place_charts and related_places. This change centralizes application-specific logic within the Flask service and optimizes payload sizes by adjusting how observational data is handled.

TODO / Next steps:

  • Add childPlaceType
  • Fetch geo overlapping places?
  • Create new place page layout based on updated mockups
  • Use these new endpoints to fetch data for the updated place page

New Endpoints

/api/place/charts/<place_dcid>

  • Returns chart definitions for a specified place, translated into the user's locale.
  • Features:
    • Filters charts based on data availability for the place.
    • Excludes observational data from the payload; web components will fetch this data as needed.
    • Supports localization for chart titles and category strings.

/api/place/related_places/<place_dcid>

  • Provides related place data, including child, nearby, and similar places.
  • Features:
    • Fetches child places contained within the specified place.
    • Retrieves geographically nearby places.
    • Identifies similar places based on predefined cohorts.
    • Supports localization for place names.

Rationale

  • Application-Specific Logic: Moving the logic from Mixer to Flask keeps application-specific code within the application layer.
  • Optimized Payloads: Excludes inline observational data resulting in a smaller payloads. Observational data will be fetched separately by the client via web components.

Testing

  • Unit Tests: Added tests for both endpoints including basic localization tests

dwnoble avatar Sep 14 '24 00:09 dwnoble