You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorial/customization/custom_schemas.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,18 +6,17 @@ Custom schemas in NOMAD define how data is structured, stored, and displayed, al
6
6
- Define data structures that dictate how information is organized and presented.
7
7
- Enable ELN functionality for manual data input and structured documentation.
8
8
- Extract structured data from files using parsers, which allow NOMAD to read data from raw files.
9
-
- Transform and enrich data post-upload using normalizers, ensuring compatibility with schema requirements and enhancing metadata consistency.
9
+
- Transform and enrich data, post-upload, using [normalizers](../../reference/glossary.md#normalizer), ensuring compatibility with schema requirements and enhancing metadata consistency.
10
10
11
11
12
12
There are two primary approaches to creating custom schemas:
13
13
14
-
-**Python schemas**: These offer highest possible level of customization by allowing the integration of **custom parsers** and **normalizers**, enabling maximum automation.
15
-
-**Serialized schemas (YAML/JSON)**: Human-readable and easier to write and manage, ideal for defining customized ELNs without coding skills. However, they do not support normalizers.
14
+
-**Python schemas**: These offer highest possible level of customization by allowing the integration of [parsers](../../reference/glossary.md#parser) and [normalizers](../../reference/glossary.md#normalizer), enabling maximum automation.
15
+
-**Serialized schemas (YAML/JSON)**: Human-readable and easier to write and manage, ideal for defining customized ELNs without coding skills. They can be used on both the central NOMAD and any Oasis instance without requiring configuration changes, making them especially convenient for quick customization.
16
+
16
17
17
18
This part of the tutorial covers the following topics:
18
19
19
20
-[YAML schemas](custom_yaml.md): Defining structured YAML schemas for NOMAD.
20
21
-[Custom ELN with YAML](custom_eln.md): Creating an ELN schema to enable structured metadata entry.
21
-
-[Tabular parser in YAML](custom_tabular.md): Utilizing the built-in tabular parser to process spreadsheet data.
22
-
-[Python schemas](custom_python.md): Exploring Python schemas and their advanced capabilities.
23
-
-[Normalizers](custom_normalizer.md): Implementing normalizers to automate data processing.
22
+
-[Tabular parser in YAML](custom_tabular.md): Utilizing the built-in tabular parser to process spreadsheet data.
Copy file name to clipboardExpand all lines: docs/tutorial/customization/custom_yaml.md
+58-56Lines changed: 58 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,15 @@
3
3
4
4
## Guidelines for building a custom schema
5
5
6
-
NOMAD YAML schema files must have the `.archive.yaml` extension for NOMAD to recognize them as schema files. Below are six main guidelines for creating a custom YAML schema file.
6
+
To define custom YAML schemas in NOMAD, you need to create a YAML file with the `.archive.yaml` extension. These files represent a [schema package](../../reference/glossary.md#schema-package), which can include one or more section and quantity definitions.. Below are six main guidelines for creating a custom YAML schema file.
7
7
8
8
??? info "1. NOMAD's `archive.yaml` files start with the `definitions:` keyword, and must have a `name:`, and can have a `description:`."
9
9
10
10
NOMAD syntax:
11
11
```yaml
12
12
definitions:
13
-
name:
14
-
description:
13
+
name: ...
14
+
description: ...
15
15
```
16
16
17
17
Example:
@@ -28,13 +28,13 @@ NOMAD YAML schema files must have the `.archive.yaml` extension for NOMAD to rec
28
28
29
29
```yaml
30
30
definitions:
31
-
name:
32
-
description:
31
+
name: ...
32
+
description: ...
33
33
34
34
sections:
35
-
My_first_section:
36
-
My_second_section:
37
-
My_third_section:
35
+
MyFirstSection: ...
36
+
MySecondSection: ...
37
+
MyThirdSection: ...
38
38
```
39
39
40
40
@@ -49,28 +49,28 @@ NOMAD YAML schema files must have the `.archive.yaml` extension for NOMAD to rec
49
49
description: This is a custom schema that includes several sections.
50
50
51
51
sections:
52
-
My_first_section:
52
+
MyFirstSection:
53
53
base_sections:
54
54
- nomad.datamodel.data.EntryData
55
-
- nomad.datamodel.metainfo.eln.Sample
55
+
- nomad.datamodel.metainfo.eln.ELNSample
56
56
57
-
My_second_section:
58
-
My_third_section:
57
+
MySecondSection: ...
58
+
MyThirdSection: ...
59
59
```
60
60
61
61
or alternatively in the form of a Python list:
62
62
63
63
```yaml
64
64
definitions:
65
-
name: My NOMAD ELN
65
+
name: My NOMAD Custom Schema
66
66
description: This is a custom schema that includes several sections.
??? info "4. Each section can contain quantities, other sections, and subsections."
@@ -80,23 +80,24 @@ NOMAD YAML schema files must have the `.archive.yaml` extension for NOMAD to rec
80
80
81
81
```yaml
82
82
definitions:
83
-
name: My NOMAD ELN
83
+
name: My NOMAD Custom Schema
84
84
description: This is a custom schema that includes several sections.
85
85
86
86
sections:
87
-
My_first_section:
87
+
MyFirstSection:
88
88
base_sections:
89
89
- nomad.datamodel.data.EntryData
90
-
- nomad.datamodel.metainfo.eln.Sample
91
-
quantities:
92
-
90
+
- nomad.datamodel.metainfo.eln.ELNSample
91
+
quantities:
92
+
first_quantity:
93
+
type: str # Uses python type notation like: int, np.float64, etc.
93
94
sub_sections:
94
-
My_first_subsection:
95
-
section:
96
-
My_second_subsection:
97
-
section:
98
-
My_second_section:
99
-
My_third_section:
95
+
my_first_subsection:
96
+
section: ...
97
+
my_second_subsection:
98
+
section: ...
99
+
MySecondSection: ...
100
+
MyThirdSection: ...
100
101
```
101
102
102
103
@@ -105,44 +106,45 @@ NOMAD YAML schema files must have the `.archive.yaml` extension for NOMAD to rec
105
106
106
107
```yaml
107
108
definitions:
108
-
name: My NOMAD ELN
109
+
name: My NOMAD Custom Schema
109
110
description: This is a custom schema that includes several sections.
110
111
111
112
sections:
112
-
My_first_section:
113
+
MyFirstSection:
113
114
base_sections:
114
115
- nomad.datamodel.data.EntryData
115
-
- nomad.datamodel.metainfo.eln.Sample
116
+
- nomad.datamodel.metainfo.eln.ELNSample
116
117
quantities:
117
118
first_quantity:
118
-
- type: #For example, str or np.float64
119
-
- shape: #For example scalar or list (['*'])
120
-
- unit: #For example, meters, amperes, or seconds
119
+
type: #For example, str or np.float64
120
+
shape: #For example scalar or list (['*'])
121
+
unit: #For example, meters, amperes, or seconds
121
122
sub_sections:
122
-
My_first_subsection:
123
-
section:
124
-
My_second_subsection:
125
-
section:
126
-
My_third_subsection:
127
-
section:
128
-
129
-
My_second_section:
130
-
My_third_section:
123
+
my_first_subsection:
124
+
section: ...
125
+
my_second_subsection:
126
+
section: ...
127
+
my_third_subsection:
128
+
section: ...
129
+
130
+
MySecondSection: ...
131
+
MyThirdSection: ...
131
132
```
132
133
133
134
??? info "6. Sections and quantities can have annotations"
134
135
Annotations provide additional information that NOMAD can use to alter its behavior around these definitions and how users can interact with them. The keyword for annotations is `m_annotations:`.
135
136
Among the various functionalities that annotations provide, they enable the transformation of schema sections, subsections, and quantities into ELN components that users can edit directly within the GUI.
137
+
136
138
```yaml
137
139
definitions:
138
-
name: My NOMAD ELN
140
+
name: My NOMAD Custom Schema
139
141
description: This is an electronic lab notebook schema that includes several sections.
140
142
141
143
sections:
142
-
My_first_section:
144
+
MyFirst_Section:
143
145
base_sections:
144
146
- nomad.datamodel.data.EntryData
145
-
- nomad.datamodel.metainfo.eln.Sample
147
+
- nomad.datamodel.metainfo.eln.ELNSample
146
148
quantities:
147
149
first_quantity:
148
150
- type: #For example, str or np.float64
@@ -151,14 +153,14 @@ NOMAD YAML schema files must have the `.archive.yaml` extension for NOMAD to rec
0 commit comments