-
Notifications
You must be signed in to change notification settings - Fork 4
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
Use investigationFacilityCycles
to determine the facility cycles an Investigation belongs to
#1415
Use investigationFacilityCycles
to determine the facility cycles an Investigation belongs to
#1415
Conversation
ICAT now returns the facility cycles an investigation belongs to through the investigationFacilityCycles field of Investigation, so the manual calculations to determine the facility cycle of an investigation on the frontend side is no longer needed
Write tests for the changes made to ISIS facility cycle calculation (making use of investigationFacilityCycles field)
Improve doc comments for the investigation/dataset/datafile URL builder functions, and also update the tests for the dataset builder function
Forgot to pass showLanding param to buildDatasetUrl in datafileSearchTable
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #1415 +/- ##
===========================================
- Coverage 96.55% 96.33% -0.22%
===========================================
Files 159 161 +2
Lines 7252 6934 -318
Branches 2296 2146 -150
===========================================
- Hits 7002 6680 -322
- Misses 228 233 +5
+ Partials 22 21 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
investigationFacilityCycles
to determine the facility cycles an Investigation belongs to
Use investigationFacilityCycle relation for querying ISIS investigations through apiUrl/investigations
This influences the Lucene search PR as that needs the URLs changing The backend generator script needs to ensure it creates these links Maybe deploy this on ISIS dev so ISIS can try it out? |
New change: created a constant called |
Doi redirect now uses the new `investigationFacilityCycles` relation to query the facility cycle the investigation belongs to
packages/datagateway-search/src/table/datasetSearchTable.component.tsx
Outdated
Show resolved
Hide resolved
…#1411' of https://github.com/ral-facilities/datagateway into enhancement/use-investigation-facility-cycles-relation-#1411
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we also need to refactor the facility cycles endpoint - as currently we're querying the special dg-api endpoint that does the date calculation logic (and it's causing errors - e.g. on ISIS dev cycle 20_1 appears under ALF but has no investigations when you click on it - my way below correctly doesn't return cycle 20_1). Instead, we should query the facilitycycles
endpoint directly using the new investigationFacilityCycles
relation. I believe this query works?
/facilitycycles?where={"investigationFacilityCycles.investigation.investigationInstruments.instrument.id":{"eq":INSTRUMENT_ID}}&distinct=["name", "startDate", "endDate"]
This uses the relation to find facility cycles that have investigations that are on the instrument with id INSTRUMENT_ID
. Distinct is needed as otherwise it returns duplicate cycles for every cycle with a unique investigation with the matching instrument id (and in fact the original ISIS query under the hood uses DISTINCT as well in dg-api) - the three distinct fields are used as those are the values we rely on in the UI (theoretically we lose the description in card view but I think this is always just ISIS Cycle
in practice so not very helpful anyway).
Do feel free to play about and see if you can find a different way to query, this is just the first way I found that gives the correct results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore me - I just realised they're investigations with no data - which is exactly the case we've already raised that have no cycles: https://github.com/ral-facilities/isis-icat-ingestion/issues/76#issuecomment-1266751672 I'm happy for this to go in then once we can get the e2e tests working once that work is done, so we can put this in blocked for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - just would appreciate @kennethnym looking at the last few commits of mine to check they're fine :)
Looks good, thanks for fixing the tests :) |
Description
This PR changes the way facility cycles are calculated for a given investigation. Instead of using start dates and end dates of an investigation to determine what facility cycle it falls into, the
investigationFacilityCycles
field of the Investigation entity provided by the backend can be used . It is an array of facility cycles that the investigations belong to. For building URLs to investigations, the first investigation facility cycle in the array is always used.I created 3 new functions in
datagateway-common
calledbuild<Investigation/Dataset/Datafile>Url
that each constructs a URL to the given investigation/dataset/datafile. They either return the URL as a string, ornull
if the URL cannot be created due to missing info (for example, the investigation object provided does not have theinvestigationFacilityCycles
field)Edit 2/2/2023
I also created a constant called
FACILITY_NAME
indatagateway-common
app.types.tsx
that defines all the known facility names, i.e.isis
anddls
, to reduce the excessive use of magic strings in the code.Testing instructions
Agile board tracking
Closes #1411