SciCatProject / SciCatProject/backend
Scientific Metadata with / without '.value' (or ' .v')
@nitrosx is already working on this.
Since Oct 18, 2022.
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 37
- Avg merge
- 17h 32m
- Merged PRs (30d)
- 38
Description
Scientific Metadata with / without '.value
Summary
when working on https://github.com/SciCatProject/scicat-backend-next/pull/119 we saw that for the new SciCat backend there is currently no support for metadata outside the '.value', '.unit' scheme. In https://github.com/SciCatProject/scicat-backend-next/issues/119#issuecomment-1201236240_ there is an example of scientific metadata from PSI that falls in this category:

Originally posted by @stephan271 in https://github.com/SciCatProject/scicat-backend-next/issues/119#issuecomment-1201236240
Expected Behaviour
like in the old backend the frontend search should work also on any string and integer values in the metadata without having a 'unit' / 'value'. Further in the example above 'v' and 'u' instead of 'value' and 'unit'.
I have the feeling it would make sense to provide a sort of generic helper to deal with the different options of having .value, .value+.unit or none of them. Currently '.value' is hardcoded in the new backend code e.g.
src/common/utils.ts:20: return { valueSI: Number(quantity.value), unitSI: quantity.unit };
src/common/utils.ts:92: const matchKeyMeasurement = `scientificMetadata.${lhs}.valueSI`;
src/common/utils.ts:97: scientificFilterQuery[`${matchKeyGeneric}.value`] = { $eq: rhs };
src/common/utils.ts:102: scientificFilterQuery[`${matchKeyGeneric}.value`] = { $eq: escapedRhs };
src/common/utils.ts:111: scientificFilterQuery[`${matchKeyGeneric}.value`] = { $eq: rhs };
src/common/utils.ts:121: scientificFilterQuery[`${matchKeyGeneric}.value`] = { $gt: rhs };
src/common/utils.ts:131: scientificFilterQuery[`${matchKeyGeneric}.value`] = { $lt: rhs };
src/datasets/interceptors/fullquery.interceptor.ts:34: `${lhs}.value`,
src/datasets/interceptors/fullquery.interceptor.ts:46: `${lhs}.value`,
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.