Skip to content

Conversation

@annavik
Copy link
Member

@annavik annavik commented Oct 3, 2023

Fixes #251

@netlify
Copy link

netlify bot commented Oct 3, 2023

Deploy Preview for ami-web ready!

Name Link
🔨 Latest commit 63c7e49
🔍 Latest deploy log https://app.netlify.com/sites/ami-web/deploys/651c020b7a17c80008f2badc
😎 Deploy Preview https://deploy-preview-266--ami-web.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 51
Accessibility: 100
Best Practices: 92
SEO: 92
PWA: 70
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Oct 3, 2023

Deploy Preview for ami-storybook ready!

Name Link
🔨 Latest commit 63c7e49
🔍 Latest deploy log https://app.netlify.com/sites/ami-storybook/deploys/651c020bdbeaf7000842dc41
😎 Deploy Preview https://deploy-preview-266--ami-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

return `${this._occurrence.determination.id}`
}

get determinationIdentificationId(): string | undefined {
Copy link
Member Author

Choose a reason for hiding this comment

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

Not super happy with this, I think a separate model representation for identifications/predictions could simplify, but perhaps not in this PR

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay yes. I'm curious to know more about why you need to make additional prop functions like determinationPredictionId() instead of accessing determination_details directly

Copy link
Member Author

@annavik annavik Oct 4, 2023

Choose a reason for hiding this comment

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

I want to keep the interface separated from BE as far as possible. That is why I have setup a separate layer to handle the all backend communication, including converting data. This means, when you are making an API update (like changing the structure of data), I don't have make updates all over the FE app. Instead I can just update the FE model class.

Also I'm using this layer to simplify a bit. Sometimes I'm getting more than needed from BE and somtimes in a format that requires a bit of processing before rendering (I think taxa is one good example of this). In this way, I can choose what to expose to the interface layer and how.

I do think the classes are sometimes a bit overkill and there are definitely room for improvements here and there (like in code above), but at least this is how I have been thinking about it :) While BE has been changing a lot, it has been pretty nice for me, but now when things are more stable, maybe the FE app will not have the same need to adapt to BE updates.

Happy to discuss more, maybe you see things from a different perspective?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you for that explanation! I really appreciate you keeping the frontend working while the backend has lagged behind. It makes sense to keep the objects in the frontend specific and simpler when they can be. But I also like the idea of eventually making types/models more consistent between the frontend & backend when the API is stable. At some point would even like to try using the types generated by the OpenAPI SDK directly in React. We can have multiple "view" types for a model (OccurrenceIdentificationAgreeDetails), but it would be awesome to define them in one place. Especially for validation, and for when we are all full stack developers!

Copy link
Member Author

Choose a reason for hiding this comment

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

I would love that, it would make the FE app less fragile also, if we can use a more type safe approach!

@annavik annavik changed the title Pass agree with params (if applicable) when creating an identification Pass "agree with" params (if applicable) when creating an identification Oct 3, 2023
@annavik annavik changed the title Pass "agree with" params (if applicable) when creating an identification Pass "agreed with" params (if applicable) when creating an identification Oct 3, 2023
Copy link
Collaborator

@mihow mihow left a comment

Choose a reason for hiding this comment

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

This looks great, but I am not seeing either agreed_with field saved in the API response. Were you able to see it working? For example:
https://api.dev.insectai.org/api/v2/identifications/210/

image

@annavik
Copy link
Member Author

annavik commented Oct 4, 2023

This looks great, but I am not seeing either agreed_with field saved in the API response. Were you able to see it working? For example: https://api.dev.insectai.org/api/v2/identifications/210/

image

Hmm, no I did not test that values are saved on BE, just that I pass them. Let's have a closer look at that!

@annavik
Copy link
Member Author

annavik commented Oct 5, 2023

This looks great, but I am not seeing either agreed_with field saved in the API response. Were you able to see it working? For example: https://api.dev.insectai.org/api/v2/identifications/210/
image

Hmm, no I did not test that values are saved on BE, just that I pass them. Let's have a closer look at that!

Strange! I had a closer look and works fine for me, I wonder what it might be? Example where value got saved: https://api.dev.insectai.org/api/v2/identifications/219/

Copy link
Collaborator

@mihow mihow left a comment

Choose a reason for hiding this comment

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

Perhaps I was looking a the wrong identification before

@mihow mihow merged commit 7ad5dd0 into main Oct 5, 2023
@annavik annavik deleted the web-ui-agreed-with branch October 11, 2023 06:21
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.

Populate new "agreed_with_" fields on identifications on create

3 participants