SciCatProject / SciCatProject/backend

Support for filters on nested `scientificMetadata` with `/api/v3/datasets/fullquery`?

Open
#1,888 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
27
Forks
37
Avg merge
17h 32m
Merged PRs (30d)
38

Description

For us having nested metadata is quite important, e.g. a simple (fake) example:

"scientificMetadata": {"attr6": {"attr7": {"value": "exampleValue"}}}

However, it seems that it's not possible to filter datasets on such metadata using the UI, using dots to represent the hierarchy. I think this is because in mapScientificQuery dots are escaped, I assume so that users can have keys in the metadata which themselves contain dots:

https://github.com/SciCatProject/scicat-backend-next/blob/06597b05b3d46bd4b63827a748b58e416f65b732/src/common/utils.ts#L151

Deleting that line (mostly) solves the problem.

Are there any plans to support filtering on such metadata?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/common/utils.ts at mapScientificQuery around line 151, then trace how /api/v3/datasets/fullquery applies the resulting filters. Review the handling of escaped dots and nested scientificMetadata keys; done means nested metadata filters work without losing support for keys that contain dots.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.