@mat3ra/esse 2024.4.8-5 → 2024.4.8-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -12,7 +12,6 @@ The latest variants of schemas and examples are available at [schemas.mat3ra.com
|
|
|
12
12
|
|
|
13
13
|
ESSE has a dual-nature as both a Python and a Node.js package.
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
## 1. Installation
|
|
17
16
|
|
|
18
17
|
### 1.1. Python
|
|
@@ -41,7 +40,6 @@ pip install -e PATH_TO_ESSE_REPOSITORY
|
|
|
41
40
|
npm install @mat3ra/esse
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
|
|
45
43
|
## 2. Usage
|
|
46
44
|
|
|
47
45
|
ESSE contains separate but equivalent interfaces for Python and Javascript.
|
|
@@ -65,7 +63,6 @@ const helper = new ESSE();
|
|
|
65
63
|
const schema = helper.getSchemaById("material");
|
|
66
64
|
```
|
|
67
65
|
|
|
68
|
-
|
|
69
66
|
## 3. Directory Structure
|
|
70
67
|
|
|
71
68
|
ESSE contains 3 main directories, [schema](schema), [example](example) and [src](src) outlined below.
|
|
@@ -88,12 +85,11 @@ This directory contains the examples formed according to the schemas and impleme
|
|
|
88
85
|
|
|
89
86
|
This directory contains Python and Javascript interfaces implementing the functionality to access and validate schemas and examples.
|
|
90
87
|
|
|
91
|
-
|
|
92
88
|
## 4. Conventions
|
|
93
89
|
|
|
94
90
|
### 4.1. Generative vs Non-generative keys
|
|
95
|
-
Generative keys are the fields which allow for user input prior to calculation of the final property values. A flag is included in the schema comments on the fields in [property schemas](schema/properties_directory): `isGenerative:true` marks which fields to use as subschemas in the generation of a user input schema. On properties allowing user inputs, additional fields may be tagged, as in [the `file_content` property](schema/properties_directory/non-scalar/file_content.json)
|
|
96
91
|
|
|
92
|
+
Generative keys are the fields which allow for user input prior to calculation of the final property values. A flag is included in the schema comments on the fields in [property schemas](schema/properties_directory): `isGenerative:true` marks which fields to use as subschemas in the generation of a user input schema. On properties allowing user inputs, additional fields may be tagged, as in [the `file_content` property](schema/properties_directory/non-scalar/file_content.json)
|
|
97
93
|
|
|
98
94
|
## 5. Development
|
|
99
95
|
|
|
@@ -118,13 +114,19 @@ NOTE: The PY and JS modules are built from the same JSON sources, but using diff
|
|
|
118
114
|
When developing in python the following should be taken into account:
|
|
119
115
|
|
|
120
116
|
1. The modules containing the schemas and examples are generated using the [build-schemas.py](./build_schemas.py) script. There is a setup for it to be run automatically on every commit, but it is recommended to run it manually before committing to make sure that the changes are reflected in the modules. This can be done with `pre-commit run --all-files`. The pre-commit package can be installed with `pip install pre-commit`. To rebuild schemas manually, run (note `-e` in install):
|
|
117
|
+
|
|
121
118
|
```bash
|
|
122
119
|
virtualenv .venv
|
|
123
120
|
source .venv/bin/activate
|
|
124
121
|
pip install -e ."[tests]"
|
|
122
|
+
pip install pre-commit
|
|
123
|
+
pre-commit --install
|
|
124
|
+
git config --unset-all core.hooksPath
|
|
125
125
|
python build_schemas.py
|
|
126
126
|
```
|
|
127
|
+
|
|
127
128
|
2. Tests can be run using the following commands:
|
|
129
|
+
|
|
128
130
|
```bash
|
|
129
131
|
virtualenv .venv
|
|
130
132
|
source .venv/bin/activate
|
|
@@ -135,6 +137,7 @@ When developing in python the following should be taken into account:
|
|
|
135
137
|
### 5.2. Development in Javascript/Typescript
|
|
136
138
|
|
|
137
139
|
See [package.json](package.json) for the list of available npm commands. The JS modules are generated using the [build_schema.js](./build_schema.js) script. There is a setup for it to be run automatically when the package is installed (see "transpile" directive). To rebuild schemas manually, run:
|
|
140
|
+
|
|
138
141
|
```bash
|
|
139
142
|
npm install
|
|
140
143
|
npm run transpile
|
|
@@ -149,7 +152,6 @@ Other suggestions:
|
|
|
149
152
|
- Use unique IDs for schemas
|
|
150
153
|
- Do not use circular references in the schemas, instead leave the type as object and add explanation to description.
|
|
151
154
|
|
|
152
|
-
|
|
153
155
|
## Links
|
|
154
156
|
|
|
155
157
|
[^1]: [Data-centric online ecosystem for digital materials science](https://arxiv.org/pdf/1902.10838.pdf)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$id": "3pse/db/nist-jarvis/2024.3.13/db-entry",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"title": "NIST JARVIS
|
|
4
|
+
"title": "NIST JARVIS db entry schema",
|
|
5
5
|
"description": "NIST J.A.R.V.I.S. db entry `atoms` key schema. Based on https://figshare.com/articles/dataset/Monolayer_data_for_heterostructure/22344571",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": true,
|