diff --git a/event_model/schemas/run_start.json b/event_model/schemas/run_start.json index 5557f51a3..267c91963 100644 --- a/event_model/schemas/run_start.json +++ b/event_model/schemas/run_start.json @@ -4,6 +4,34 @@ "title" : "data_type", "patternProperties": {"^([^./]+)$": {"$ref": "#/definitions/data_type"}}, "additionalProperties": false + }, + "data_mapping": { + "description": "Where to get the data from", + "type": "object", + "properties" : { + "stream": {"type": "string"}, + "location": {"enum" : ["event", "configuration"]}, + "field": {"type": "string"} + }, + "required" : ["stream", "location", "field"], + "additionalProperties": false + }, + "technique": { + "title" : "Describe how to interperet this run as the given technique", + "properties":{ + "technique": {"type": "string", + "description": "The name of the technique"}, + "version": {"type": "integer", + "description": "The version of the technique spec"}, + "configuration" : {"type": "object", + "description": "Static information about technique"}, + "data_mapping" : { + "type": "object", + "patternProperties": {"^([^./]+)$": {"$ref": "#/definitions/data_mapping"}} + } + }, + "additionalProperties": false, + "required" : ["technique", "version", "configuration", "data_mapping"] } }, "properties": { @@ -35,6 +63,10 @@ "type": "string", "description": "Unix owner to associate this data with" }, + "techniques": { + "type": "array", + "items": {"$ref": "#/definitions/technique"} + }, "hints": { "type": "object", "description": "Start-level hints", @@ -57,12 +89,10 @@ { "type": "string", "description": "The stream to find the datakeys in." - } ], "additionalItems": false, "minItems": 2 - } } }, diff --git a/event_model/tests/test_em.py b/event_model/tests/test_em.py index 08934a13f..bfedbb2e0 100644 --- a/event_model/tests/test_em.py +++ b/event_model/tests/test_em.py @@ -852,3 +852,26 @@ def check_not_filled_factory(name, doc): rr = event_model.RunRouter([check_filled_factory], reg, fill_or_fail=True) for name, doc in docs: rr(name, doc) + + +def test_techniques(): + event_model.schema_validators[event_model.DocumentNames.start].validate( + { + "uid": "abc", + "time": 0, + "techniques": [ + { + "technique": "test", + "version": 0, + "configuration": {}, + "data_mapping": { + "image": { + "stream": "primary", + "location": "event", + "field": "fccd", + } + }, + } + ], + } + )