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: Enable calling the Soil ID API with input from frontend #588

Merged
merged 16 commits into from
Jun 3, 2024

Conversation

knipec
Copy link
Contributor

@knipec knipec commented May 30, 2024

Description

(Creating from Ruxandra's work)

  • Allow fetching soil matches from the Soil ID API with inputs from actual site data or location coordinates supplied by the app
  • Cache most recent soil ID results for a site in Redux store
  • Also track the loading state status

Related Issues

Implements #653

Verification steps

Look at the soil ID info screen for a given soil (need the corresponding mobile-client work)

@knipec knipec requested review from paulschreiber and shrouxm May 30, 2024 04:19
src/utils.ts Outdated Show resolved Hide resolved
src/soilId/soilIdService.ts Outdated Show resolved Hide resolved
@knipec knipec requested a review from paulschreiber May 31, 2024 00:24
src/soilId/soilIdService.ts Outdated Show resolved Hide resolved
@tm-ruxandra tm-ruxandra changed the title Enable calling the Soil ID API with input from frontend feat: Enable calling the Soil ID API with input from frontend Jun 3, 2024
@tm-ruxandra tm-ruxandra merged commit 955095c into main Jun 3, 2024
7 checks passed
@tm-ruxandra tm-ruxandra deleted the feat/soil-id-data branch June 3, 2024 18:45

export const soilDataSlopePercent = (
data: SoilData,
): Maybe<number> | undefined => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I know it's weird to review after you already submitted this but just realized -- is the Maybe necessary here? Can we just make it undefined if it's ever null?

Copy link
Contributor

Choose a reason for hiding this comment

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

I had the thought. This is definitely more annoying, but the convention in code that interacts with the GraphQL layer seems to use Maybe | undefined all over the place and I thought it'd be better to keep consistent with that standard, since all this is in the client-shared codebase.

Comment on lines +36 to +37
* When soil data is available, we use the data-based soil match API.
* When the input is only a location, we use the location-based soil match API.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tm-ruxandra @paulschreiber FYI: Oh actually it appears I was misinterpreting the code. It appears that even a site with no data entered will call the data-based one. So it was in fact correct to say the division is Site vs Temporary Location.

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.

3 participants