Skip to content

Commit

Permalink
Merge 95b809d into 8a56cb8
Browse files Browse the repository at this point in the history
  • Loading branch information
ItIsJordan committed Aug 9, 2023
2 parents 8a56cb8 + 95b809d commit 9720dff
Show file tree
Hide file tree
Showing 19 changed files with 369 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ target/

# Downloaded schemas
hepdata_validator/schemas_remote/

# venv
venv/
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ download them. However, in principle, for testing purposes, note that the same m

.. code:: python
schema_path = 'https://hepdata.net/submission/schemas/1.1.0/'
schema_path = 'https://hepdata.net/submission/schemas/1.1.1/'
schema_name = 'data_schema.json'
and passing a HEPData YAML data file as the ``file_path`` argument of the ``validate`` method.
2 changes: 1 addition & 1 deletion hepdata_validator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

__all__ = ('__version__', )

VALID_SCHEMA_VERSIONS = ['1.1.0', '1.0.1', '1.0.0', '0.1.0']
VALID_SCHEMA_VERSIONS = ['1.1.1', '1.1.0', '1.0.1', '1.0.0', '0.1.0']
LATEST_SCHEMA_VERSION = VALID_SCHEMA_VERSIONS[0]

RAW_SCHEMAS_URL = 'https://raw.githubusercontent.com/HEPData/hepdata-validator/' \
Expand Down
62 changes: 62 additions & 0 deletions hepdata_validator/schemas/1.1.1/additional_info_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://hepdata.net/submission/schemas/1.1.1/additional_info_schema.json",
"title": "Additional information",
"description": "Optional information concerning a whole submission rather than individual data tables",
"type": "object",
"properties": {
"record_ids": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": [ "string" ] },
"id": { "type": [ "string", "number" ] }
},
"required": [ "type", "id" ],
"additionalProperties": false
}
},
"related_to_hepdata_recids" : {
"type" : "array",
"items" : {"type" : "integer", "minimum": 1}
},
"preprintyear": {
"type": "string",
"title": "Preprint Year",
"description": "Indicates the year when the submission preprint was first available.",
"name": "preprintyear"
},
"publicationyear": {
"type": "string",
"title": "Publication Year",
"description": "Indicates the year when the submission publication was available.",
"name": "publicationyear"
},
"dateupdated": {
"type": "string",
"title": "Date Updated",
"description": "Indicates when the submission was last updated.",
"name": "dateupdated"
},
"modifications": {
"type": "array",
"items": {
"type": "object",
"properties": {
"action": { "type": "string" },
"who": { "type": "string" }
},
"required": [ "action", "who" ]
}
},
"additional_resources": {
"$ref": "additional_resources_schema.json"
},
"comment": {
"type": "string",
"description": "Information that applies to all data tables."
}
},
"additionalProperties": true
}
26 changes: 26 additions & 0 deletions hepdata_validator/schemas/1.1.1/additional_resources_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://hepdata.net/submission/schemas/1.1.1/additional_resources_schema.json",
"title": "Additional resources",
"type": "array",
"items": {
"type": "object",
"properties": {
"location": { "type": "string", "maxLength": 256 },
"description": { "type": "string" },
"type": { "type": "string", "maxLength": 64 },
"license": {
"type": "object",
"properties": {
"name": { "type": "string", "maxLength": 256 },
"url": { "type": "string", "maxLength": 256 },
"description": { "type": "string" }
},
"required": [ "name", "url" ],
"additionalProperties": false
}
},
"required": [ "location", "description" ],
"additionalProperties": false
}
}
121 changes: 121 additions & 0 deletions hepdata_validator/schemas/1.1.1/data_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://hepdata.net/submission/schemas/1.1.1/data_schema.json",
"title": "Data table",
"description": "A HEPData table comprising independent_variables and dependent_variables",
"type": "object",
"properties": {
"independent_variables": {
"type": "array",
"items": {
"type": "object",
"properties": {
"header": {
"type": "object",
"properties": {
"name": { "type": "string" },
"units": { "type": "string" }
},
"required": [ "name" ],
"additionalProperties": false
},
"values": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"value": { "type": [ "string", "number" ] }
},
"required": ["value"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"value": { "type": "number" },
"low": { "type": "number" },
"high": { "type": "number" }
},
"required": ["low", "high"],
"additionalProperties": false
}
]
}
}
},
"required": [ "header", "values" ],
"additionalProperties": false
}
},
"dependent_variables": {
"type": "array",
"items": {
"type": "object",
"properties": {
"header": {
"type": "object",
"properties": {
"name": { "type": "string" },
"units": { "type": "string" }
},
"required": [ "name" ],
"additionalProperties": false
},
"qualifiers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"value": { "type": [ "string", "number" ] },
"units": { "type": "string" }
},
"required": [ "name", "value" ],
"additionalProperties": false
}
},
"values": {
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": [ "string", "number" ]
},
"errors": {
"type": "array",
"items": {
"type": "object",
"properties": {
"symerror": { "type": [ "number", "string" ] },
"asymerror": {
"type": "object",
"properties": {
"minus": { "type": [ "number", "string" ] },
"plus": { "type": [ "number", "string" ] }
},
"required": [ "minus", "plus" ],
"additionalProperties": false
},
"label": { "type": "string" }
},
"oneOf": [{"required": [ "symerror" ]}, {"required": [ "asymerror" ]}],
"additionalProperties": false
}
}
},
"required": [ "value" ],
"additionalProperties": false
}
}
},
"required": [ "header", "values" ],
"additionalProperties": false
}
}
},
"required": [ "independent_variables", "dependent_variables" ],
"additionalProperties": false
}
55 changes: 55 additions & 0 deletions hepdata_validator/schemas/1.1.1/submission_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://hepdata.net/submission/schemas/1.1.1/submission_schema.json",
"title": "Submission table",
"description": "Metadata for a HEPData table apart from independent_variables and dependent_variables",
"type": "object",
"properties": {
"name": { "type": "string", "maxLength": 64 },
"related_to_table_dois" : {
"type" : "array",
"items" : {"type" : "string", "maxLength" : 128, "pattern" : "^10\\.17182\/hepdata\\.\\d+\\.v\\d+\/t\\d+$" }
},
"location": { "type": "string", "maxLength": 256 },
"description": { "type": "string"},
"keywords": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string", "maxLength": 128, "enum": ["cmenergies", "observables", "reactions", "phrases"] },
"values": {
"type": "array",
"items": { "type": [ "string", "number" ], "maxLength": 128 }
}
},
"required": [ "name", "values" ],
"additionalProperties": false
}
},
"data_file": { "type": "string" },
"data_schema": {
"type": "string",
"description": "Remote location of the JSON schema for the data_file"
},
"data_license": {
"type": "object",
"properties": {
"name": { "type": "string", "maxLength": 256 },
"url": { "type": "string", "maxLength": 256 },
"description": { "type": "string" }
},
"required": [ "name", "url" ],
"additionalProperties": false
},
"additional_resources": {
"$ref": "additional_resources_schema.json"
},
"table_doi": {
"type": "string",
"description": "Present if a user downloads YAML from an existing HEPData record"
}
},
"required": ["name", "description", "keywords", "data_file"],
"additionalProperties": false
}
2 changes: 1 addition & 1 deletion hepdata_validator/schemas/additional_info_schema.json
2 changes: 1 addition & 1 deletion hepdata_validator/schemas/additional_resources_schema.json
2 changes: 1 addition & 1 deletion hepdata_validator/schemas/data_schema.json
2 changes: 1 addition & 1 deletion hepdata_validator/schemas/submission_schema.json
5 changes: 5 additions & 0 deletions testsuite/test_data/TestHEPSubmission/submission.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ comment: | # preserve newlines
- No events with a jet for which ptJet > 25 GeV and |etaJet| < 4.5
- No events with a third lepton for which ptLepton > 10 GeV
- min(DeltaR(l,l)) > 0.3
related_to_hepdata_recids:
- 1

