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

SIMSBIOHUB 281 - Update Animal Form and Table #1098

Merged
merged 254 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
b96aa49
updated references to use new component name/import
MacQSL Jul 18, 2023
8b47054
Added new express router and relevant env variables to connect to cri…
GrahamS-Quartech Jul 18, 2023
5f498bb
Added simple critterbase hook and test page to app
GrahamS-Quartech Jul 18, 2023
13f4aa2
Frontend / API will not pass correct authentication headers through t…
GrahamS-Quartech Jul 19, 2023
b96d61d
adding state for animal section buttons
MacQSL Jul 19, 2023
5352ef8
Implemented critterbase signup and markings endpoint as express-opena…
GrahamS-Quartech Jul 20, 2023
ba3e335
fixed merge conflict, and updated styling to use MUI5 standards
MacQSL Jul 20, 2023
772d73a
Added state for handling the form sections
MacQSL Jul 20, 2023
23fc5c1
created form context + custom hook for handling form section data
MacQSL Jul 20, 2023
9aff645
Added first form section (General)
MacQSL Jul 20, 2023
4b6fc18
updated default export to be the wrapped instance of the AnimalForm
MacQSL Jul 20, 2023
e1a1021
placeholder content created for General section
MacQSL Jul 20, 2023
2451c14
updated useAnimalFormData.tsx to implement useReducer for form state …
MacQSL Jul 21, 2023
fbb6b67
created helpButton tooltip component, styled simlarily to current pop…
MacQSL Jul 21, 2023
2a529a7
modified the way the state is being handled inside the AnimalForm, co…
MacQSL Jul 21, 2023
ab98f4e
added temp delete button for each generated form section
MacQSL Jul 25, 2023
b799aaf
Removes express-openapi style critterbase routes in favor of directly…
GrahamS-Quartech Jul 25, 2023
6c558b3
Forgot to start tracking files for critterbase frontend hooks.
GrahamS-Quartech Jul 25, 2023
20ded28
renamed GeneralAnimalForm and refactored
MacQSL Jul 26, 2023
8d0c847
refactored CaptureAnimalForm
MacQSL Jul 26, 2023
2988018
created form section wrapper to reduce syling duplication
MacQSL Jul 26, 2023
94b5959
refactored IndividualAnimalForm to use formik FieldArray
MacQSL Jul 26, 2023
ceef6e2
updated animal form related types
MacQSL Jul 26, 2023
cf0799a
Made another hook for getting the lookup tables and enums from critte…
GrahamS-Quartech Jul 26, 2023
8015531
Removed some extra critterbase-sims api fusion stuff from the api fol…
GrahamS-Quartech Jul 26, 2023
16df8c5
Adds conditonal render to AppRouter to only display dev Playground pa…
GrahamS-Quartech Jul 26, 2023
f1fefb6
created addSectionBtn for animal form sections
MacQSL Jul 26, 2023
89eb82f
removed unused context (formik refactor) -> created animal.ts types f…
MacQSL Jul 26, 2023
3e45574
updated formSectionWrapper and styling in input sections
MacQSL Jul 27, 2023
1e38847
added constants for animal form to i18n.ts and updated refs
MacQSL Jul 27, 2023
62612a4
updated customTextField to handle onBlur changes, used for formik val…
MacQSL Jul 27, 2023
89c2520
updated animal.ts to use yup validation schemas, updated styling / wo…
MacQSL Jul 27, 2023
d1f081b
Implements working floating point field with proper validation. Also …
GrahamS-Quartech Jul 27, 2023
70e4705
Consolidated marker and resizable circle into one component. Renamed …
GrahamS-Quartech Jul 28, 2023
c3c0ad9
Merge branch 'critterbase-map-component' into BCTW-935-Add-Critter-Form
GrahamS-Quartech Jul 28, 2023
2a0b90f
added release section to capture and helper function for generating f…
MacQSL Jul 28, 2023
6ccd2f1
created TextInputToggle.tsx for animal comment inputs
MacQSL Jul 28, 2023
971a8c2
moved inputs to separate component for CaptureAnimalForm
MacQSL Jul 28, 2023
85831f3
added marking boiler plate code
MacQSL Jul 28, 2023
dd0d15d
Added taxon select and capture tab component to the critter form. Als…
GrahamS-Quartech Jul 28, 2023
a625415
Merge branch 'BCTW-935-Add-Critter-Form' of github.com:bcgov/biohubbc…
GrahamS-Quartech Jul 28, 2023
5c8bfab
added controlProps for CbSelect comp, improved validation errs
MacQSL Jul 28, 2023
444a2fd
added marking section
MacQSL Jul 31, 2023
56cbc3e
created UI section for measurements
MacQSL Jul 31, 2023
1f7f28b
Capture form now has toggle between WGS latlon or UTM Zone 10 input. …
GrahamS-Quartech Jul 31, 2023
e178d72
Merge branch 'BCTW-935-Add-Critter-Form' of github.com:bcgov/biohubbc…
GrahamS-Quartech Jul 31, 2023
0fd126d
Implemented separate placement of release coordinate on map page as w…
GrahamS-Quartech Aug 1, 2023
8c56a9f
Updated CbSelect to handle taxon changes
MacQSL Aug 1, 2023
fe86e5a
Merge branch 'BCTW-935-Add-Critter-Form' of https://github.com/bcgov/…
MacQSL Aug 1, 2023
495027e
Added Family form section, added critterApi, added some custom valida…
GrahamS-Quartech Aug 2, 2023
2bc1115
Merge branch 'BCTW-935-Add-Critter-Form' of github.com:bcgov/biohubbc…
GrahamS-Quartech Aug 2, 2023
8a803f8
Adds mortality event form, relevant string constants. Modified CbSele…
GrahamS-Quartech Aug 2, 2023
7a64c73
Added comments to new components, broke some helpers out into separat…
GrahamS-Quartech Aug 3, 2023
b5218de
created measurement section and handling qual/quant measurements as o…
MacQSL Aug 3, 2023
5f71a4a
Refactored all the custom map stuff inside the Capture and Mortality …
GrahamS-Quartech Aug 3, 2023
c793dd4
fixed merge conflict with CbSelect + modified measruement to handle o…
MacQSL Aug 3, 2023
891c0b3
fixed type issue in LocationEntryForm
MacQSL Aug 3, 2023
28c3e98
commit before CbSelect refactor
MacQSL Aug 4, 2023
cd03376
created FormikSelectWrapper component to handle custom select renderings
MacQSL Aug 4, 2023
8b2a020
updated measurements to now support unit type
MacQSL Aug 4, 2023
f1b0e97
Merge branch 'dev' into BCTW-935-Add-Critter-Form
MacQSL Aug 4, 2023
1658063
created critter class for handling critterbase payload
MacQSL Aug 9, 2023
32fe6fc
fixed measurements from not being fetched
MacQSL Aug 9, 2023
74f7e2e
Updated Critter class payload formatting
MacQSL Aug 10, 2023
7a52f12
updated capture form styling
MacQSL Aug 10, 2023
3c5c57f
Modified some of the critter form transformations to make each of the…
GrahamS-Quartech Aug 11, 2023
9174b10
Fixed markings so that they won't have empty string default for non r…
GrahamS-Quartech Aug 11, 2023
24e36fd
modified temp date fields to real date/timestamp inputs
MacQSL Aug 11, 2023
974ebe1
corrected merge conflict
MacQSL Aug 11, 2023
0829656
commit before grouping refactor
MacQSL Aug 11, 2023
a67d924
updated form styling to be inline with current sims forms
MacQSL Aug 11, 2023
7a1986f
finalized UI changes for Indivdual Animal form
MacQSL Aug 14, 2023
95b920b
created helper function for required fields for yup validation
MacQSL Aug 14, 2023
bd5ada9
Fixed sending empty values on mortality form section and corrected a …
GrahamS-Quartech Aug 14, 2023
3e0f018
updated required fields to use helper function
MacQSL Aug 14, 2023
b41b59c
added temp dev logs for form_values and payload
MacQSL Aug 15, 2023
7b5c683
corrected merge conflict in markings
MacQSL Aug 15, 2023
18dbbf4
Updated critter payload class and UI components to be centered around…
GrahamS-Quartech Aug 15, 2023
7d5ac93
Merge branch 'BCTW-935-Add-Critter-Form' of github.com:bcgov/biohubbc…
GrahamS-Quartech Aug 15, 2023
f418c9e
fixed animal mutation bug + removed excess logging
MacQSL Aug 15, 2023
1883056
Merge branch 'BCTW-935-Add-Critter-Form' of github.com:bcgov/biohubbc…
GrahamS-Quartech Aug 15, 2023
5287165
removed deep copy from Critter constructor
MacQSL Aug 15, 2023
5c451a9
removed deep copy from Critter constructor
MacQSL Aug 15, 2023
60b1d65
updated component / function comments
MacQSL Aug 15, 2023
aa18256
corrected merge conflict in animal constructor
MacQSL Aug 15, 2023
28ebba2
updated animal captured sub header
MacQSL Aug 16, 2023
65f4942
Family section now has a button to view the basic hierarchy of the fa…
GrahamS-Quartech Aug 16, 2023
b58ce0f
Merge branch 'BCTW-935-Add-Critter-Form' of github.com:bcgov/biohubbc…
GrahamS-Quartech Aug 16, 2023
6c0ab62
wrapped children of family modal in outlined papers
MacQSL Aug 16, 2023
548a425
added temp dev button to display form values
MacQSL Aug 16, 2023
ab6e0da
Added snackbar toast to animal form
MacQSL Aug 16, 2023
c010f14
added helper function to pluarlize dialog/toast text
MacQSL Aug 16, 2023
41a0607
auto formatted code for PR
MacQSL Aug 16, 2023
3c999d7
fixed CB_API_URL formatting error
MacQSL Aug 16, 2023
00924bc
fixed merge conflicts with dev
MacQSL Aug 16, 2023
7305b3c
added tests for animal.ts helper functions
MacQSL Aug 16, 2023
e6eabff
Fixed a bug where switching to UTM coordinates would not populate the…
GrahamS-Quartech Aug 17, 2023
c8d8ed5
Merge branch 'BCTW-935-Add-Critter-Form' of github.com:bcgov/biohubbc…
GrahamS-Quartech Aug 17, 2023
f08bda7
added tests for critter captures/markings
MacQSL Aug 17, 2023
650798c
Merge branch 'BCTW-935-Add-Critter-Form' of https://github.com/bcgov/…
MacQSL Aug 17, 2023
7ec9c76
Added some basic tests for critterbase api hooks
GrahamS-Quartech Aug 17, 2023
58f6c5b
changed function isReq -> isRequiredInSchema
MacQSL Aug 17, 2023
0f55e50
created stable id values for the array form sections
MacQSL Aug 17, 2023
98ebb2f
removed commented code
MacQSL Aug 17, 2023
be96c9a
updated tests
MacQSL Aug 17, 2023
175a223
fixed formatting issue in measurement
MacQSL Aug 17, 2023
9cf9775
Created basic service to send requests to BCTW API
JeremyQuartech Aug 17, 2023
a5c3656
fixed multiple codeSmells ignore-skip
MacQSL Aug 17, 2023
4b20cee
removed nested template literal ignore-skip
MacQSL Aug 17, 2023
aad8763
fixed key issue in formSectionWrapper
MacQSL Aug 17, 2023
bd0aa93
fixed issue with url formatting in useAxios
MacQSL Aug 18, 2023
738832b
Added bctw health endpoint to test connection and auth.
JeremyQuartech Aug 18, 2023
6f3aafc
corrected all issues in PR comments
MacQSL Aug 18, 2023
aa65957
fixed formatting
MacQSL Aug 18, 2023
5200b24
Added new keycloak method to get service token.
JeremyQuartech Aug 21, 2023
57d6cb8
CbSelectField updated for exhaustive dependecies / ignoring one instance
MacQSL Aug 21, 2023
5ea64d6
wrapped isValueInRange in useMemo
MacQSL Aug 21, 2023
f73e4a3
updated animal constructor to removed dead values
MacQSL Aug 21, 2023
fcae94e
updated family to use CbSelectWrapper
MacQSL Aug 21, 2023
036e78c
fixed issue with capture section add btn being incorrectly disabled
MacQSL Aug 21, 2023
ae69d68
removed console.log in capture
MacQSL Aug 21, 2023
4d98ab6
added additional props for TextInputToggle to control the toggle stat…
MacQSL Aug 22, 2023
b1446f2
fixed measurement selection bug
MacQSL Aug 22, 2023
5d48e92
updated general section key + added custom canAddSection handler for …
MacQSL Aug 22, 2023
bb193ec
WIP: Adds basic endpoints to BCTW service.
JeremyQuartech Aug 22, 2023
853aa34
Fixed typescript error in makeRequest function
JeremyQuartech Aug 23, 2023
678230a
Merge branch 'BCTW-935-Add-Critter-Form' of github.com:bcgov/biohubbc…
GrahamS-Quartech Aug 23, 2023
3e3ea5e
Added support for query to makeGetRequest bctw method.
JeremyQuartech Aug 23, 2023
e7666fe
Added a critterbase service in the same style as the bctw-service
GrahamS-Quartech Aug 23, 2023
354d96a
Merge branch 'BCTW-935-Add-Critter-Form' into critterbase-service
GrahamS-Quartech Aug 23, 2023
76c842d
Added unit tests for bctw-service.
JeremyQuartech Aug 23, 2023
3940f06
Added test coverage for missing line.
JeremyQuartech Aug 23, 2023
86a3d4b
Added telemetry vendor lookup route and removed deprecated deployment…
JeremyQuartech Aug 24, 2023
d92ec3e
Added unit tests for vendor request handler.
JeremyQuartech Aug 24, 2023
bce16d6
Fleshed out the critterbase service with more of the required routes …
GrahamS-Quartech Aug 24, 2023
d03b7d9
Fixed signup hook so that it also goes through the critterbase servic…
GrahamS-Quartech Aug 28, 2023
f9ee232
Fixed names of some of the ICbRoute keys to be more consistent with o…
GrahamS-Quartech Aug 28, 2023
61e5217
Some more renames, removed console logs, fixed lint issues
GrahamS-Quartech Aug 28, 2023
bc50882
Merge branch 'critterbase-service' into SIMSBIOHUB-239
GrahamS-Quartech Aug 28, 2023
37235b8
Moved some duplicate code from critter measurement paths into a reusa…
GrahamS-Quartech Aug 28, 2023
926979c
Merge branch 'dev' into SIMSBIOHUB-239
GrahamS-Quartech Aug 28, 2023
aff674d
Added a missing function to the lookup hook, fixed a broken test
GrahamS-Quartech Aug 28, 2023
5502848
Fixed a duplicately named function
GrahamS-Quartech Aug 28, 2023
888bf4e
Fixed some tests and linting issues
GrahamS-Quartech Aug 28, 2023
237bc04
Added tests for critterbase service
GrahamS-Quartech Aug 29, 2023
5e4df5e
Added family index request handler try/catch and unit tests.
JeremyQuartech Aug 29, 2023
118d022
Merge branch 'SIMSBIOHUB-239' of https://github.com/bcgov/biohubbc in…
JeremyQuartech Aug 29, 2023
5161c2c
Added unit tests for 'getFamilyById'
JeremyQuartech Aug 29, 2023
d63bea0
Added unit test for 'getTaxonBodyLocations'
JeremyQuartech Aug 29, 2023
e2f1480
Added unit tests for 'getTaxonMeasurements'
JeremyQuartech Aug 29, 2023
1659306
Added unit tests for 'getQualMeasurementOptions'
JeremyQuartech Aug 29, 2023
93d7ff0
Added unit tests for 'signUp'
JeremyQuartech Aug 29, 2023
6660d97
Added tests for critters and lookups paths
GrahamS-Quartech Aug 29, 2023
4a7fd49
Merge branch 'SIMSBIOHUB-239' of github.com:bcgov/biohubbc into SIMSB…
GrahamS-Quartech Aug 29, 2023
ea815d1
Merge branch 'dev' into SIMSBIOHUB-239
JeremyQuartech Aug 29, 2023
b444fab
Merge branch 'SIMSBIOHUB-239' of github.com:bcgov/biohubbc into SIMSB…
GrahamS-Quartech Aug 29, 2023
39f5d57
Missed the tiniest of tiny lints
GrahamS-Quartech Aug 29, 2023
4553ef1
Added environment variables for BCTW and Critterbase API URLs, ignore…
JeremyQuartech Aug 29, 2023
97b5f5c
Small fixes to deployment config
GrahamS-Quartech Aug 29, 2023
2490104
Added new env to the top of the template as well
GrahamS-Quartech Aug 29, 2023
0252c79
Changed BctwService interfaces to zod objects
JeremyQuartech Aug 29, 2023
57bf290
Adressed review comments. Renamed critter post path, fixed some strin…
GrahamS-Quartech Aug 29, 2023
adc1c79
Merge branch 'SIMSBIOHUB-239' of github.com:bcgov/biohubbc into SIMSB…
GrahamS-Quartech Aug 29, 2023
f339cdb
Merge branch 'dev' into SIMSBIOHUB-239
GrahamS-Quartech Aug 29, 2023
b8f111e
ignore-skip
al-rosenthal Aug 29, 2023
55a9c07
SIMSBIOHUB-239: updated error handling
curtisupshall Aug 30, 2023
f8b06b7
Added error handling to interceptor and removed makePostPatch method …
JeremyQuartech Aug 30, 2023
339a58f
Added request interceptor to axios instance to allow async keycloak t…
JeremyQuartech Aug 30, 2023
5acc4bd
Removed test code
JeremyQuartech Aug 30, 2023
efe242d
Fixed axios instance for critterbase service, fixed bulk insert behav…
GrahamS-Quartech Aug 30, 2023
0ef26ba
Merge branch 'SIMSBIOHUB-239' of github.com:bcgov/biohubbc into SIMSB…
GrahamS-Quartech Aug 30, 2023
63e49f4
WIP: Updated bctw tests
JeremyQuartech Aug 30, 2023
27c7286
Merge branch 'SIMSBIOHUB-239' of https://github.com/bcgov/biohubbc in…
JeremyQuartech Aug 30, 2023
9453798
Fixed failing BctwService tests
JeremyQuartech Aug 30, 2023
8086044
Fixed failing critterbase service tests
JeremyQuartech Aug 30, 2023
c8e3abe
Addressed more review comments. Added uuid format to paths, fixed tes…
GrahamS-Quartech Aug 30, 2023
558e085
Removed some outdated checks against frontend critterbase env vars
GrahamS-Quartech Aug 30, 2023
989b991
Added hooks and endpoint for filtering critterbase critters
GrahamS-Quartech Aug 30, 2023
817b47a
Added empty telemetry form
JeremyQuartech Aug 31, 2023
d8063a0
Merge branch 'dev' into SIMSBIOHUB-207
JeremyQuartech Aug 31, 2023
dd8b9f7
Added typing for the critter response, basic table with actions menu …
GrahamS-Quartech Aug 31, 2023
0b9bf49
Merge branch 'dev' into SIMSBIOHUB-216
GrahamS-Quartech Aug 31, 2023
cbee3d5
WIP: telemetry form
JeremyQuartech Aug 31, 2023
8250f41
WIP: Telemetry Device form, Telemetry select fields, and telemetry Ap…
JeremyQuartech Sep 1, 2023
32a35c2
Adds relevant routes, types, and services functions to add critters a…
GrahamS-Quartech Sep 1, 2023
a632c2b
Added routes and functions for removing a critter from a survey. Ther…
GrahamS-Quartech Sep 1, 2023
67a6a66
Merge branch 'SIMSBIOHUB-207' into SIMSBIOHUB-216
GrahamS-Quartech Sep 1, 2023
c687b25
This adds the ability to deploy devices from SIMS. Also adds code fet…
GrahamS-Quartech Sep 6, 2023
61e21c8
WIP: Joined device data to critters in SurveyAnimalsTable
JeremyQuartech Sep 6, 2023
72666a2
Added support for multiple devices per critter at survey level.
JeremyQuartech Sep 6, 2023
ff09d0d
Added basic tests for useDeviceApi
JeremyQuartech Sep 7, 2023
0996787
Fixed infered type error
JeremyQuartech Sep 7, 2023
f6fb6fa
WIP: Writing tests for new critter and device endpoints
JeremyQuartech Sep 7, 2023
c634e02
WIP: Added tests to critter / deployment related survey endpoints
JeremyQuartech Sep 7, 2023
9d19d06
Updated BctwService and CritterbaseService tests
JeremyQuartech Sep 8, 2023
a824e66
Various PR recommendations
JeremyQuartech Sep 8, 2023
52dff78
Removed old comments, ignore-skip
JeremyQuartech Sep 8, 2023
a3d6dcb
Added new survey-repository tests for new critter and device funciton…
JeremyQuartech Sep 8, 2023
b9269b3
Added survey-service tests for new critter and device methods
JeremyQuartech Sep 8, 2023
9aca229
Fixed code smells and lint errors
JeremyQuartech Sep 11, 2023
032c164
Code smell fixes
JeremyQuartech Sep 11, 2023
1d82ea8
Create critter duplicated code fix.
JeremyQuartech Sep 11, 2023
ddb61a9
Addressed review comments, made critter service its own thing separat…
GrahamS-Quartech Sep 11, 2023
3e74745
Merge branch 'SIMSBIOHUB-216' of github.com:bcgov/biohubbc into SIMSB…
GrahamS-Quartech Sep 11, 2023
1eac3ad
Merge branch 'dev' into SIMSBIOHUB-216
JeremyQuartech Sep 11, 2023
0dfffed
Added string / number type to Telemetry select field data loader types
JeremyQuartech Sep 11, 2023
6fa39d2
Merge branch 'SIMSBIOHUB-216' of https://github.com/bcgov/biohubbc in…
JeremyQuartech Sep 11, 2023
32ac44c
Made generic CustomDataGrid so custom styling can be reused
GrahamS-Quartech Sep 11, 2023
b913e4f
Merge branch 'SIMSBIOHUB-216' of github.com:bcgov/biohubbc into SIMSB…
GrahamS-Quartech Sep 11, 2023
951962d
Fixed some broken api tests
GrahamS-Quartech Sep 11, 2023
5a4229f
Refactored critter-survey matching for faster lookup
JeremyQuartech Sep 11, 2023
de7a9b3
Merge branch 'SIMSBIOHUB-216' of https://github.com/bcgov/biohubbc in…
JeremyQuartech Sep 11, 2023
1b30598
Added some additional tests for the survey hook
GrahamS-Quartech Sep 11, 2023
2736029
Merge branch 'SIMSBIOHUB-216' of github.com:bcgov/biohubbc into SIMSB…
GrahamS-Quartech Sep 11, 2023
e77001b
Adds some api routes and added error handling in the frontend for the…
GrahamS-Quartech Sep 11, 2023
a99b623
Merge branch 'dev' into SIMSBIOHUB-216
JeremyQuartech Sep 11, 2023
7f24991
Adds missing test for deviceId route
GrahamS-Quartech Sep 11, 2023
8e2d454
Merge branch 'SIMSBIOHUB-216' of github.com:bcgov/biohubbc into SIMSB…
GrahamS-Quartech Sep 11, 2023
4046d46
Fixes a small type complaint
GrahamS-Quartech Sep 12, 2023
51c20e2
Conditional rendering for certain table actions depending on device s…
GrahamS-Quartech Sep 13, 2023
f01968c
Functional edit deployment screen but broken add deployment. Comittin…
GrahamS-Quartech Sep 13, 2023
4aa70c4
Several changes to improve some strange defocusing behavior on the te…
GrahamS-Quartech Sep 14, 2023
44c9e80
Fully functional edit deployment screen that will send requests to up…
GrahamS-Quartech Sep 15, 2023
15c51f2
CHanged location of dynamic bctw errors in the form
GrahamS-Quartech Sep 15, 2023
70d61ef
Merge branch 'dev' into SIMSBIOHUB-211
GrahamS-Quartech Sep 15, 2023
ee414d9
Fixed a broken test
GrahamS-Quartech Sep 15, 2023
1fc3f8c
Removed some unwanted buttons in the action menu that I added back ac…
GrahamS-Quartech Sep 15, 2023
6008ae9
adds additional testing for new services and endpoints
GrahamS-Quartech Sep 18, 2023
cd6b08a
Adds additional missing test, fixes lint error
GrahamS-Quartech Sep 18, 2023
96e6845
Forgot a test file
GrahamS-Quartech Sep 18, 2023
bb82bcd
Fixed some borked Survey UI tests
GrahamS-Quartech Sep 18, 2023
5a1e18c
SurveyAnimals test will now press buttons
GrahamS-Quartech Sep 18, 2023
5a562f9
Adresses PR comments, adds enums, return types, adds specific try cat…
GrahamS-Quartech Sep 18, 2023
eafcbc1
Catches some bugs surrounding submitting new deployments and editing …
GrahamS-Quartech Sep 18, 2023
90bacec
Adds some more test and addresses PR comments
GrahamS-Quartech Sep 19, 2023
e06bcca
Adds more tests
GrahamS-Quartech Sep 19, 2023
a196f9e
lint fix
GrahamS-Quartech Sep 19, 2023
cbad57a
Removing the code smell surrounding array indexes as react keys
GrahamS-Quartech Sep 19, 2023
ae21c2d
added more survey tests to make review pass
GrahamS-Quartech Sep 19, 2023
9085810
Separated current and previous devices into own columns, made wlh id …
GrahamS-Quartech Sep 19, 2023
770a894
Fully implemented critter collection unit form section, submits corre…
GrahamS-Quartech Sep 19, 2023
a7026e7
Added tests for new hooks and routes
GrahamS-Quartech Sep 20, 2023
d8cbfcb
Merge branch 'dev' into SIMSBIOHUB-281
GrahamS-Quartech Sep 20, 2023
53aec06
Removed some routes that proved unecessary after all. Fixed some brok…
GrahamS-Quartech Sep 20, 2023
d3f87e0
Added proper string constants, fixed wlh id being excluded from paylo…
GrahamS-Quartech Sep 20, 2023
ddd58d9
Forgot to commit lint fix
GrahamS-Quartech Sep 20, 2023
0ba32b9
Added an app test for new form section
GrahamS-Quartech Sep 20, 2023
58b6943
tiny lint
GrahamS-Quartech Sep 20, 2023
e17f765
Renamed some constants, created sex enum, fixed tests from that chang…
GrahamS-Quartech Sep 20, 2023
214a0ef
Merge branch 'dev' into SIMSBIOHUB-281
GrahamS-Quartech Sep 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/src/components/fields/CbSelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface ICbSelectField extends ICbSelectSharedProps {
route: string;
param?: string;
query?: string;
disabledValues?: Record<string, boolean>;
handleChangeSideEffect?: (value: string, label: string) => void;
}

