Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for related data update. #52

Merged
merged 24 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
edce119
Add files for v1.1.1
ItIsJordan May 31, 2023
3ee0f05
Add related table doi variable to submission schema
ItIsJordan May 31, 2023
d3d63d4
Add related recid variable to submission schema
ItIsJordan May 31, 2023
13e712c
Update version number in schema json (1.1.0 -> 1.1.1)
ItIsJordan May 31, 2023
d582209
Add updated schema to valid versions
ItIsJordan May 31, 2023
2e7aca2
Update readme version number
ItIsJordan May 31, 2023
bb0d1e8
Bump schema version number in code
ItIsJordan May 31, 2023
a87e5dc
Update schema version number in tests
ItIsJordan Jun 1, 2023
cd8a881
Update related record data type
ItIsJordan Jun 22, 2023
95885b5
Revert package version check change
ItIsJordan Jun 26, 2023
2abdfa8
Fix schema inconsistency/issue
ItIsJordan Jun 28, 2023
0062c06
Add regular expression for related DOI check
ItIsJordan Jul 6, 2023
2f73905
Update TestHEPSubmission
ItIsJordan Jul 6, 2023
6247c64
Add validator test
ItIsJordan Jul 6, 2023
6e0619c
Remove hardcoded schema_version glad
ItIsJordan Jul 6, 2023
85458d6
Merge branch 'main' into submission-linking
ItIsJordan Jul 6, 2023
314afbc
Add venv/ to .gitignore
ItIsJordan Aug 3, 2023
26c25b0
Update schema recid constraints.
ItIsJordan Aug 9, 2023
95b809d
Update testing
ItIsJordan Aug 9, 2023
10c2c54
Improve test cases
ItIsJordan Aug 9, 2023
5e1afa0
Remove whitespace in test yaml files
ItIsJordan Aug 9, 2023
e8064a2
Add uniqueness check in doi/recid entry
ItIsJordan Aug 11, 2023
f1beb68
Merge branch 'main' into submission-linking
GraemeWatt Aug 16, 2023
326d392
Rename 'related_to_hepdata_recids' field
GraemeWatt Aug 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
63 changes: 63 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,63 @@
{
"$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
}
},
"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."
},
"related_to_hepdata_records" : {
"type" : "array",
"uniqueItems": true,
"items" : {"type" : "integer", "minimum": 1}
}
},
"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
}
56 changes: 56 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,56 @@
{
"$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 },
"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"
},
"related_to_table_dois" : {
"type" : "array",
"uniqueItems": true,
"items" : {"type" : "string", "maxLength" : 128, "pattern" : "^10\\.17182\/hepdata\\.\\d+\\.v\\d+\/t\\d+$" }
}
},
"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
2 changes: 1 addition & 1 deletion hepdata_validator/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@

from __future__ import absolute_import, print_function

__version__ = "0.3.3"
__version__ = "0.3.4"
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_records:
- 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,16 @@
---
comment: "Test Text"
---
name: "Table 1"
description: Words
keywords:
- {name: reactions, values: []}
data_file: data1.yaml
related_to_table_dois:
- 1
- "10.17182/hepdata.1"
- "10.17182/hepdata.1.v1"
- "10.17182/hepdata.1.v1/"
- "10.17182/hepdata.1.v1/a2"
- "10.17182/hepdata.1.v1/t1"
- "10.17182/hepdata.1.v1/t1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
comment: "Test Text"
related_to_hepdata_records: ["a", b, 0, 1, 1]
---
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_records:
- 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