---
# Start a new YAML document to indicate a new data table.
# This is Table 1.
name: "Table 1"
related_to_table_dois:
- "10.17182/hepdata.1.v1/t1"
location: Data from Page 17 of preprint
description: The measured fiducial cross sections. The first systematic uncertainty is the combined systematic uncertainty excluding luminosity, the second is the luminosity
keywords: # used for searching, possibly multiple values for each keyword
Expand Down
7 changes: 7 additions & 0 deletions testsuite/test_data/TestRelatedSubmissions/data1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
independent_variables: []
dependent_variables:
- header: {name: TestData1, units: NA}
qualifiers:
- {name: TestData1, value: 0}
values:
- value: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
comment: "Test Text"
---
name: "Table 1"
description: Words
keywords:
- {name: reactions, values: []}
data_file: data1.yaml
related_to_table_dois:
- 1
- "aaa"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
comment: "Test Text"
related_to_hepdata_recids: ["a", a, 0]
---
name: "Table 1"
description: Words
keywords:
- {name: reactions, values: []}
data_file: data1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
description: "Test Data"
comment: Test
related_to_hepdata_recids:
- 1
---
name: "Table 1"
description: Words
keywords:
- {name: cmenergies, values: [0]}
data_file: data1.yaml
related_to_table_dois:
- "10.17182/hepdata.1.v1/t1"
2 changes: 1 addition & 1 deletion testsuite/test_data_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def validator_v0():

@pytest.fixture(scope="module")
def validator_v1():
return DataFileValidator(schema_version='1.1.0')
return DataFileValidator()


####################################################
Expand Down

0 comments on commit 9720dff

Please sign in to comment.