From edce119fe85bf44a18726ca06698b6c809ba4c16 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 31 May 2023 10:50:13 +0100 Subject: [PATCH 01/22] Add files for v1.1.1 Adds files for schema version v1.1.1 with symlinks. --- .../schemas/1.1.1/additional_info_schema.json | 58 +++++++++ .../1.1.1/additional_resources_schema.json | 26 ++++ .../schemas/1.1.1/data_schema.json | 121 ++++++++++++++++++ .../schemas/1.1.1/submission_schema.json | 51 ++++++++ .../schemas/additional_info_schema.json | 2 +- .../schemas/additional_resources_schema.json | 2 +- hepdata_validator/schemas/data_schema.json | 2 +- .../schemas/submission_schema.json | 2 +- 8 files changed, 260 insertions(+), 4 deletions(-) create mode 100644 hepdata_validator/schemas/1.1.1/additional_info_schema.json create mode 100644 hepdata_validator/schemas/1.1.1/additional_resources_schema.json create mode 100644 hepdata_validator/schemas/1.1.1/data_schema.json create mode 100644 hepdata_validator/schemas/1.1.1/submission_schema.json diff --git a/hepdata_validator/schemas/1.1.1/additional_info_schema.json b/hepdata_validator/schemas/1.1.1/additional_info_schema.json new file mode 100644 index 0000000..1b798d7 --- /dev/null +++ b/hepdata_validator/schemas/1.1.1/additional_info_schema.json @@ -0,0 +1,58 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://hepdata.net/submission/schemas/1.1.0/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." + } + }, + "additionalProperties": true +} diff --git a/hepdata_validator/schemas/1.1.1/additional_resources_schema.json b/hepdata_validator/schemas/1.1.1/additional_resources_schema.json new file mode 100644 index 0000000..98b1758 --- /dev/null +++ b/hepdata_validator/schemas/1.1.1/additional_resources_schema.json @@ -0,0 +1,26 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://hepdata.net/submission/schemas/1.1.0/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 + } +} diff --git a/hepdata_validator/schemas/1.1.1/data_schema.json b/hepdata_validator/schemas/1.1.1/data_schema.json new file mode 100644 index 0000000..6ddbef1 --- /dev/null +++ b/hepdata_validator/schemas/1.1.1/data_schema.json @@ -0,0 +1,121 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://hepdata.net/submission/schemas/1.1.0/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 +} diff --git a/hepdata_validator/schemas/1.1.1/submission_schema.json b/hepdata_validator/schemas/1.1.1/submission_schema.json new file mode 100644 index 0000000..d8e4260 --- /dev/null +++ b/hepdata_validator/schemas/1.1.1/submission_schema.json @@ -0,0 +1,51 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://hepdata.net/submission/schemas/1.1.0/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" + } + }, + "required": ["name", "description", "keywords", "data_file"], + "additionalProperties": false +} diff --git a/hepdata_validator/schemas/additional_info_schema.json b/hepdata_validator/schemas/additional_info_schema.json index 88a536c..c4802ee 120000 --- a/hepdata_validator/schemas/additional_info_schema.json +++ b/hepdata_validator/schemas/additional_info_schema.json @@ -1 +1 @@ -1.1.0/additional_info_schema.json \ No newline at end of file +1.1.1/additional_info_schema.json \ No newline at end of file diff --git a/hepdata_validator/schemas/additional_resources_schema.json b/hepdata_validator/schemas/additional_resources_schema.json index 47f79fa..77df465 120000 --- a/hepdata_validator/schemas/additional_resources_schema.json +++ b/hepdata_validator/schemas/additional_resources_schema.json @@ -1 +1 @@ -1.1.0/additional_resources_schema.json \ No newline at end of file +1.1.1/additional_resources_schema.json \ No newline at end of file diff --git a/hepdata_validator/schemas/data_schema.json b/hepdata_validator/schemas/data_schema.json index 2d560f5..8fb1d00 120000 --- a/hepdata_validator/schemas/data_schema.json +++ b/hepdata_validator/schemas/data_schema.json @@ -1 +1 @@ -1.1.0/data_schema.json \ No newline at end of file +1.1.1/data_schema.json \ No newline at end of file diff --git a/hepdata_validator/schemas/submission_schema.json b/hepdata_validator/schemas/submission_schema.json index fd51831..f75bcbe 120000 --- a/hepdata_validator/schemas/submission_schema.json +++ b/hepdata_validator/schemas/submission_schema.json @@ -1 +1 @@ -1.1.0/submission_schema.json \ No newline at end of file +1.1.1/submission_schema.json \ No newline at end of file From 3ee0f05d2d776156024215e7e129146bb8a6e31b Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 31 May 2023 10:52:15 +0100 Subject: [PATCH 02/22] Add related table doi variable to submission schema Adds the related_to_table_dois var to submission_schema.json. --- hepdata_validator/schemas/1.1.1/submission_schema.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hepdata_validator/schemas/1.1.1/submission_schema.json b/hepdata_validator/schemas/1.1.1/submission_schema.json index d8e4260..b8c28b8 100644 --- a/hepdata_validator/schemas/1.1.1/submission_schema.json +++ b/hepdata_validator/schemas/1.1.1/submission_schema.json @@ -6,8 +6,12 @@ "type": "object", "properties": { "name": { "type": "string", "maxLength": 64 }, + "related_to_table_dois" : { + "type" : "array", + "items" : {"type" : "string", "maxLength" : 64 } + }, "location": { "type": "string", "maxLength": 256 }, - "description": { "type": "string" }, + "description": { "type": "string"}, "keywords": { "type": "array", "items": { From d3d63d47e40179956a89141b9de301a559e488a9 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 31 May 2023 10:53:14 +0100 Subject: [PATCH 03/22] Add related recid variable to submission schema Adds the related recids var to submission_schema.json to accommodate for related recids.. --- hepdata_validator/schemas/1.1.1/additional_info_schema.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hepdata_validator/schemas/1.1.1/additional_info_schema.json b/hepdata_validator/schemas/1.1.1/additional_info_schema.json index 1b798d7..e484d80 100644 --- a/hepdata_validator/schemas/1.1.1/additional_info_schema.json +++ b/hepdata_validator/schemas/1.1.1/additional_info_schema.json @@ -17,6 +17,10 @@ "additionalProperties": false } }, + "related_to_hepdata_recids" : { + "type" : "array", + "items" : {"type" : "string", "maxLength" : 64 } + }, "preprintyear": { "type": "string", "title": "Preprint Year", From 13e712cef9f721d43bf8b976e42fc489c0e84ee1 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 31 May 2023 11:15:29 +0100 Subject: [PATCH 04/22] Update version number in schema json (1.1.0 -> 1.1.1) Updates the schema version number to 1.1.1 in the json files (forgot). --- hepdata_validator/schemas/1.1.1/additional_info_schema.json | 2 +- .../schemas/1.1.1/additional_resources_schema.json | 2 +- hepdata_validator/schemas/1.1.1/data_schema.json | 2 +- hepdata_validator/schemas/1.1.1/submission_schema.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hepdata_validator/schemas/1.1.1/additional_info_schema.json b/hepdata_validator/schemas/1.1.1/additional_info_schema.json index e484d80..65d484f 100644 --- a/hepdata_validator/schemas/1.1.1/additional_info_schema.json +++ b/hepdata_validator/schemas/1.1.1/additional_info_schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://hepdata.net/submission/schemas/1.1.0/additional_info_schema.json", + "$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", diff --git a/hepdata_validator/schemas/1.1.1/additional_resources_schema.json b/hepdata_validator/schemas/1.1.1/additional_resources_schema.json index 98b1758..3492ac2 100644 --- a/hepdata_validator/schemas/1.1.1/additional_resources_schema.json +++ b/hepdata_validator/schemas/1.1.1/additional_resources_schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://hepdata.net/submission/schemas/1.1.0/additional_resources_schema.json", + "$id": "https://hepdata.net/submission/schemas/1.1.1/additional_resources_schema.json", "title": "Additional resources", "type": "array", "items": { diff --git a/hepdata_validator/schemas/1.1.1/data_schema.json b/hepdata_validator/schemas/1.1.1/data_schema.json index 6ddbef1..a171940 100644 --- a/hepdata_validator/schemas/1.1.1/data_schema.json +++ b/hepdata_validator/schemas/1.1.1/data_schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://hepdata.net/submission/schemas/1.1.0/data_schema.json", + "$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", diff --git a/hepdata_validator/schemas/1.1.1/submission_schema.json b/hepdata_validator/schemas/1.1.1/submission_schema.json index b8c28b8..b834f73 100644 --- a/hepdata_validator/schemas/1.1.1/submission_schema.json +++ b/hepdata_validator/schemas/1.1.1/submission_schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://hepdata.net/submission/schemas/1.1.0/submission_schema.json", + "$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", From d58220951196258404c9a79fb2be4e8e5a1d670a Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 31 May 2023 11:16:31 +0100 Subject: [PATCH 05/22] Add updated schema to valid versions Adds the updated schema version (1.1.1) to the list of valid versions. --- hepdata_validator/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hepdata_validator/__init__.py b/hepdata_validator/__init__.py index b8f1475..3f69638 100644 --- a/hepdata_validator/__init__.py +++ b/hepdata_validator/__init__.py @@ -49,7 +49,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/' \ From 2e7aca219d81ce85008adc19a4190d7c99590994 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 31 May 2023 11:16:52 +0100 Subject: [PATCH 06/22] Update readme version number Updates schema version number referenced in the README document. --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index d78a4bf..c2a8b5f 100644 --- a/README.rst +++ b/README.rst @@ -322,7 +322,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. From bb0d1e842aa6c69acaef90ba3914733028693b08 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 31 May 2023 11:19:48 +0100 Subject: [PATCH 07/22] Bump schema version number in code Upgrades the schema version used within code --- hepdata_validator/data_file_validator.py | 2 +- hepdata_validator/full_submission_validator.py | 2 +- hepdata_validator/submission_file_validator.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hepdata_validator/data_file_validator.py b/hepdata_validator/data_file_validator.py index 1311267..cd9e4d8 100644 --- a/hepdata_validator/data_file_validator.py +++ b/hepdata_validator/data_file_validator.py @@ -137,7 +137,7 @@ def validate(self, **kwargs): try: self.check_error_values(file_path, data) self.check_length_values(file_path, data) - if self.schema_version >= packaging_version.parse("1.1.0"): + if self.schema_version >= packaging_version.parse("1.1.1"): self.check_independent_variable_values(file_path, data) except Exception: # If the file did not validate against the schema, we diff --git a/hepdata_validator/full_submission_validator.py b/hepdata_validator/full_submission_validator.py index a796b14..17bb59f 100644 --- a/hepdata_validator/full_submission_validator.py +++ b/hepdata_validator/full_submission_validator.py @@ -198,7 +198,7 @@ def validate(self, directory=None, file=None, archive=None): self.valid_files[type] = [self._remove_temp_directory(self.submission_file_path)] # Check all files in directory are in included_files - if not self.single_yaml_file and self.schema_version >= packaging_version.parse("1.1.0"): + if not self.single_yaml_file and self.schema_version >= packaging_version.parse("1.1.1"): # helper to check if a provided file is not meant to describe HEP data, but rather # represents "extended attributes" (e.g.) as a result of BSD tar (default on MacOS) # which creates these extra files when archiving files with extended attributes on diff --git a/hepdata_validator/submission_file_validator.py b/hepdata_validator/submission_file_validator.py index 220fb4c..51d1b62 100644 --- a/hepdata_validator/submission_file_validator.py +++ b/hepdata_validator/submission_file_validator.py @@ -24,7 +24,7 @@ def __init__(self, *args, **kwargs): super(SubmissionFileValidator, self).__init__(*args, **kwargs) self.default_schema_file = self._get_schema_filepath(self.submission_filename) self.additional_info_schema = self._get_schema_filepath(self.additional_info_filename) - if self.schema_version >= packaging_version.parse("1.1.0"): + if self.schema_version >= packaging_version.parse("1.1.1"): self.additional_resources_schema = self._get_schema_filepath(self.additional_resources_filename) def validate(self, **kwargs): @@ -49,7 +49,7 @@ def validate(self, **kwargs): additional_file_section_schema = json.load(additional_schema) resolver = None - if self.schema_version >= packaging_version.parse("1.1.0"): + if self.schema_version >= packaging_version.parse("1.1.1"): with open(self.additional_resources_schema, 'r') as additional_schema: additional_resources_schema = json.load(additional_schema) @@ -97,7 +97,7 @@ def validate(self, **kwargs): except ValidationError as ve: self.add_validation_error(file_path, ve) - if not has_submission_doc and self.schema_version >= packaging_version.parse("1.1.0"): + if not has_submission_doc and self.schema_version >= packaging_version.parse("1.1.1"): # It's possible that all data items match the additional_file_section_schema # just by having properties that don't match any items in there. So we need # to make sure that we have at least one valid submission doc. @@ -109,7 +109,7 @@ def validate(self, **kwargs): ) - if self.schema_version >= packaging_version.parse("1.1.0"): + if self.schema_version >= packaging_version.parse("1.1.1"): self.check_for_duplicates(file_path, table_names, table_data_files) if not self.has_errors(file_path): From a87e5dcf9959fbd98f331596a36ec676e17b731e Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:03:01 +0100 Subject: [PATCH 08/22] Update schema version number in tests Updates the schema version number used in the tests from 1.1.0 to 1.1.1 --- testsuite/test_data_validator.py | 2 +- testsuite/test_full_submission_validator.py | 6 +++--- testsuite/test_submission_validator.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testsuite/test_data_validator.py b/testsuite/test_data_validator.py index aa56121..d2dc472 100644 --- a/testsuite/test_data_validator.py +++ b/testsuite/test_data_validator.py @@ -23,7 +23,7 @@ def validator_v0(): @pytest.fixture(scope="module") def validator_v1(): - return DataFileValidator(schema_version='1.1.0') + return DataFileValidator(schema_version='1.1.1') #################################################### diff --git a/testsuite/test_full_submission_validator.py b/testsuite/test_full_submission_validator.py index e2ab10f..e001570 100644 --- a/testsuite/test_full_submission_validator.py +++ b/testsuite/test_full_submission_validator.py @@ -18,7 +18,7 @@ def validator_v0(): @pytest.fixture() def validator_v1(): - return FullSubmissionValidator(schema_version='1.1.0') + return FullSubmissionValidator(schema_version='1.1.1') def test_valid_submission_dir(validator_v1, data_path, capsys): @@ -87,7 +87,7 @@ def test_valid_submission_dir_remote_schema(validator_v1, data_path, capsys): def test_valid_submission_dir_remote_schema_no_autoloading(data_path): - validator = FullSubmissionValidator(schema_version='1.1.0', autoload_remote_schemas=False) + validator = FullSubmissionValidator(schema_version='1.1.1', autoload_remote_schemas=False) submission_dir = os.path.join(data_path, 'TestRemoteSubmission') # Validate without pre-loading schemas - should get an error @@ -106,7 +106,7 @@ def test_valid_submission_dir_remote_schema_no_autoloading(data_path): def test_valid_submission_dir_remote_schema_multiple_loads(): - validator = FullSubmissionValidator(schema_version='1.1.0', autoload_remote_schemas=False) + validator = FullSubmissionValidator(schema_version='1.1.1', autoload_remote_schemas=False) # Load schema once - should be fine validator.load_remote_schema(base_url="https://scikit-hep.org/pyhf/schemas/1.0.0", schema_name="workspace.json") diff --git a/testsuite/test_submission_validator.py b/testsuite/test_submission_validator.py index b73b970..867b5af 100644 --- a/testsuite/test_submission_validator.py +++ b/testsuite/test_submission_validator.py @@ -23,7 +23,7 @@ def validator_v0(): @pytest.fixture(scope="module") def validator_v1(): - return SubmissionFileValidator(schema_version='1.1.0') + return SubmissionFileValidator(schema_version='1.1.1') #################################################### From cd8a8812ef71cc8e3dec2f3083e68ab2d1d7a595 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:51:37 +0100 Subject: [PATCH 09/22] Update related record data type Updates the data type for related record id storage from string to integer. This is to disallow entry of anything other than HEPData record IDs. --- hepdata_validator/schemas/1.1.1/additional_info_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hepdata_validator/schemas/1.1.1/additional_info_schema.json b/hepdata_validator/schemas/1.1.1/additional_info_schema.json index 65d484f..063b638 100644 --- a/hepdata_validator/schemas/1.1.1/additional_info_schema.json +++ b/hepdata_validator/schemas/1.1.1/additional_info_schema.json @@ -19,7 +19,7 @@ }, "related_to_hepdata_recids" : { "type" : "array", - "items" : {"type" : "string", "maxLength" : 64 } + "items" : {"type" : "integer", "maxLength" : 64 } }, "preprintyear": { "type": "string", From 95885b5165782d8d5252d8886c1d9748736e7f06 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Mon, 26 Jun 2023 10:46:08 +0100 Subject: [PATCH 10/22] Revert package version check change Reverts a change upping the minimum version checked before running a number of validator functions. Was updated to match most recent version number, checks are actually needed above 1.1.0. --- hepdata_validator/data_file_validator.py | 2 +- hepdata_validator/full_submission_validator.py | 2 +- hepdata_validator/submission_file_validator.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hepdata_validator/data_file_validator.py b/hepdata_validator/data_file_validator.py index cd9e4d8..1311267 100644 --- a/hepdata_validator/data_file_validator.py +++ b/hepdata_validator/data_file_validator.py @@ -137,7 +137,7 @@ def validate(self, **kwargs): try: self.check_error_values(file_path, data) self.check_length_values(file_path, data) - if self.schema_version >= packaging_version.parse("1.1.1"): + if self.schema_version >= packaging_version.parse("1.1.0"): self.check_independent_variable_values(file_path, data) except Exception: # If the file did not validate against the schema, we diff --git a/hepdata_validator/full_submission_validator.py b/hepdata_validator/full_submission_validator.py index 17bb59f..a796b14 100644 --- a/hepdata_validator/full_submission_validator.py +++ b/hepdata_validator/full_submission_validator.py @@ -198,7 +198,7 @@ def validate(self, directory=None, file=None, archive=None): self.valid_files[type] = [self._remove_temp_directory(self.submission_file_path)] # Check all files in directory are in included_files - if not self.single_yaml_file and self.schema_version >= packaging_version.parse("1.1.1"): + if not self.single_yaml_file and self.schema_version >= packaging_version.parse("1.1.0"): # helper to check if a provided file is not meant to describe HEP data, but rather # represents "extended attributes" (e.g.) as a result of BSD tar (default on MacOS) # which creates these extra files when archiving files with extended attributes on diff --git a/hepdata_validator/submission_file_validator.py b/hepdata_validator/submission_file_validator.py index 51d1b62..220fb4c 100644 --- a/hepdata_validator/submission_file_validator.py +++ b/hepdata_validator/submission_file_validator.py @@ -24,7 +24,7 @@ def __init__(self, *args, **kwargs): super(SubmissionFileValidator, self).__init__(*args, **kwargs) self.default_schema_file = self._get_schema_filepath(self.submission_filename) self.additional_info_schema = self._get_schema_filepath(self.additional_info_filename) - if self.schema_version >= packaging_version.parse("1.1.1"): + if self.schema_version >= packaging_version.parse("1.1.0"): self.additional_resources_schema = self._get_schema_filepath(self.additional_resources_filename) def validate(self, **kwargs): @@ -49,7 +49,7 @@ def validate(self, **kwargs): additional_file_section_schema = json.load(additional_schema) resolver = None - if self.schema_version >= packaging_version.parse("1.1.1"): + if self.schema_version >= packaging_version.parse("1.1.0"): with open(self.additional_resources_schema, 'r') as additional_schema: additional_resources_schema = json.load(additional_schema) @@ -97,7 +97,7 @@ def validate(self, **kwargs): except ValidationError as ve: self.add_validation_error(file_path, ve) - if not has_submission_doc and self.schema_version >= packaging_version.parse("1.1.1"): + if not has_submission_doc and self.schema_version >= packaging_version.parse("1.1.0"): # It's possible that all data items match the additional_file_section_schema # just by having properties that don't match any items in there. So we need # to make sure that we have at least one valid submission doc. @@ -109,7 +109,7 @@ def validate(self, **kwargs): ) - if self.schema_version >= packaging_version.parse("1.1.1"): + if self.schema_version >= packaging_version.parse("1.1.0"): self.check_for_duplicates(file_path, table_names, table_data_files) if not self.has_errors(file_path): From 2abdfa8b749c2c966fe7f9aaf7e29e1d45d46fd8 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 28 Jun 2023 09:31:05 +0100 Subject: [PATCH 11/22] Fix schema inconsistency/issue Fixed accidental inconsistencies between this data schema and the HEPData schema. Recids now has no maxLength value. Updated table DOI to match the correct maxLength value of 128 (was 64). --- hepdata_validator/schemas/1.1.1/additional_info_schema.json | 2 +- hepdata_validator/schemas/1.1.1/submission_schema.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hepdata_validator/schemas/1.1.1/additional_info_schema.json b/hepdata_validator/schemas/1.1.1/additional_info_schema.json index 063b638..3d2fdb9 100644 --- a/hepdata_validator/schemas/1.1.1/additional_info_schema.json +++ b/hepdata_validator/schemas/1.1.1/additional_info_schema.json @@ -19,7 +19,7 @@ }, "related_to_hepdata_recids" : { "type" : "array", - "items" : {"type" : "integer", "maxLength" : 64 } + "items" : {"type" : "integer"} }, "preprintyear": { "type": "string", diff --git a/hepdata_validator/schemas/1.1.1/submission_schema.json b/hepdata_validator/schemas/1.1.1/submission_schema.json index b834f73..17f6463 100644 --- a/hepdata_validator/schemas/1.1.1/submission_schema.json +++ b/hepdata_validator/schemas/1.1.1/submission_schema.json @@ -8,7 +8,7 @@ "name": { "type": "string", "maxLength": 64 }, "related_to_table_dois" : { "type" : "array", - "items" : {"type" : "string", "maxLength" : 64 } + "items" : {"type" : "string", "maxLength" : 128 } }, "location": { "type": "string", "maxLength": 256 }, "description": { "type": "string"}, From 0062c06e475e47dcbca07de38e31e1066823730d Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Thu, 6 Jul 2023 11:52:38 +0100 Subject: [PATCH 12/22] Add regular expression for related DOI check Now validates related DOI entries against a regular expression. --- hepdata_validator/schemas/1.1.1/submission_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hepdata_validator/schemas/1.1.1/submission_schema.json b/hepdata_validator/schemas/1.1.1/submission_schema.json index 17f6463..027b9c3 100644 --- a/hepdata_validator/schemas/1.1.1/submission_schema.json +++ b/hepdata_validator/schemas/1.1.1/submission_schema.json @@ -8,7 +8,7 @@ "name": { "type": "string", "maxLength": 64 }, "related_to_table_dois" : { "type" : "array", - "items" : {"type" : "string", "maxLength" : 128 } + "items" : {"type" : "string", "maxLength" : 128, "pattern" : "^10\\.17182\/hepdata\\.\\d+\\.v\\d+\/t\\d+$" } }, "location": { "type": "string", "maxLength": 256 }, "description": { "type": "string"}, From 2f7390501667075e974bc8f38d376bb1bd0084f5 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Thu, 6 Jul 2023 11:53:24 +0100 Subject: [PATCH 13/22] Update TestHEPSubmission Updates TestHEPSubmission to include valid related doi/recid entries in submission.yaml --- testsuite/test_data/TestHEPSubmission/submission.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testsuite/test_data/TestHEPSubmission/submission.yaml b/testsuite/test_data/TestHEPSubmission/submission.yaml index dff3578..a059188 100644 --- a/testsuite/test_data/TestHEPSubmission/submission.yaml +++ b/testsuite/test_data/TestHEPSubmission/submission.yaml @@ -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 From 6247c648f25ff83b4c348bb1111c1c7803eaf5cd Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:10:56 +0100 Subject: [PATCH 14/22] Add validator test Adds invalid recid/doi testing and related test YAML files. --- .../test_data/invalid_submission_doi.yaml | 58 ++++++++++++++++++ .../test_data/invalid_submission_recid.yaml | 59 +++++++++++++++++++ testsuite/test_submission_validator.py | 22 +++++++ 3 files changed, 139 insertions(+) create mode 100644 testsuite/test_data/invalid_submission_doi.yaml create mode 100644 testsuite/test_data/invalid_submission_recid.yaml diff --git a/testsuite/test_data/invalid_submission_doi.yaml b/testsuite/test_data/invalid_submission_doi.yaml new file mode 100644 index 0000000..0080bf3 --- /dev/null +++ b/testsuite/test_data/invalid_submission_doi.yaml @@ -0,0 +1,58 @@ +--- +additional_resources: # additional references (e.g. experiment TWiki page for analysis) + - {location: "http://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/PAPERS/STDM-2012-02/", description: "web page with auxiliary material"} + +comment: | # preserve newlines + CERN-LHC. Measurements of the cross section for ZZ production using the 4l and 2l2nu decay channels in proton-proton collisions at a centre-of-mass energy of 7 TeV with 4.6 fb^-1 of data collected in 2011. The final states used are 4 electrons, 4 muons, 2 electrons and 2 muons, 2 electrons and missing transverse momentum, and 2 muons and missing transverse momentum (MET). + + The cross section values reported in the tables should be multiplied by a factor of 1.0141 to take into account the updated value of the integrated luminosity for the ATLAS 2011 data taking period. The uncertainty on the global normalisation ("Lumi") remains at 1.8%. See Eur.Phys.J. C73 (2013) 2518 for more details. + + The 4l channel fiducial region is defined as: + - 4e, 4mu or 2e2mu + - Ambiguities in pairing are resolved by choosing the combination that results in the smaller value of the sum |mll - mZ| for the two pairs, where mll is the mass of the dilepton system. + - ptLepton > 7 GeV (at least one with ptLepton > 20 (25) GeV for muons (electrons)) + - |etaLepton| < 3.16 + - At least one lepton pair is required to have invariant mass between 66 and 116 GeV. If the second pair also satisfies this, the event is ZZ, otherwise if the second pair satisfies mll > 20 GeV it is ZZ*. + - min(DeltaR(l,l)) > 0.2. + + The 2l2nu channel fiducial region is defined as: + - 2e+MET or 2mu+MET + - ptLepton > 20 GeV + - |etaLepton| < 2.5 + - mll must be between 76 and 106 GeV + - -MET*cos(phi_METZ)>75 GeV, where phi_METZ is the angle between the Z and the MET + - |MET - pTZ| / pTZ < 0.4, where pTZ is the transverse momentum of the dilepton system + - 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 +--- +# 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" + - "10.17182/hepdaata.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 + - {name: reactions, values: [P P --> Z0 Z0 X]} + - {name: observables, values: [SIG]} + - {name: cmenergies, values: [7000.0]} # centre-of-mass energy in GeV + - {name: phrases, values: [Inclusive, Integrated Cross Section, Cross Section, Proton-Proton Scattering, Z Production, Z pair Production]} +data_file: data1.yaml +data_license: # (optional) you can specify a license for the data + name: "GPL 2" + url: "url for license" + description: "Tell me about it. This can appear in the main record display" # (optional) +additional_resources: # (optional) + - location: "analysis_script.py" + description: "Analysis script" + - location: "http://github.com/HEPData/hepdata" + description: "Full source code for creating this data" + - location: "root_file.root" + description: "Some file" + license: # (optional) + name: 'GPL 2' + url: "url for license" + description: "Tell me about it. This can appear in the main record display" # (optional) +--- \ No newline at end of file diff --git a/testsuite/test_data/invalid_submission_recid.yaml b/testsuite/test_data/invalid_submission_recid.yaml new file mode 100644 index 0000000..0c65b38 --- /dev/null +++ b/testsuite/test_data/invalid_submission_recid.yaml @@ -0,0 +1,59 @@ +--- +additional_resources: # additional references (e.g. experiment TWiki page for analysis) + - {location: "http://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/PAPERS/STDM-2012-02/", description: "web page with auxiliary material"} + +comment: | # preserve newlines + CERN-LHC. Measurements of the cross section for ZZ production using the 4l and 2l2nu decay channels in proton-proton collisions at a centre-of-mass energy of 7 TeV with 4.6 fb^-1 of data collected in 2011. The final states used are 4 electrons, 4 muons, 2 electrons and 2 muons, 2 electrons and missing transverse momentum, and 2 muons and missing transverse momentum (MET). + + The cross section values reported in the tables should be multiplied by a factor of 1.0141 to take into account the updated value of the integrated luminosity for the ATLAS 2011 data taking period. The uncertainty on the global normalisation ("Lumi") remains at 1.8%. See Eur.Phys.J. C73 (2013) 2518 for more details. + + The 4l channel fiducial region is defined as: + - 4e, 4mu or 2e2mu + - Ambiguities in pairing are resolved by choosing the combination that results in the smaller value of the sum |mll - mZ| for the two pairs, where mll is the mass of the dilepton system. + - ptLepton > 7 GeV (at least one with ptLepton > 20 (25) GeV for muons (electrons)) + - |etaLepton| < 3.16 + - At least one lepton pair is required to have invariant mass between 66 and 116 GeV. If the second pair also satisfies this, the event is ZZ, otherwise if the second pair satisfies mll > 20 GeV it is ZZ*. + - min(DeltaR(l,l)) > 0.2. + + The 2l2nu channel fiducial region is defined as: + - 2e+MET or 2mu+MET + - ptLepton > 20 GeV + - |etaLepton| < 2.5 + - mll must be between 76 and 106 GeV + - -MET*cos(phi_METZ)>75 GeV, where phi_METZ is the angle between the Z and the MET + - |MET - pTZ| / pTZ < 0.4, where pTZ is the transverse momentum of the dilepton system + - 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: + # Insert some random non-integer into the list + - aaaaaa +--- +# Start a new YAML document to indicate a new data table. +# This is Table 1. +name: "Table 1" +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 + - {name: reactions, values: [P P --> Z0 Z0 X]} + - {name: observables, values: [SIG]} + - {name: cmenergies, values: [7000.0]} # centre-of-mass energy in GeV + - {name: phrases, values: [Inclusive, Integrated Cross Section, Cross Section, Proton-Proton Scattering, Z Production, Z pair Production]} +data_file: data1.yaml +data_license: # (optional) you can specify a license for the data + name: "GPL 2" + url: "url for license" + description: "Tell me about it. This can appear in the main record display" # (optional) +additional_resources: # (optional) + - location: "analysis_script.py" + description: "Analysis script" + - location: "http://github.com/HEPData/hepdata" + description: "Full source code for creating this data" + - location: "root_file.root" + description: "Some file" + license: # (optional) + name: 'GPL 2' + url: "url for license" + description: "Tell me about it. This can appear in the main record display" # (optional) +--- \ No newline at end of file diff --git a/testsuite/test_submission_validator.py b/testsuite/test_submission_validator.py index 867b5af..7184492 100644 --- a/testsuite/test_submission_validator.py +++ b/testsuite/test_submission_validator.py @@ -337,3 +337,25 @@ def test_submission_with_no_data_tables(validator_v0, validator_v1, data_path, c is_valid_v0 = validator_v0.validate(file_path=file, data=yaml_obj) assert is_valid_v0 + +def test_related_submission_invalid(validator_v1, data_path, capsys): + """ + Tests all of the invalid related submission files at once + against their expected errors. + """ + yaml_files = [ + {"file" : "invalid_submission_recid.yaml", + "error" : "error - 'aaaaaa' is not of type 'integer'"}, + {"file" : "invalid_submission_doi.yaml", + "error" : "error - '10.17182/hepdaata.1.v1/t1' does not match "}] + + for yf in yaml_files: + file = os.path.join(data_path, yf['file']) + with open(file, 'r') as submission: + yaml_obj = yaml.load_all(submission, Loader=YamlLoader) + is_valid = validator_v1.validate(file_path=file, data=yaml_obj) + validator_v1.print_errors(file) + assert is_valid is False + + out, err = capsys.readouterr() + assert yf['error'] in out.strip() \ No newline at end of file From 6e0619ce130a1254327e11189e1d955bc0995e51 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Thu, 6 Jul 2023 16:31:15 +0100 Subject: [PATCH 15/22] Remove hardcoded schema_version glad Removes a hardcoded flag setting the current schema version in testing as the default is to use the most recent version. --- testsuite/test_data_validator.py | 2 +- testsuite/test_full_submission_validator.py | 6 +++--- testsuite/test_submission_validator.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testsuite/test_data_validator.py b/testsuite/test_data_validator.py index d2dc472..2b8dac7 100644 --- a/testsuite/test_data_validator.py +++ b/testsuite/test_data_validator.py @@ -23,7 +23,7 @@ def validator_v0(): @pytest.fixture(scope="module") def validator_v1(): - return DataFileValidator(schema_version='1.1.1') + return DataFileValidator() #################################################### diff --git a/testsuite/test_full_submission_validator.py b/testsuite/test_full_submission_validator.py index e001570..e26befa 100644 --- a/testsuite/test_full_submission_validator.py +++ b/testsuite/test_full_submission_validator.py @@ -18,7 +18,7 @@ def validator_v0(): @pytest.fixture() def validator_v1(): - return FullSubmissionValidator(schema_version='1.1.1') + return FullSubmissionValidator() def test_valid_submission_dir(validator_v1, data_path, capsys): @@ -87,7 +87,7 @@ def test_valid_submission_dir_remote_schema(validator_v1, data_path, capsys): def test_valid_submission_dir_remote_schema_no_autoloading(data_path): - validator = FullSubmissionValidator(schema_version='1.1.1', autoload_remote_schemas=False) + validator = FullSubmissionValidator(autoload_remote_schemas=False) submission_dir = os.path.join(data_path, 'TestRemoteSubmission') # Validate without pre-loading schemas - should get an error @@ -106,7 +106,7 @@ def test_valid_submission_dir_remote_schema_no_autoloading(data_path): def test_valid_submission_dir_remote_schema_multiple_loads(): - validator = FullSubmissionValidator(schema_version='1.1.1', autoload_remote_schemas=False) + validator = FullSubmissionValidator(autoload_remote_schemas=False) # Load schema once - should be fine validator.load_remote_schema(base_url="https://scikit-hep.org/pyhf/schemas/1.0.0", schema_name="workspace.json") diff --git a/testsuite/test_submission_validator.py b/testsuite/test_submission_validator.py index 7184492..529c812 100644 --- a/testsuite/test_submission_validator.py +++ b/testsuite/test_submission_validator.py @@ -23,7 +23,7 @@ def validator_v0(): @pytest.fixture(scope="module") def validator_v1(): - return SubmissionFileValidator(schema_version='1.1.1') + return SubmissionFileValidator() #################################################### From 314afbcdf880cd51350396dd65ecd7dfebaab9e7 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Thu, 3 Aug 2023 16:24:51 +0100 Subject: [PATCH 16/22] Add venv/ to .gitignore Adds the virtual environment folder in venv/ to the .gitignore file. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index e7767fc..8c0d4c2 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,6 @@ target/ # Downloaded schemas hepdata_validator/schemas_remote/ + +# venv +venv/ From 26c25b094c5cd11e624d40f21cbcb91c9e952b67 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 9 Aug 2023 08:06:25 +0100 Subject: [PATCH 17/22] Update schema recid constraints. Probably unnecessary. Added a minimum value of 1 to disable entry of negative, and 0 as an integer. --- hepdata_validator/schemas/1.1.1/additional_info_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hepdata_validator/schemas/1.1.1/additional_info_schema.json b/hepdata_validator/schemas/1.1.1/additional_info_schema.json index 3d2fdb9..8923f56 100644 --- a/hepdata_validator/schemas/1.1.1/additional_info_schema.json +++ b/hepdata_validator/schemas/1.1.1/additional_info_schema.json @@ -19,7 +19,7 @@ }, "related_to_hepdata_recids" : { "type" : "array", - "items" : {"type" : "integer"} + "items" : {"type" : "integer", "minimum": 1} }, "preprintyear": { "type": "string", From 95b809de98045fd3bb5594f12e1ba1722c0b02d4 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 9 Aug 2023 08:08:09 +0100 Subject: [PATCH 18/22] Update testing Updates validator testing to include new cases for valid submissions, and more invalid cases. --- .../TestRelatedSubmissions/data1.yaml | 7 +++ .../invalid_submission_doi.yaml | 11 ++++ .../invalid_submission_recid.yaml | 9 +++ .../valid_submission_related.yaml | 12 ++++ .../test_data/invalid_submission_doi.yaml | 58 ------------------ .../test_data/invalid_submission_recid.yaml | 59 ------------------- testsuite/test_submission_validator.py | 49 +++++++++++---- 7 files changed, 76 insertions(+), 129 deletions(-) create mode 100644 testsuite/test_data/TestRelatedSubmissions/data1.yaml create mode 100644 testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml create mode 100644 testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml create mode 100644 testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml delete mode 100644 testsuite/test_data/invalid_submission_doi.yaml delete mode 100644 testsuite/test_data/invalid_submission_recid.yaml diff --git a/testsuite/test_data/TestRelatedSubmissions/data1.yaml b/testsuite/test_data/TestRelatedSubmissions/data1.yaml new file mode 100644 index 0000000..e89bdc5 --- /dev/null +++ b/testsuite/test_data/TestRelatedSubmissions/data1.yaml @@ -0,0 +1,7 @@ +independent_variables: [] +dependent_variables: +- header: {name: TestData1, units: NA} + qualifiers: + - {name: TestData1, value: 0} + values: + - value: 0 \ No newline at end of file diff --git a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml new file mode 100644 index 0000000..4221ec7 --- /dev/null +++ b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml @@ -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" \ No newline at end of file diff --git a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml new file mode 100644 index 0000000..3620c5c --- /dev/null +++ b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml @@ -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 diff --git a/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml b/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml new file mode 100644 index 0000000..ad04aee --- /dev/null +++ b/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml @@ -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" \ No newline at end of file diff --git a/testsuite/test_data/invalid_submission_doi.yaml b/testsuite/test_data/invalid_submission_doi.yaml deleted file mode 100644 index 0080bf3..0000000 --- a/testsuite/test_data/invalid_submission_doi.yaml +++ /dev/null @@ -1,58 +0,0 @@ ---- -additional_resources: # additional references (e.g. experiment TWiki page for analysis) - - {location: "http://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/PAPERS/STDM-2012-02/", description: "web page with auxiliary material"} - -comment: | # preserve newlines - CERN-LHC. Measurements of the cross section for ZZ production using the 4l and 2l2nu decay channels in proton-proton collisions at a centre-of-mass energy of 7 TeV with 4.6 fb^-1 of data collected in 2011. The final states used are 4 electrons, 4 muons, 2 electrons and 2 muons, 2 electrons and missing transverse momentum, and 2 muons and missing transverse momentum (MET). - - The cross section values reported in the tables should be multiplied by a factor of 1.0141 to take into account the updated value of the integrated luminosity for the ATLAS 2011 data taking period. The uncertainty on the global normalisation ("Lumi") remains at 1.8%. See Eur.Phys.J. C73 (2013) 2518 for more details. - - The 4l channel fiducial region is defined as: - - 4e, 4mu or 2e2mu - - Ambiguities in pairing are resolved by choosing the combination that results in the smaller value of the sum |mll - mZ| for the two pairs, where mll is the mass of the dilepton system. - - ptLepton > 7 GeV (at least one with ptLepton > 20 (25) GeV for muons (electrons)) - - |etaLepton| < 3.16 - - At least one lepton pair is required to have invariant mass between 66 and 116 GeV. If the second pair also satisfies this, the event is ZZ, otherwise if the second pair satisfies mll > 20 GeV it is ZZ*. - - min(DeltaR(l,l)) > 0.2. - - The 2l2nu channel fiducial region is defined as: - - 2e+MET or 2mu+MET - - ptLepton > 20 GeV - - |etaLepton| < 2.5 - - mll must be between 76 and 106 GeV - - -MET*cos(phi_METZ)>75 GeV, where phi_METZ is the angle between the Z and the MET - - |MET - pTZ| / pTZ < 0.4, where pTZ is the transverse momentum of the dilepton system - - 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 ---- -# 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" - - "10.17182/hepdaata.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 - - {name: reactions, values: [P P --> Z0 Z0 X]} - - {name: observables, values: [SIG]} - - {name: cmenergies, values: [7000.0]} # centre-of-mass energy in GeV - - {name: phrases, values: [Inclusive, Integrated Cross Section, Cross Section, Proton-Proton Scattering, Z Production, Z pair Production]} -data_file: data1.yaml -data_license: # (optional) you can specify a license for the data - name: "GPL 2" - url: "url for license" - description: "Tell me about it. This can appear in the main record display" # (optional) -additional_resources: # (optional) - - location: "analysis_script.py" - description: "Analysis script" - - location: "http://github.com/HEPData/hepdata" - description: "Full source code for creating this data" - - location: "root_file.root" - description: "Some file" - license: # (optional) - name: 'GPL 2' - url: "url for license" - description: "Tell me about it. This can appear in the main record display" # (optional) ---- \ No newline at end of file diff --git a/testsuite/test_data/invalid_submission_recid.yaml b/testsuite/test_data/invalid_submission_recid.yaml deleted file mode 100644 index 0c65b38..0000000 --- a/testsuite/test_data/invalid_submission_recid.yaml +++ /dev/null @@ -1,59 +0,0 @@ ---- -additional_resources: # additional references (e.g. experiment TWiki page for analysis) - - {location: "http://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/PAPERS/STDM-2012-02/", description: "web page with auxiliary material"} - -comment: | # preserve newlines - CERN-LHC. Measurements of the cross section for ZZ production using the 4l and 2l2nu decay channels in proton-proton collisions at a centre-of-mass energy of 7 TeV with 4.6 fb^-1 of data collected in 2011. The final states used are 4 electrons, 4 muons, 2 electrons and 2 muons, 2 electrons and missing transverse momentum, and 2 muons and missing transverse momentum (MET). - - The cross section values reported in the tables should be multiplied by a factor of 1.0141 to take into account the updated value of the integrated luminosity for the ATLAS 2011 data taking period. The uncertainty on the global normalisation ("Lumi") remains at 1.8%. See Eur.Phys.J. C73 (2013) 2518 for more details. - - The 4l channel fiducial region is defined as: - - 4e, 4mu or 2e2mu - - Ambiguities in pairing are resolved by choosing the combination that results in the smaller value of the sum |mll - mZ| for the two pairs, where mll is the mass of the dilepton system. - - ptLepton > 7 GeV (at least one with ptLepton > 20 (25) GeV for muons (electrons)) - - |etaLepton| < 3.16 - - At least one lepton pair is required to have invariant mass between 66 and 116 GeV. If the second pair also satisfies this, the event is ZZ, otherwise if the second pair satisfies mll > 20 GeV it is ZZ*. - - min(DeltaR(l,l)) > 0.2. - - The 2l2nu channel fiducial region is defined as: - - 2e+MET or 2mu+MET - - ptLepton > 20 GeV - - |etaLepton| < 2.5 - - mll must be between 76 and 106 GeV - - -MET*cos(phi_METZ)>75 GeV, where phi_METZ is the angle between the Z and the MET - - |MET - pTZ| / pTZ < 0.4, where pTZ is the transverse momentum of the dilepton system - - 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: - # Insert some random non-integer into the list - - aaaaaa ---- -# Start a new YAML document to indicate a new data table. -# This is Table 1. -name: "Table 1" -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 - - {name: reactions, values: [P P --> Z0 Z0 X]} - - {name: observables, values: [SIG]} - - {name: cmenergies, values: [7000.0]} # centre-of-mass energy in GeV - - {name: phrases, values: [Inclusive, Integrated Cross Section, Cross Section, Proton-Proton Scattering, Z Production, Z pair Production]} -data_file: data1.yaml -data_license: # (optional) you can specify a license for the data - name: "GPL 2" - url: "url for license" - description: "Tell me about it. This can appear in the main record display" # (optional) -additional_resources: # (optional) - - location: "analysis_script.py" - description: "Analysis script" - - location: "http://github.com/HEPData/hepdata" - description: "Full source code for creating this data" - - location: "root_file.root" - description: "Some file" - license: # (optional) - name: 'GPL 2' - url: "url for license" - description: "Tell me about it. This can appear in the main record display" # (optional) ---- \ No newline at end of file diff --git a/testsuite/test_submission_validator.py b/testsuite/test_submission_validator.py index 529c812..4569427 100644 --- a/testsuite/test_submission_validator.py +++ b/testsuite/test_submission_validator.py @@ -338,24 +338,49 @@ def test_submission_with_no_data_tables(validator_v0, validator_v1, data_path, c is_valid_v0 = validator_v0.validate(file_path=file, data=yaml_obj) assert is_valid_v0 -def test_related_submission_invalid(validator_v1, data_path, capsys): +def test_related_submissions(validator_v1, data_path, capsys): """ - Tests all of the invalid related submission files at once + Tests all of the related submission files at once against their expected errors. """ + test_folder = "/TestRelatedSubmissions/" yaml_files = [ - {"file" : "invalid_submission_recid.yaml", - "error" : "error - 'aaaaaa' is not of type 'integer'"}, - {"file" : "invalid_submission_doi.yaml", - "error" : "error - '10.17182/hepdaata.1.v1/t1' does not match "}] - - for yf in yaml_files: - file = os.path.join(data_path, yf['file']) + { + "file" : "valid_submission_related.yaml", + "errors" : None + }, + { + "file" : "invalid_submission_recid.yaml", + "errors" : [ + "'a' is not of type 'integer'", + "'a' is not of type 'integer'", + "0 is less than the minimum of 1" + ]}, + { + "file": "invalid_submission_doi.yaml", + "errors" : [ + "1 is not of type 'string'", + "'aaa' does not match" + ]}] + + for yfile in yaml_files: + file_path = "".join((data_path, test_folder, yfile['file'])) + file = os.path.join(file_path) with open(file, 'r') as submission: yaml_obj = yaml.load_all(submission, Loader=YamlLoader) is_valid = validator_v1.validate(file_path=file, data=yaml_obj) validator_v1.print_errors(file) - assert is_valid is False - out, err = capsys.readouterr() - assert yf['error'] in out.strip() \ No newline at end of file + + # Split off the data before the text + error_list = out.strip().split("error -")[1:] + + if yfile["errors"]: + assert is_valid is False + assert len(error_list) == len(yfile["errors"]) + + for error in error_list: + assert any(yerrors in error for yerrors in yfile['errors']) + else: + # If there is no expected error, then it should be valid + assert is_valid \ No newline at end of file From 10c2c543f36b5c7e0f00c9d15e7a4351569dedc6 Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:42:59 +0100 Subject: [PATCH 19/22] Improve test cases Adds some extra checks against the regex in the related submission testing. --- .../invalid_submission_doi.yaml | 7 +++++-- testsuite/test_submission_validator.py | 21 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml index 4221ec7..2596403 100644 --- a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml +++ b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml @@ -7,5 +7,8 @@ keywords: - {name: reactions, values: []} data_file: data1.yaml related_to_table_dois: - - 1 - - "aaa" \ No newline at end of file + - 1 + - "10.17182/hepdata.1" + - "10.17182/hepdata.1.v1" + - "10.17182/hepdata.1.v1/" + - "10.17182/hepdata.1.v1/a2" \ No newline at end of file diff --git a/testsuite/test_submission_validator.py b/testsuite/test_submission_validator.py index 4569427..6834ae1 100644 --- a/testsuite/test_submission_validator.py +++ b/testsuite/test_submission_validator.py @@ -338,29 +338,33 @@ def test_submission_with_no_data_tables(validator_v0, validator_v1, data_path, c is_valid_v0 = validator_v0.validate(file_path=file, data=yaml_obj) assert is_valid_v0 + def test_related_submissions(validator_v1, data_path, capsys): """ - Tests all of the related submission files at once + Tests all related submission files at once against their expected errors. """ test_folder = "/TestRelatedSubmissions/" yaml_files = [ { - "file" : "valid_submission_related.yaml", - "errors" : None + "file": "valid_submission_related.yaml", + "errors": None }, { - "file" : "invalid_submission_recid.yaml", - "errors" : [ + "file": "invalid_submission_recid.yaml", + "errors": [ "'a' is not of type 'integer'", "'a' is not of type 'integer'", "0 is less than the minimum of 1" ]}, { "file": "invalid_submission_doi.yaml", - "errors" : [ + "errors": [ "1 is not of type 'string'", - "'aaa' does not match" + "'10.17182/hepdata.1' does not match", + "'10.17182/hepdata.1.v1' does not match", + "'10.17182/hepdata.1.v1/' does not match", + "'10.17182/hepdata.1.v1/a2'" ]}] for yfile in yaml_files: @@ -371,14 +375,13 @@ def test_related_submissions(validator_v1, data_path, capsys): is_valid = validator_v1.validate(file_path=file, data=yaml_obj) validator_v1.print_errors(file) out, err = capsys.readouterr() - + # Split off the data before the text error_list = out.strip().split("error -")[1:] if yfile["errors"]: assert is_valid is False assert len(error_list) == len(yfile["errors"]) - for error in error_list: assert any(yerrors in error for yerrors in yfile['errors']) else: From 5e1afa092b3d60f3e22bc02e89280a287c9b380f Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Wed, 9 Aug 2023 15:23:38 +0100 Subject: [PATCH 20/22] Remove whitespace in test yaml files Removes spaces on array entries in the related test yaml files. --- .../invalid_submission_doi.yaml | 12 ++++++------ .../invalid_submission_recid.yaml | 2 +- .../valid_submission_related.yaml | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml index 2596403..5a4043e 100644 --- a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml +++ b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml @@ -4,11 +4,11 @@ comment: "Test Text" name: "Table 1" description: Words keywords: - - {name: reactions, values: []} +- {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" \ No newline at end of file +- 1 +- "10.17182/hepdata.1" +- "10.17182/hepdata.1.v1" +- "10.17182/hepdata.1.v1/" +- "10.17182/hepdata.1.v1/a2" \ No newline at end of file diff --git a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml index 3620c5c..5136023 100644 --- a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml +++ b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml @@ -5,5 +5,5 @@ related_to_hepdata_recids: ["a", a, 0] name: "Table 1" description: Words keywords: - - {name: reactions, values: []} +- {name: reactions, values: []} data_file: data1.yaml diff --git a/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml b/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml index ad04aee..d82d698 100644 --- a/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml +++ b/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml @@ -1,12 +1,12 @@ description: "Test Data" comment: Test related_to_hepdata_recids: - - 1 +- 1 --- name: "Table 1" description: Words keywords: - - {name: cmenergies, values: [0]} +- {name: cmenergies, values: [0]} data_file: data1.yaml related_to_table_dois: - - "10.17182/hepdata.1.v1/t1" \ No newline at end of file +- "10.17182/hepdata.1.v1/t1" \ No newline at end of file From e8064a2b6bed7a1bdb181787d520ed88abdae79a Mon Sep 17 00:00:00 2001 From: Jordan <21129425+ItIsJordan@users.noreply.github.com> Date: Fri, 11 Aug 2023 15:35:50 +0100 Subject: [PATCH 21/22] Add uniqueness check in doi/recid entry Adds a uniqueness check in the related DOI and record ID entries in the schema. Also adds testing against this functionality. --- .../schemas/1.1.1/additional_info_schema.json | 1 + .../schemas/1.1.1/submission_schema.json | 1 + .../invalid_submission_doi.yaml | 4 +++- .../invalid_submission_recid.yaml | 2 +- testsuite/test_submission_validator.py | 12 ++++++++---- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/hepdata_validator/schemas/1.1.1/additional_info_schema.json b/hepdata_validator/schemas/1.1.1/additional_info_schema.json index 8923f56..044ce28 100644 --- a/hepdata_validator/schemas/1.1.1/additional_info_schema.json +++ b/hepdata_validator/schemas/1.1.1/additional_info_schema.json @@ -19,6 +19,7 @@ }, "related_to_hepdata_recids" : { "type" : "array", + "uniqueItems": true, "items" : {"type" : "integer", "minimum": 1} }, "preprintyear": { diff --git a/hepdata_validator/schemas/1.1.1/submission_schema.json b/hepdata_validator/schemas/1.1.1/submission_schema.json index 027b9c3..59b9a0e 100644 --- a/hepdata_validator/schemas/1.1.1/submission_schema.json +++ b/hepdata_validator/schemas/1.1.1/submission_schema.json @@ -8,6 +8,7 @@ "name": { "type": "string", "maxLength": 64 }, "related_to_table_dois" : { "type" : "array", + "uniqueItems": true, "items" : {"type" : "string", "maxLength" : 128, "pattern" : "^10\\.17182\/hepdata\\.\\d+\\.v\\d+\/t\\d+$" } }, "location": { "type": "string", "maxLength": 256 }, diff --git a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml index 5a4043e..f6cdc6c 100644 --- a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml +++ b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_doi.yaml @@ -11,4 +11,6 @@ related_to_table_dois: - "10.17182/hepdata.1" - "10.17182/hepdata.1.v1" - "10.17182/hepdata.1.v1/" -- "10.17182/hepdata.1.v1/a2" \ No newline at end of file +- "10.17182/hepdata.1.v1/a2" +- "10.17182/hepdata.1.v1/t1" +- "10.17182/hepdata.1.v1/t1" \ No newline at end of file diff --git a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml index 5136023..1ec1f4f 100644 --- a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml +++ b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml @@ -1,6 +1,6 @@ --- comment: "Test Text" -related_to_hepdata_recids: ["a", a, 0] +related_to_hepdata_recids: ["a", b, 0, 1, 1] --- name: "Table 1" description: Words diff --git a/testsuite/test_submission_validator.py b/testsuite/test_submission_validator.py index 6834ae1..29fdcca 100644 --- a/testsuite/test_submission_validator.py +++ b/testsuite/test_submission_validator.py @@ -354,8 +354,9 @@ def test_related_submissions(validator_v1, data_path, capsys): "file": "invalid_submission_recid.yaml", "errors": [ "'a' is not of type 'integer'", - "'a' is not of type 'integer'", - "0 is less than the minimum of 1" + "'b' is not of type 'integer'", + "0 is less than the minimum of 1", + "has non-unique elements in 'related_to_hepdata_recids'" ]}, { "file": "invalid_submission_doi.yaml", @@ -364,7 +365,8 @@ def test_related_submissions(validator_v1, data_path, capsys): "'10.17182/hepdata.1' does not match", "'10.17182/hepdata.1.v1' does not match", "'10.17182/hepdata.1.v1/' does not match", - "'10.17182/hepdata.1.v1/a2'" + "'10.17182/hepdata.1.v1/a2' does not match", + "has non-unique elements in 'related_to_table_dois'" ]}] for yfile in yaml_files: @@ -381,9 +383,11 @@ def test_related_submissions(validator_v1, data_path, capsys): if yfile["errors"]: assert is_valid is False + # Should be the same amount of errors as expected assert len(error_list) == len(yfile["errors"]) + # Then check against the expected errors for error in error_list: assert any(yerrors in error for yerrors in yfile['errors']) else: # If there is no expected error, then it should be valid - assert is_valid \ No newline at end of file + assert is_valid From 326d39294c71e5ea3dd7e2771e709d44cb7bb521 Mon Sep 17 00:00:00 2001 From: Graeme Watt Date: Wed, 16 Aug 2023 15:47:05 +0100 Subject: [PATCH 22/22] Rename 'related_to_hepdata_recids' field * Instead use 'related_to_hepdata_records' (suggested by @20DM). * Move new fields to end of 'properties' in JSON schema. * Bump version to 0.3.4 in preparation for new release. --- .../schemas/1.1.1/additional_info_schema.json | 10 +++++----- hepdata_validator/schemas/1.1.1/submission_schema.json | 10 +++++----- hepdata_validator/version.py | 2 +- testsuite/test_data/TestHEPSubmission/submission.yaml | 2 +- .../invalid_submission_recid.yaml | 2 +- .../valid_submission_related.yaml | 2 +- testsuite/test_submission_validator.py | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/hepdata_validator/schemas/1.1.1/additional_info_schema.json b/hepdata_validator/schemas/1.1.1/additional_info_schema.json index 044ce28..373e73d 100644 --- a/hepdata_validator/schemas/1.1.1/additional_info_schema.json +++ b/hepdata_validator/schemas/1.1.1/additional_info_schema.json @@ -17,11 +17,6 @@ "additionalProperties": false } }, - "related_to_hepdata_recids" : { - "type" : "array", - "uniqueItems": true, - "items" : {"type" : "integer", "minimum": 1} - }, "preprintyear": { "type": "string", "title": "Preprint Year", @@ -57,6 +52,11 @@ "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 diff --git a/hepdata_validator/schemas/1.1.1/submission_schema.json b/hepdata_validator/schemas/1.1.1/submission_schema.json index 59b9a0e..5abf3c2 100644 --- a/hepdata_validator/schemas/1.1.1/submission_schema.json +++ b/hepdata_validator/schemas/1.1.1/submission_schema.json @@ -6,11 +6,6 @@ "type": "object", "properties": { "name": { "type": "string", "maxLength": 64 }, - "related_to_table_dois" : { - "type" : "array", - "uniqueItems": true, - "items" : {"type" : "string", "maxLength" : 128, "pattern" : "^10\\.17182\/hepdata\\.\\d+\\.v\\d+\/t\\d+$" } - }, "location": { "type": "string", "maxLength": 256 }, "description": { "type": "string"}, "keywords": { @@ -49,6 +44,11 @@ "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"], diff --git a/hepdata_validator/version.py b/hepdata_validator/version.py index 9f787b7..4185af3 100644 --- a/hepdata_validator/version.py +++ b/hepdata_validator/version.py @@ -27,4 +27,4 @@ from __future__ import absolute_import, print_function -__version__ = "0.3.3" +__version__ = "0.3.4" diff --git a/testsuite/test_data/TestHEPSubmission/submission.yaml b/testsuite/test_data/TestHEPSubmission/submission.yaml index a059188..c0c1079 100644 --- a/testsuite/test_data/TestHEPSubmission/submission.yaml +++ b/testsuite/test_data/TestHEPSubmission/submission.yaml @@ -26,7 +26,7 @@ comment: | # preserve newlines - No events with a third lepton for which ptLepton > 10 GeV - min(DeltaR(l,l)) > 0.3 -related_to_hepdata_recids: +related_to_hepdata_records: - 1 --- diff --git a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml index 1ec1f4f..a97b2ff 100644 --- a/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml +++ b/testsuite/test_data/TestRelatedSubmissions/invalid_submission_recid.yaml @@ -1,6 +1,6 @@ --- comment: "Test Text" -related_to_hepdata_recids: ["a", b, 0, 1, 1] +related_to_hepdata_records: ["a", b, 0, 1, 1] --- name: "Table 1" description: Words diff --git a/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml b/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml index d82d698..5a063f0 100644 --- a/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml +++ b/testsuite/test_data/TestRelatedSubmissions/valid_submission_related.yaml @@ -1,6 +1,6 @@ description: "Test Data" comment: Test -related_to_hepdata_recids: +related_to_hepdata_records: - 1 --- name: "Table 1" diff --git a/testsuite/test_submission_validator.py b/testsuite/test_submission_validator.py index 29fdcca..f73ce61 100644 --- a/testsuite/test_submission_validator.py +++ b/testsuite/test_submission_validator.py @@ -356,7 +356,7 @@ def test_related_submissions(validator_v1, data_path, capsys): "'a' is not of type 'integer'", "'b' is not of type 'integer'", "0 is less than the minimum of 1", - "has non-unique elements in 'related_to_hepdata_recids'" + "has non-unique elements in 'related_to_hepdata_records'" ]}, { "file": "invalid_submission_doi.yaml",