Skip to content

feat(scicat-metadata): multiple schemas support#180

Draft
MatthMig wants to merge 3 commits intoSciCatProject:mainfrom
MatthMig:multiple_schemas
Draft

feat(scicat-metadata): multiple schemas support#180
MatthMig wants to merge 3 commits intoSciCatProject:mainfrom
MatthMig:multiple_schemas

Conversation

@MatthMig
Copy link
Copy Markdown

@MatthMig MatthMig commented Jun 17, 2025

Re-implementation of PR: #178 following SciCat community suggestions

Motivation

Following issue: #173

It is a first step for the objective to ingest files of a complex structure in a facility.
This has full backwards compatibility.

Description

Adds the possibility to import a schema in another schema, opening the possibility to factorize our configs.

Here is the file structure:

resources/
├── modules/
│   └── ill.imsc.json.example       # Reusable ILL common metadata
├── d17.imsc.json.example         # D17-specific schema importing ILL module
└── panther.imsc.json                  # Could import ILL module + add panther-specific fields

In case of conflict, the importer has the priority over the imported.

Usage example

Module Schema (modules/ill.imsc.json):

{
  "id": "ill-module-001",
  "name": "ILL Common Metadata Module",
  "variables": {
    "pid": {"source": "NXS", "path": "/entry0/user/proposal", "value_type": "string"},
    "owner": {"source": "NXS", "path": "/entry0/user/name", "value_type": "string"}
  },
  "schema": {
    "pid": {"field_type": "high_level", "machine_name": "pid", "value": "<pid>", "type": "string"}
  }
}

Importing Schema (d17.imsc.json):

{
  "id": "d17-schema",
  "name": "D17 Instrument Example Schema",
  "import": ["ill-module-001"],
  "instrument": "D17",
  "order": 1,
  "selector": "filename:starts_with:/data/d17",
  "variables": {
    "detector": {"source": "NXS", "path": "/entry0/instrument/det", "value_type": "string"}
  },
  "schema": {
    "instrument_properties": {"field_type": "scientific_metadata", "value": {"det": "<detector>"}}
  }
}

The resulting schema will have variables and schema from both the module and the importer.

@nitrosx nitrosx marked this pull request as draft November 28, 2025 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant