Improve investigation selection
Closes #11 (closed)
Get an investigation ID for a proposal, beamline and date by getting all investigations from ICAT for a beamline and proposal (requires icat-plus#508 (closed) to be fixed and deployed) and select a single one based on clear rules defined on the client side (not the backend side). Investigation ID selection is still done by the backend when sending dataset messages to the ingester (see here) and I guess also start investigation messages.
FYI: getting an investigation ID on the client side is needed for checking which datasets have been registered already (done in Bliss and icat-sync-raw).
Manual test to see whether icat-plus#508 (closed) is deployed (Edit: OK):
from pyicat_plus.client.bliss import get_icat_client
client = get_icat_client(timeout=100)
url = client.investigation_client._investigation_url.format(
beamline="id23-1", proposal="oa14"
)
investigations = client.investigation_client._get_with_response_parsing(url)
assert len(investigations) == 14, len(investigations)
url = client.investigation_client._investigation_url.format(
beamline="id27", proposal="ihhc3952"
)
investigations = client.investigation_client._get_with_response_parsing(url)
assert len(investigations) == 3, len(investigations)
url = client.investigation_client._investigation_url.format(
beamline="id27", proposal="es1019"
)
investigations = client.investigation_client._get_with_response_parsing(url)
assert len(investigations) == 5, len(investigations)
URLs:
- https://icatplus.esrf.fr/dataacquisition/elogbook-be70ac55-fd08-4840-9b29-b73262958ca8/investigation?instrumentName=id23-1&investigationName=oa14
- https://icatplus.esrf.fr/dataacquisition/elogbook-be70ac55-fd08-4840-9b29-b73262958ca8/investigation?instrumentName=id27&investigationName=ihhc3952
- https://icatplus.esrf.fr/dataacquisition/elogbook-be70ac55-fd08-4840-9b29-b73262958ca8/investigation?instrumentName=id27&investigationName=es1019
Edited by Wout De Nolf