Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: protected feature API #211

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

eatyourgreens
Copy link
Contributor

@eatyourgreens eatyourgreens commented Nov 29, 2024

  • a new API, /features/{protector-feature-id}/protected-by, which returns list of adaptation options, by feature and layer, for all features protected by protector-feature-id.
  • a new recoil selector, which runs the query when the current selected feature ID changes.
  • new recoil selectors that filter the results by RCP and protection level.
  • overlaps with refactor(backend): replace db.query() with select() #213 as the new endpoint uses select() to generate queries.
  • data loader layers now take an optional dataFetcher option, a function returning a Promise that resolves to a list of feature IDs and values.
  • a new feature in the frontend, where preloaded adaptation data can be injected into individual data layers. The exact layer API will probably change, but it currently uses a Map, which stores feature adaptation data mapped by layer ID:
  viewLayers.map((viewLayer) => {
    const viewLayerParams = viewLayersParams.get(viewLayer.id);
    const data = viewLayersData?.get(viewLayer.id);
    const deckProps = {
      id: viewLayer.id,
      pickable: !!viewLayer.interactionGroup,
      beforeId,
    };
    return viewLayer.fn({
      deckProps,
      zoom,
      ...viewLayerParams,
      data,
    });
  });

Here, selecting the airport runway runs a query that returns a list of water infrastructure features, styled by the selected adaptation variable.

720p.Screen.Recording.2024-12-10.at.08.41.28.mov

@eatyourgreens eatyourgreens force-pushed the protected-feature-api branch 17 times, most recently from bf4d257 to f7607cd Compare December 6, 2024 16:18
@eatyourgreens eatyourgreens force-pushed the protected-feature-api branch 13 times, most recently from 17767eb to 2889380 Compare December 9, 2024 13:13
@eatyourgreens eatyourgreens force-pushed the protected-feature-api branch 19 times, most recently from 0416047 to 46b1cfe Compare December 13, 2024 14:29
@eatyourgreens
Copy link
Contributor Author

a new recoil selector, which runs the query when the current selected feature ID changes.

I think there's a possible scenario/user story where I'd select a protector feature, to show all linked, protected features, then click on a protected feature to select that and see more detail. At the moment, that would clear the protected feature query, when the selected feature ID changes. The query results might need to persist, as long as we're interacting with protected features.

@eatyourgreens eatyourgreens force-pushed the protected-feature-api branch 3 times, most recently from 257b5a8 to a098ae6 Compare January 9, 2025 15:57
- a new API, `/features/{protector-feature-id}/protected-by`, which returns list of adaptation options, by feature and layer, for all features protected by `protector-feature-id`.
- a new recoil selector, which runs the query with the current selected feature ID.
- new recoil selectors that filter the results by RCP and protection level.
- new recoil selectors to fetch protected feature data.
- a new data loader option: `dataFetcher`. Override the default API call with custom data.
- inject protected feature data into asset view layers.
- make protected feature layers visible after data is fetched.
A new sidebar control for adaptation options. Set the parameters for protected feature queries. Currently shares state (RCP and protection level) with the adaptation options control.
Filter the new API by RCP and protection level on the backend.
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.

1 participant