Expand All @@ -35,7 +36,7 @@ interface ICbSelectOption {
**/

const CbSelectField: React.FC<ICbSelectField> = (props) => {
const { name, label, route, param, query, handleChangeSideEffect, controlProps } = props;
const { name, label, route, param, query, handleChangeSideEffect, controlProps, disabledValues } = props;

const api = useCritterbaseApi();
const isMounted = useIsMounted();
Expand Down Expand Up @@ -83,13 +84,13 @@ const CbSelectField: React.FC<ICbSelectField> = (props) => {
<CbSelectWrapper
name={name}
label={label}
controlProps={{ ...controlProps, disabled: !data?.length }}
controlProps={{ ...controlProps, disabled: controlProps?.disabled || !data?.length }}
onChange={innerChangeHandler}
value={isValueInRange ? val : ''}>
{data?.map((a) => {
const item = typeof a === 'string' ? { label: a, value: a } : { label: a.value, value: a.id };
return (
<MenuItem key={item.value} value={item.value}>
<MenuItem disabled={disabledValues?.[item.value]} key={item.value} value={item.value}>
GrahamS-Quartech marked this conversation as resolved.
Show resolved Hide resolved
{item.label}
</MenuItem>
);
Expand Down
10 changes: 8 additions & 2 deletions app/src/constants/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,17 @@ export const SurveyAnimalsI18N = {
animalMortalityHelp:
"Mortality Events describe an individual's death, including the suspected location, date, and cause of death. An individual can only have one Mortality Event.",
animalMortalityAddBtn: 'Add Mortality',

animalCollectionUnitTitle: 'Ecological Units',
animalCollectionUnitTitle2: 'Ecological Unit',
animalCollectionUnitHelp:
'Ecological units are groups such as population units, herds, and packs. Different species may different units and unit names.',
animalCollectionUnitAddBtn: 'Add Unit',
// Input help strings
taxonHelp:
'The species or taxon of the animal. If the species is unknown, select the lowest-ranking known taxon, such as the genus or family',
taxonLabelHelp: 'A custom and unique name for you to recognize this individual'
taxonLabelHelp: 'A custom and unique name for you to recognize this individual',
wlhIdHelp: 'The Wildlife Health ID associated with this critter.',
sexHelp: 'The sex of this critter. Leave as Unknown if unsure.'
};

export const FundingSourceI18N = {
Expand Down
11 changes: 9 additions & 2 deletions app/src/features/surveys/view/SurveyAnimals.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,14 @@ describe('SurveyAnimals', () => {

it('renders correctly with animals', async () => {
mockUseBiohub.survey.getSurveyCritters.mockResolvedValueOnce([
{ critter_id: 'critter_uuid', survey_critter_id: 1, animal_id: 'a', taxon: 'a', created_at: 'a' }
{
critter_id: 'critter_uuid',
survey_critter_id: 1,
animal_id: 'a',
taxon: 'a',
created_at: 'a',
wlh_id: '123-45'
}
]);

mockUseBiohub.survey.getDeploymentsInSurvey.mockResolvedValue([{ critter_id: 'critter_uuid', device_id: 123 }]);
Expand All @@ -119,7 +126,7 @@ describe('SurveyAnimals', () => {
);

await waitFor(() => {
expect(getByText('critter_uuid')).toBeInTheDocument();
expect(getByText('123-45')).toBeInTheDocument();
expect(getByTestId('survey-animal-table')).toBeInTheDocument();
fireEvent.click(getByTestId('animal actions'));
fireEvent.click(getByTestId('animal-table-row-edit-timespan'));
Expand Down
5 changes: 3 additions & 2 deletions app/src/features/surveys/view/SurveyAnimals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import React, { useContext, useState } from 'react';
import { datesSameNullable, pluralize } from 'utils/Utils';
import yup from 'utils/YupSchema';
import NoSurveySectionData from '../components/NoSurveySectionData';
import { AnimalSchema, Critter, IAnimal } from './survey-animals/animal';
import { AnimalSchema, AnimalSex, Critter, IAnimal } from './survey-animals/animal';
import { AnimalTelemetryDeviceSchema, Device, IAnimalTelemetryDevice } from './survey-animals/device';
import IndividualAnimalForm from './survey-animals/IndividualAnimalForm';
import { SurveyAnimalsTable } from './survey-animals/SurveyAnimalsTable';
Expand Down Expand Up @@ -74,10 +74,11 @@ const SurveyAnimals: React.FC = () => {
};

const AnimalFormValues: IAnimal = {
general: { taxon_id: '', taxon_name: '', animal_id: '' },
general: { wlh_id: '', taxon_id: '', taxon_name: '', animal_id: '', sex: AnimalSex.UNKNOWN },
captures: [],
markings: [],
mortality: [],
collectionUnits: [],
measurements: [],
family: [],
images: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Form, useFormikContext } from 'formik';
import { useEffect } from 'react';
import { Critter, IAnimal } from './animal';
import CaptureAnimalForm from './form-sections/CaptureAnimalForm';
import CollectionUnitAnimalForm from './form-sections/CollectionUnitAnimalForm';
import FamilyAnimalForm from './form-sections/FamilyAnimalForm';
import GeneralAnimalForm from './form-sections/GeneralAnimalForm';
import MarkingAnimalForm from './form-sections/MarkingAnimalForm';
Expand Down Expand Up @@ -37,6 +38,7 @@ const IndividualAnimalForm = ({ getAnimalCount }: IndividualAnimalFormProps) =>
<Form>
<Typography variant="h4">Add New Individual</Typography>
<GeneralAnimalForm />
<CollectionUnitAnimalForm />
<CaptureAnimalForm />
<MortalityAnimalForm />
<MarkingAnimalForm />
Expand Down
47 changes: 31 additions & 16 deletions app/src/features/surveys/view/survey-animals/SurveyAnimalsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { GridColDef } from '@mui/x-data-grid';
import { CustomDataGrid } from 'components/tables/CustomDataGrid';
import { DATE_FORMAT } from 'constants/dateTimeFormats';
import { IDetailedCritterWithInternalId } from 'interfaces/useSurveyApi.interface';
import moment from 'moment';
import { getFormattedDate } from 'utils/Utils';
import { IAnimalDeployment } from './device';
import SurveyAnimalsTableActions from './SurveyAnimalsTableActions';
Expand Down Expand Up @@ -47,17 +48,17 @@ export const SurveyAnimalsTable = ({
: animalData;

const columns: GridColDef<ISurveyAnimalsTableEntry>[] = [
{
field: 'critter_id',
headerName: 'Critter ID',
flex: 1,
minWidth: 300
},
{
field: 'animal_id',
headerName: 'Animal ID',
headerName: 'Alias',
flex: 1
},
{
field: 'wlh_id',
headerName: 'WLH ID',
flex: 1,
renderCell: (params) => <Typography>{params.value ? params.value : 'None'}</Typography>
},
{
field: 'taxon',
headerName: 'Taxon',
Expand All @@ -72,16 +73,30 @@ export const SurveyAnimalsTable = ({
)
},
{
field: 'deployments',
headerName: 'Device ID',
field: 'current_devices',
headerName: 'Current Devices',
GrahamS-Quartech marked this conversation as resolved.
Show resolved Hide resolved
flex: 1,
renderCell: (params) => (
<Typography>
{params.value?.length
? params.value?.map((device: IAnimalDeployment) => device.device_id).join(', ')
: 'No Device'}
</Typography>
)
valueGetter: (params) => {
const currentDeploys = params.row.deployments?.filter(
(device: IAnimalDeployment) => !device.attachment_end || moment(device.attachment_end).isAfter(moment())
);
return currentDeploys?.length
? currentDeploys.map((device: IAnimalDeployment) => device.device_id).join(', ')
: 'No Devices';
}
},
{
field: 'previous_devices',
headerName: 'Previous Devices',
GrahamS-Quartech marked this conversation as resolved.
Show resolved Hide resolved
flex: 1,
valueGetter: (params) => {
const previousDeploys = params.row.deployments?.filter(
(device: IAnimalDeployment) => device.attachment_end && moment(device.attachment_end).isBefore(moment())
);
return previousDeploys?.length
? previousDeploys.map((device: IAnimalDeployment) => device.device_id).join(', ')
: 'No Devices';
}
},
{
field: 'actions',
Expand Down
26 changes: 19 additions & 7 deletions app/src/features/surveys/view/survey-animals/animal.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import yup from 'utils/YupSchema';
import { v4 } from 'uuid';
import {
AnimalSex,
Critter,
getAnimalFieldName,
glt,
IAnimal,
IAnimalMarking,
ICritterMarking,
isRequiredInSchema,
lastAnimalValueValid
} from './animal';

const animal: IAnimal = {
general: { taxon_id: 'a', taxon_name: 'taxon', animal_id: 'animal' },
general: { taxon_id: 'a', taxon_name: 'taxon', animal_id: 'animal', wlh_id: 'a', sex: AnimalSex.MALE },
captures: [
{
_id: v4(),
Expand Down Expand Up @@ -50,7 +50,8 @@ const animal: IAnimal = {
measurements: [],
family: [],
images: [],
device: undefined
device: undefined,
collectionUnits: [{ collection_category_id: 'a', collection_unit_id: 'b', _id: v4() }]
};

describe('Animal', () => {
Expand Down Expand Up @@ -170,11 +171,22 @@ describe('Animal', () => {

it('constructor should create critter markings', () => {
const c_marking = critter.markings[0];
const a_marking = critter.markings[0];
const a_marking = animal.markings[0];
expect(c_marking.critter_id).toBe(critter.critter_id);
for (const prop in c_marking) {
expect(c_marking[prop as keyof ICritterMarking]).toBe(a_marking[prop as keyof ICritterMarking]);
}

expect(c_marking.marking_type_id).toBe(a_marking.marking_type_id);
expect(c_marking.taxon_marking_body_location_id).toBe(a_marking.taxon_marking_body_location_id);
expect(c_marking.primary_colour_id).toBe(a_marking.primary_colour_id);
expect(c_marking.secondary_colour_id).toBe(a_marking.secondary_colour_id);
expect(c_marking.marking_comment).toBe(a_marking.marking_comment);
});

it('constructor should create collections and strip extra vals', () => {
const c_collection = critter.collections[0];
const a_collection = animal.collectionUnits[0];
expect(c_collection.critter_id).toBe(critter.critter_id);
expect((c_collection as any)['collection_category_id']).not.toBeDefined();
expect(c_collection.collection_unit_id).toBe(a_collection.collection_unit_id);
});
});
});
37 changes: 35 additions & 2 deletions app/src/features/surveys/view/survey-animals/animal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ import { v4 } from 'uuid';
import { AnyObjectSchema, InferType, reach } from 'yup';
import { AnimalTelemetryDeviceSchema } from './device';

export enum AnimalSex {
MALE = 'Male',
FEMALE = 'Female',
UNKNOWN = 'Unknown',
HERM = 'Hermaphroditic'
}

/**
* Provides an acceptable amount of type security with formik field names for animal forms
* Returns formatted field name in regular or array format
Expand Down Expand Up @@ -56,7 +63,9 @@ export type ProjectionMode = 'wgs' | 'utm';
export const AnimalGeneralSchema = yup.object({}).shape({
taxon_id: yup.string().required(req),
animal_id: yup.string().required(req),
taxon_name: yup.string()
taxon_name: yup.string(),
wlh_id: yup.string(),
sex: yup.mixed<AnimalSex>().oneOf(Object.values(AnimalSex))
});

export const AnimalCaptureSchema = yup.object({}).shape({
Expand Down Expand Up @@ -101,7 +110,13 @@ export const AnimalMarkingSchema = yup.object({}).shape({
secondary_colour_id: yup.string().optional(),
marking_comment: yup.string()
});
//proprietaryDataForm

export const AnimalCollectionUnitSchema = yup.object({}).shape({
_id: yup.string().required(),
collection_unit_id: yup.string().required(),
collection_category_id: yup.string().required()
});

export const AnimalMeasurementSchema = yup.object({}).shape(
{
_id: yup.string().required(),
Expand Down Expand Up @@ -159,6 +174,7 @@ export const AnimalSchema = yup.object({}).shape({
mortality: yup.array().of(AnimalMortalitySchema).required(),
family: yup.array().of(AnimalRelationshipSchema).required(),
images: yup.array().of(AnimalImageSchema).required(),
collectionUnits: yup.array().of(AnimalCollectionUnitSchema).required(),
device: AnimalTelemetryDeviceSchema.default(undefined)
});

Expand All @@ -178,6 +194,8 @@ export type IAnimalCapture = InferType<typeof AnimalCaptureSchema>;

export type IAnimalMarking = InferType<typeof AnimalMarkingSchema>;

export type IAnimalCollectionUnit = InferType<typeof AnimalCollectionUnitSchema>;

export type IAnimalMeasurement = InferType<typeof AnimalMeasurementSchema>;

export type IAnimalMortality = InferType<typeof AnimalMortalitySchema>;
Expand Down Expand Up @@ -220,6 +238,8 @@ type ICritterCapture = Omit<

export type ICritterMarking = Omit<ICritterID & IAnimalMarking, '_id'>;

export type ICritterCollection = Omit<ICritterID & IAnimalCollectionUnit, '_id' | 'collection_category_id'>;

type ICritterQualitativeMeasurement = Omit<ICritterID & IAnimalMeasurement, 'value' | '_id'>;

type ICritterQuantitativeMeasurement = Omit<ICritterID & IAnimalMeasurement, 'qualitative_option_id' | '_id'>;
Expand Down Expand Up @@ -256,6 +276,8 @@ export class Critter {
critter_id: string;
taxon_id: string;
animal_id: string;
wlh_id?: string;
sex?: AnimalSex;
captures: ICritterCapture[];
markings: ICritterMarking[];
measurements: {
Expand All @@ -265,6 +287,7 @@ export class Critter {
mortalities: Omit<ICritterMortality, '_id'>[];
families: ICritterRelationships;
locations: ICritterLocation[];
collections: ICritterCollection[];

private taxon_name?: string;

Expand Down Expand Up @@ -355,6 +378,13 @@ export class Critter {
});
}

_formatCritterCollectionUnits(animal_collections: IAnimalCollectionUnit[]): ICritterCollection[] {
return animal_collections.map((collection) => ({
critter_id: this.critter_id,
...omit(collection, ['_id', 'collection_category_id'])
}));
}

_formatCritterQualitativeMeasurements(animal_measurements: IAnimalMeasurement[]): ICritterQualitativeMeasurement[] {
const filteredQualitativeMeasurements = animal_measurements.filter((measurement) => {
if (measurement.qualitative_option_id && measurement.value) {
Expand Down Expand Up @@ -421,6 +451,8 @@ export class Critter {
this.taxon_id = animal.general.taxon_id;
this.taxon_name = animal.general.taxon_name;
this.animal_id = animal.general.animal_id;
this.wlh_id = animal.general.wlh_id;
this.sex = animal.general.sex;
const { captures, capture_locations } = this._formatCritterCaptures(animal.captures);
const { mortalities, mortalities_locations } = this._formatCritterMortalities(animal.mortality);

Expand All @@ -429,6 +461,7 @@ export class Critter {
this.locations = [...capture_locations, ...mortalities_locations];

this.markings = this._formatCritterMarkings(animal.markings);
this.collections = this._formatCritterCollectionUnits(animal.collectionUnits);

this.measurements = {
qualitative: this._formatCritterQualitativeMeasurements(animal.measurements),
Expand Down
Loading