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-648: Create Sampling Period Page #1446

Open
wants to merge 32 commits into
base: dev
Choose a base branch
from
Open

Conversation

mauberti-bc
Copy link
Collaborator

@mauberti-bc mauberti-bc commented Dec 5, 2024

Links to Jira Tickets

  • {Include a link to all applicable Jira tickets}

Description of Changes

  • Adds pages for creating and editing sampling periods
  • Removes the ability to create sampling periods while creating a sampling site
  • Moves the sample-method/{methodId}/sample-period endpoints to survey/sample-site/sample-period, for bulk actions

Testing Notes

  • Should be able to create, edit and delete sampling periods
  • Should be able to create sampling sites without methods or periods

TODO Notes (Nick)

  • Database/API allow null periods/techniques/sample sites when reading/writing periods. Add trigger/constraint to ensure at least 1 of the 3 pieces of data is provided in a period
  • Fix Frontend requires ALL site/technique/period data in CREATE/EDIT periods
  • Fix sampling site left nav not showing periods
  • Fix the frontend observation table validation, so that if a site is required, a technique is required, and a period.
  • Fix openapi schemas for periods to handle the 3 cases (null site, null technique,null dates)
    • Note: not a good way to enforce this via openapi alone. Added a check in the endpoint itself. Paired with the database trigger constraint, should prevent any bad data from getting into the period table.
  • Fix observation analytics (not rendering periods in the table?)
  • Fix Invalid Date in sampling periods table on survey page.
  • Fix issue where a partial period record isn't saved when editing an existing observation record
    • Note: This is actually working correctly. If you edit a row with partial sampling information, the underlying period_id does get sent to the backend, and the sampling information is preserved. If you modify any of the sampling columns, then you lose the original id (unless you discard changes). The only caveat to this, is that because of the validation rules around requiring all 3 sampling columns, you cannot edit other columns in the row, without also filling in the remaining sampling columns.

@mauberti-bc mauberti-bc added the Early Feedback Welcome PR is not finished, but early review feedback is welcomed label Dec 5, 2024
Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 26.98651% with 974 lines in your changes missing coverage. Please review.

Project coverage is 45.26%. Comparing base (961f452) to head (274079f).

Files with missing lines Patch % Lines
api/src/services/observation-services/utils.ts 11.65% 91 Missing ⚠️
...mpling-information/useSamplingInformationCache.tsx 0.00% 86 Missing ⚠️
api/src/repositories/sample-period-repository.ts 27.84% 53 Missing and 4 partials ⚠️
...lds/AutocompleteSearch/AutocompleteSearchField.tsx 0.00% 52 Missing ⚠️
...ion/techniques/MethodTechniqueDataGridEditCell.tsx 1.96% 50 Missing ⚠️
...-information/periods/edit/EditSamplePeriodPage.tsx 0.00% 47 Missing ⚠️
...ng-information/periods/SamplingPeriodContainer.tsx 0.00% 43 Missing ⚠️
...formation/periods/SamplePeriodDataGridEditCell.tsx 2.63% 37 Missing ⚠️
api/src/repositories/analytics-repository.ts 41.93% 32 Missing and 4 partials ⚠️
...ormation/periods/create/CreateSamplePeriodPage.tsx 0.00% 36 Missing ⚠️
... and 38 more
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1446      +/-   ##
==========================================
- Coverage   45.97%   45.26%   -0.71%     
==========================================
  Files         910      912       +2     
  Lines       23698    23875     +177     
  Branches     3493     3558      +65     
==========================================
- Hits        10895    10808      -87     
- Misses      12189    12462     +273     
+ Partials      614      605       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mauberti-bc mauberti-bc added Ready For Review PR is ready for review and removed Early Feedback Welcome PR is not finished, but early review feedback is welcomed labels Dec 10, 2024
@mauberti-bc mauberti-bc marked this pull request as ready for review December 12, 2024 20:40
@NickPhura
Copy link
Collaborator

A few things I noticed:


When creating a period, if you select a site, and then remove the period from it, the validation is probably failing because the form won't submit, but there is no error message shown.

image


When editing an existing sample period, I can't select or change the sample sites.

image


Nit: I can save a period with a start and end date that are exactly the same (with no time).

image

If I pick the same times, then the save stops working, though there is no error message about why.


I have 1 sampling site, 1 technique, and 3 periods. The techniques aren't being combined in the observations table when adding a record:

image

@mauberti-bc
Copy link
Collaborator Author

  • I disallowed changing the site because at that point you may as well create a new period for the correct site and delete the wrong one. Seems along the lines of turning a skateboard into a car instead of just buying a car. Maybe worth allowing though?
  • We do want to allow a period that starts and stops on the same day with no time, in case the time is not known. I agree this seems off but is realistic data. (The duration column is null for those periods because there isn't an obvious way to represent the unknown duration)

@mauberti-bc
Copy link
Collaborator Author

image
There's a failing request when expanding a sampling site in the left side panel of the observations page. Otherwise haven't found any issues

Update api and app to account for null survey_sample_period fields.
@mauberti-bc
Copy link
Collaborator Author

mauberti-bc commented Jan 8, 2025

  • No observations are being returned on the observations table page, but the request succeeds
  • When you select a site or technique, then remove that site or technique from the form, that option does not return to the autocomplete options (you have to refresh the autocomplete for it to show up).
  • We should also load the sampling site and technique autocompletes when the component mounts, before any input.

mauberti-bc and others added 10 commits January 8, 2025 10:55
…ng always.

Fixed issue preventing observations from loading.
Fixed issue in seed.
Update create/edit periods to enforce site, technique, and period information.
UI tweaks to create/edit periods pages.
Enforce site/technique/period validation on observations table.
Update sample sites left list, to show technique/period details.
Tweak analytics frontend (disable sorting which is not yet supported)
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
10.9% Duplication on New Code (required ≤ 3%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants