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

123 body index refactor modularization #124

Merged
merged 18 commits into from
Apr 16, 2024

Conversation

ChromaticPanic
Copy link
Contributor

@ChromaticPanic ChromaticPanic commented Apr 9, 2024

This PR moves majority of the algorithms out of the Body component into a common module so that unit testing of these functions and debugging is less complicated.

Common Module

  • api
    • App calls that need to go over the internet
  • cacheutils
    • CRUD operations on the imageCache data structure
  • error
    • Custom Error classes
  • types.d.ts
    • common shared data model for the front end
    • definitions of the expected structures from backend

Hooks Module

  • useBackendUrl
    • memoized hook to provide the back end URL
  • useDicoderTiff
    • hook entry point to the Tiff decoder

Quality of life changes
Pure Functions

  • Functions were converted into pure functions for easier debugging and predictability

Body Component

  • useEffect dependencies were simplified to reduce the number of chain dependencies
    • This fixed some rendering issues referenced below

directory_list

  • Separated Container and View
    • Example showing separation of Component state and view
    • Useful for large complicated components
    • Placing component code in a tsx file with the same name will make it slightly easier to debug since the browser console will indicate the file name of the component with an error or exception

Unit Tests

  • Multiple strategies for testing the different components are present
    • single vs parametric test case scenarios
    • different dependency mocking strategies

Fixes

@ChromaticPanic ChromaticPanic self-assigned this Apr 9, 2024
@ChromaticPanic ChromaticPanic added bug Something isn't working enhancement New feature or request labels Apr 9, 2024
Copy link

@rngadam rngadam left a comment

Choose a reason for hiding this comment

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

would like to see some unit tests here given the complexity of the change

Copy link
Collaborator

@MaxenceGui MaxenceGui left a comment

Choose a reason for hiding this comment

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

I like the reorganization of the code. I feel like I can undeestand more easily what is happening and where I can find what I need. As for the issue with the tiff image. It seems to be fix as I didn't have any issue doing a classification

image

Image appear the first time, and the bouding box are around the seeds

@ChromaticPanic ChromaticPanic merged commit 03e4367 into main Apr 16, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: Done
4 participants