Skip to content

Commit dcd80d3

Browse files
authored
Merge pull request #52 from HEPData/submission-linking
Changes for related data update.
2 parents 4bd9005 + 326d392 commit dcd80d3

20 files changed

+384
-12
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,6 @@ target/
6060

6161
# Downloaded schemas
6262
hepdata_validator/schemas_remote/
63+
64+
# venv
65+
venv/

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ download them. However, in principle, for testing purposes, note that the same m
323323

324324
.. code:: python
325325
326-
schema_path = 'https://hepdata.net/submission/schemas/1.1.0/'
326+
schema_path = 'https://hepdata.net/submission/schemas/1.1.1/'
327327
schema_name = 'data_schema.json'
328328
329329
and passing a HEPData YAML data file as the ``file_path`` argument of the ``validate`` method.

hepdata_validator/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
__all__ = ('__version__', )
5050

51-
VALID_SCHEMA_VERSIONS = ['1.1.0', '1.0.1', '1.0.0', '0.1.0']
51+
VALID_SCHEMA_VERSIONS = ['1.1.1', '1.1.0', '1.0.1', '1.0.0', '0.1.0']
5252
LATEST_SCHEMA_VERSION = VALID_SCHEMA_VERSIONS[0]
5353

5454
RAW_SCHEMAS_URL = 'https://raw.githubusercontent.com/HEPData/hepdata-validator/' \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://hepdata.net/submission/schemas/1.1.1/additional_info_schema.json",
4+
"title": "Additional information",
5+
"description": "Optional information concerning a whole submission rather than individual data tables",
6+
"type": "object",
7+
"properties": {
8+
"record_ids": {
9+
"type": "array",
10+
"items": {
11+
"type": "object",
12+
"properties": {
13+
"type": { "type": [ "string" ] },
14+
"id": { "type": [ "string", "number" ] }
15+
},
16+
"required": [ "type", "id" ],
17+
"additionalProperties": false
18+
}
19+
},
20+
"preprintyear": {
21+
"type": "string",
22+
"title": "Preprint Year",
23+
"description": "Indicates the year when the submission preprint was first available.",
24+
"name": "preprintyear"
25+
},
26+
"publicationyear": {
27+
"type": "string",
28+
"title": "Publication Year",
29+
"description": "Indicates the year when the submission publication was available.",
30+
"name": "publicationyear"
31+
},
32+
"dateupdated": {
33+
"type": "string",
34+
"title": "Date Updated",
35+
"description": "Indicates when the submission was last updated.",
36+
"name": "dateupdated"
37+
},
38+
"modifications": {
39+
"type": "array",
40+
"items": {
41+
"type": "object",
42+
"properties": {
43+
"action": { "type": "string" },
44+
"who": { "type": "string" }
45+
},
46+
"required": [ "action", "who" ]
47+
}
48+
},
49+
"additional_resources": {
50+
"$ref": "additional_resources_schema.json"
51+
},
52+
"comment": {
53+
"type": "string",
54+
"description": "Information that applies to all data tables."
55+
},
56+
"related_to_hepdata_records" : {
57+
"type" : "array",
58+
"uniqueItems": true,
59+
"items" : {"type" : "integer", "minimum": 1}
60+
}
61+
},
62+
"additionalProperties": true
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://hepdata.net/submission/schemas/1.1.1/additional_resources_schema.json",
4+
"title": "Additional resources",
5+
"type": "array",
6+
"items": {
7+
"type": "object",
8+
"properties": {
9+
"location": { "type": "string", "maxLength": 256 },
10+
"description": { "type": "string" },
11+
"type": { "type": "string", "maxLength": 64 },
12+
"license": {
13+
"type": "object",
14+
"properties": {
15+
"name": { "type": "string", "maxLength": 256 },
16+
"url": { "type": "string", "maxLength": 256 },
17+
"description": { "type": "string" }
18+
},
19+
"required": [ "name", "url" ],
20+
"additionalProperties": false
21+
}
22+
},
23+
"required": [ "location", "description" ],
24+
"additionalProperties": false
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://hepdata.net/submission/schemas/1.1.1/data_schema.json",
4+
"title": "Data table",
5+
"description": "A HEPData table comprising independent_variables and dependent_variables",
6+
"type": "object",
7+
"properties": {
8+
"independent_variables": {
9+
"type": "array",
10+
"items": {
11+
"type": "object",
12+
"properties": {
13+
"header": {
14+
"type": "object",
15+
"properties": {
16+
"name": { "type": "string" },
17+
"units": { "type": "string" }
18+
},
19+
"required": [ "name" ],
20+
"additionalProperties": false
21+
},
22+
"values": {
23+
"type": "array",
24+
"items": {
25+
"oneOf": [
26+
{
27+
"type": "object",
28+
"properties": {
29+
"value": { "type": [ "string", "number" ] }
30+
},
31+
"required": ["value"],
32+
"additionalProperties": false
33+
},
34+
{
35+
"type": "object",
36+
"properties": {
37+
"value": { "type": "number" },
38+
"low": { "type": "number" },
39+
"high": { "type": "number" }
40+
},
41+
"required": ["low", "high"],
42+
"additionalProperties": false
43+
}
44+
]
45+
}
46+
}
47+
},
48+
"required": [ "header", "values" ],
49+
"additionalProperties": false
50+
}
51+
},
52+
"dependent_variables": {
53+
"type": "array",
54+
"items": {
55+
"type": "object",
56+
"properties": {
57+
"header": {
58+
"type": "object",
59+
"properties": {
60+
"name": { "type": "string" },
61+
"units": { "type": "string" }
62+
},
63+
"required": [ "name" ],
64+
"additionalProperties": false
65+
},
66+
"qualifiers": {
67+
"type": "array",
68+
"items": {
69+
"type": "object",
70+
"properties": {
71+
"name": { "type": "string" },
72+
"value": { "type": [ "string", "number" ] },
73+
"units": { "type": "string" }
74+
},
75+
"required": [ "name", "value" ],
76+
"additionalProperties": false
77+
}
78+
},
79+
"values": {
80+
"type": "array",
81+
"items": {
82+
"type": "object",
83+
"properties": {
84+
"value": {
85+
"type": [ "string", "number" ]
86+
},
87+
"errors": {
88+
"type": "array",
89+
"items": {
90+
"type": "object",
91+
"properties": {
92+
"symerror": { "type": [ "number", "string" ] },
93+
"asymerror": {
94+
"type": "object",
95+
"properties": {
96+
"minus": { "type": [ "number", "string" ] },
97+
"plus": { "type": [ "number", "string" ] }
98+
},
99+
"required": [ "minus", "plus" ],
100+
"additionalProperties": false
101+
},
102+
"label": { "type": "string" }
103+
},
104+
"oneOf": [{"required": [ "symerror" ]}, {"required": [ "asymerror" ]}],
105+
"additionalProperties": false
106+
}
107+
}
108+
},
109+
"required": [ "value" ],
110+
"additionalProperties": false
111+
}
112+
}
113+
},
114+
"required": [ "header", "values" ],
115+
"additionalProperties": false
116+
}
117+
}
118+
},
119+
"required": [ "independent_variables", "dependent_variables" ],
120+
"additionalProperties": false
121+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://hepdata.net/submission/schemas/1.1.1/submission_schema.json",
4+
"title": "Submission table",
5+
"description": "Metadata for a HEPData table apart from independent_variables and dependent_variables",
6+
"type": "object",
7+
"properties": {
8+
"name": { "type": "string", "maxLength": 64 },
9+
"location": { "type": "string", "maxLength": 256 },
10+
"description": { "type": "string"},
11+
"keywords": {
12+
"type": "array",
13+
"items": {
14+
"type": "object",
15+
"properties": {
16+
"name": { "type": "string", "maxLength": 128, "enum": ["cmenergies", "observables", "reactions", "phrases"] },
17+
"values": {
18+
"type": "array",
19+
"items": { "type": [ "string", "number" ], "maxLength": 128 }
20+
}
21+
},
22+
"required": [ "name", "values" ],
23+
"additionalProperties": false
24+
}
25+
},
26+
"data_file": { "type": "string" },
27+
"data_schema": {
28+
"type": "string",
29+
"description": "Remote location of the JSON schema for the data_file"
30+
},
31+
"data_license": {
32+
"type": "object",
33+
"properties": {
34+
"name": { "type": "string", "maxLength": 256 },
35+
"url": { "type": "string", "maxLength": 256 },
36+
"description": { "type": "string" }
37+
},
38+
"required": [ "name", "url" ],
39+
"additionalProperties": false
40+
},
41+
"additional_resources": {
42+
"$ref": "additional_resources_schema.json"
43+
},
44+
"table_doi": {
45+
"type": "string",
46+
"description": "Present if a user downloads YAML from an existing HEPData record"
47+
},
48+
"related_to_table_dois" : {
49+
"type" : "array",
50+
"uniqueItems": true,
51+
"items" : {"type" : "string", "maxLength" : 128, "pattern" : "^10\\.17182\/hepdata\\.\\d+\\.v\\d+\/t\\d+$" }
52+
}
53+
},
54+
"required": ["name", "description", "keywords", "data_file"],
55+
"additionalProperties": false
56+
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0/additional_info_schema.json
1+
1.1.1/additional_info_schema.json
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0/additional_resources_schema.json
1+
1.1.1/additional_resources_schema.json
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0/data_schema.json
1+
1.1.1/data_schema.json
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0/submission_schema.json
1+
1.1.1/submission_schema.json

hepdata_validator/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@
2727

2828
from __future__ import absolute_import, print_function
2929

30-
__version__ = "0.3.3"
30+
__version__ = "0.3.4"

testsuite/test_data/TestHEPSubmission/submission.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ comment: | # preserve newlines
2525
- No events with a jet for which ptJet > 25 GeV and |etaJet| < 4.5
2626
- No events with a third lepton for which ptLepton > 10 GeV
2727
- min(DeltaR(l,l)) > 0.3
28+
29+
related_to_hepdata_records:
30+
- 1
2831

2932
---
3033
# Start a new YAML document to indicate a new data table.
3134
# This is Table 1.
3235
name: "Table 1"
36+
related_to_table_dois:
37+
- "10.17182/hepdata.1.v1/t1"
3338
location: Data from Page 17 of preprint
3439
description: The measured fiducial cross sections. The first systematic uncertainty is the combined systematic uncertainty excluding luminosity, the second is the luminosity
3540
keywords: # used for searching, possibly multiple values for each keyword
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
independent_variables: []
2+
dependent_variables:
3+
- header: {name: TestData1, units: NA}
4+
qualifiers:
5+
- {name: TestData1, value: 0}
6+
values:
7+
- value: 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
comment: "Test Text"
3+
---
4+
name: "Table 1"
5+
description: Words
6+
keywords:
7+
- {name: reactions, values: []}
8+
data_file: data1.yaml
9+
related_to_table_dois:
10+
- 1
11+
- "10.17182/hepdata.1"
12+
- "10.17182/hepdata.1.v1"
13+
- "10.17182/hepdata.1.v1/"
14+
- "10.17182/hepdata.1.v1/a2"
15+
- "10.17182/hepdata.1.v1/t1"
16+
- "10.17182/hepdata.1.v1/t1"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
comment: "Test Text"
3+
related_to_hepdata_records: ["a", b, 0, 1, 1]
4+
---
5+
name: "Table 1"
6+
description: Words
7+
keywords:
8+
- {name: reactions, values: []}
9+
data_file: data1.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description: "Test Data"
2+
comment: Test
3+
related_to_hepdata_records:
4+
- 1
5+
---
6+
name: "Table 1"
7+
description: Words
8+
keywords:
9+
- {name: cmenergies, values: [0]}
10+
data_file: data1.yaml
11+
related_to_table_dois:
12+
- "10.17182/hepdata.1.v1/t1"

testsuite/test_data_validator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def validator_v0():
2323

2424
@pytest.fixture(scope="module")
2525
def validator_v1():
26-
return DataFileValidator(schema_version='1.1.0')
26+
return DataFileValidator()
2727

2828

2929
####################################################

0 commit comments

Comments
 (0)