diff --git a/design-scratch/ExampleAdapter.json b/design-scratch/ExampleAdapter.json deleted file mode 100644 index 546261441..000000000 --- a/design-scratch/ExampleAdapter.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "some-name", - "ID": "some-uuid" -} \ No newline at end of file diff --git a/design-scratch/ExampleFailurePreviousQuery.json b/design-scratch/ExampleFailurePreviousQuery.json deleted file mode 100644 index ebe5e54a9..000000000 --- a/design-scratch/ExampleFailurePreviousQuery.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "queryID": "some-uuid", - "topicID": "some-uuid", - "userID": "some-user-id", - "startTime": 1091201, - "i2b2QueryText": "some-xml", - "extraXmlBaggage": "some-xml", - "queryResults": [ - { - "status": "Failure", - "resultID": "some-uuid", - "adapterID": "some-uuid", - "count": 129084, - "problemDigest": { - }, - "flagMessages?": { - } - } - ] -} diff --git a/design-scratch/ExamplePendingPreviousQuery.json b/design-scratch/ExamplePendingPreviousQuery.json deleted file mode 100644 index e7be24d3e..000000000 --- a/design-scratch/ExamplePendingPreviousQuery.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "queryID": "some-uuid", - "topicID": "some-uuid", - "userID": "some-user-id", - "startTime": 1091201, - "i2b2QueryText": "some-xml", - "extraXmlBaggage": "some-xml", - "queryResults": [ - { - "status": "Failure", - "resultID": "some-uuid", - "adapterID": "some-uuid", - "count": 129084, - } - ] -} diff --git a/design-scratch/ExampleSuccessPreviousQuery.json b/design-scratch/ExampleSuccessPreviousQuery.json deleted file mode 100644 index 27503b218..000000000 --- a/design-scratch/ExampleSuccessPreviousQuery.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "queryID": "some-uuid", - "topicID": "some-uuid", - "userID": "some-uuid", - "startTime": 1091201, - "i2b2QueryText": "some-xml", - "extraXmlBaggage": "some-xml", - "queryResults": [ - { - "status": "Success", - "resultID": "some-uuid", - "adapterID": "some-uuid", - "count": 129084, - "noiseTerms": { - "clamp": 3, - "sigma": 3, - "rounding": 3 - }, - "breakdowns": [ - { - "category": "Gender", - "results": [ - { - "name": "Male", - "count": 333 - }, - { - "name": "Female", - "count": 333 - } - ] - } - ], - "i2b2Mapping": "stuff" - } - ] -} \ No newline at end of file diff --git a/design-scratch/ExampleUser.json b/design-scratch/ExampleUser.json deleted file mode 100644 index fbf0af87c..000000000 --- a/design-scratch/ExampleUser.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "userName": "some-name", - "ID": "some-uuid", - "domain": "some-domian" -} diff --git a/design-scratch/adapter.json b/design-scratch/adapter.json new file mode 100644 index 000000000..fa418b620 --- /dev/null +++ b/design-scratch/adapter.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "title": "Adapter", + "description": "Represents an adapter running on top of some i2b2 instance", + "properties": { + "name": { "type": "string" }, + "ID": { "type": "uuid" } + }, + "required": [ + "name", + "ID" + ] +} \ No newline at end of file diff --git a/design-scratch/query-result.schema.json b/design-scratch/query-result.schema.json new file mode 100644 index 000000000..59452b79a --- /dev/null +++ b/design-scratch/query-result.schema.json @@ -0,0 +1,98 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "title": "Query Result", + "description": "Represents a result that can come back from a site for a query", + "properties": { + "status": { + "type": { "enum" : [ "success", "pending", "failure"]}, + "description": "The current status of the result (especially useful for async results)" + }, + "resultID": { + "type": "uuid", + "description": "A unique identifier for this result" + }, + "adapterID": { + "type": "uuid", + "description": "A unique identifier for the node that this result came from. Only present for success statuses." + }, + "count": { + "type": "integer", + "description": "The primary count of patients coming back for this query. Only present for success statuses." + }, + "noiseTerms": { + "type": "object", + "description": "The noise that we inject into the returned count for obfuscation purposes. Only present for success statuses.", + "properties": { + "clamp": { "type": "integer" }, + "sigma": { "type": "integer" }, + "rounding": { "type": "integer" } + }, + "required": [ + "clamp", + "sigma", + "rounding" + ] + }, + "breakdowns": { + "type": "array", + "description": "The optional breakdowns that the user requested. Only present for success statuses.", + "items": { + "type": "object", + "description": "The category and list of results for this breakdown", + "properties": { + "category": { + "type": { "enum": [ "Gender", "Age", "Race", "Vital Status"]}, + }, + "results": { + "type": "array", + "description": "The name/count pairs associated with a breakdown", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the result for a breakdown, e.g., Male for Gender" + }, + "count": { + "type": "integer", + "description": "The number of patients associated with this breakdown", + "minimum": 0 + } + }, + "required": [ + "name", + "count" + ] + } + } + }, + "required": [ + "category", + "results" + ] + } + }, + "i2b2Mapping": { + "type": "xml", + "description": "Use this to run this query at the i2b2 site associated with the result's nodes, only present for success statuses" + }, + "problemDigest": { + "type": "object", + "description": "The improved error that was associated with this query failing at the node site" + }, + "flagMessages?": { + "type": "object", + "description": "Not pinned down yet" + } + }, + "required": [ + "status", + "resultID", + "adapterID", + "count", + "noiseTerms", + "breakdowns", + "i2b2Mapping" + ] +} \ No newline at end of file diff --git a/design-scratch/query.schema.json b/design-scratch/query.schema.json new file mode 100644 index 000000000..1ec8c720b --- /dev/null +++ b/design-scratch/query.schema.json @@ -0,0 +1,49 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "title": "Query schema.", + "description": "A query represents a single row in the previous queries table on the web-client. It contains information relating to the query (its id, what topic it's under, what user ran it), as well as an array of query result objects", + "properties": { + "queryID": { + "type": "uuid", + "description": "A UUID used to uniquely identify this query" + }, + "topicID": { + "type": "uuid", + "description": "A UUID used to uniquely identify the topic that this query runs under" + }, + "userID": { + "type": "uuid", + "description": "A UUID used to uniquely identify the user that ran this query" + }, + "startTime": { + "type": "integer", + "description": "The epoch integer that represents when this query was ran" + }, + "i2b2QueryText": { + "type": "xml", + "description": "The origin query, which we keep for communication with i2b2. This is an xml string" + }, + "extraXmlBaggage": { + "type": "xml", + "description": "Extra xml that the query needs access to" + }, + "queryResults": { + "type": "array", + "description": "The results coming back from the sites this query was sent to", + "items": { + "type": "queryResult", + "description": "See 'query-result.schema.json'" + } + } + }, + "required": [ + "queryID", + "topicID", + "userID", + "startTime", + "i2b2QueryText", + "extraXmlBaggage", + "queryResults" + ] +} \ No newline at end of file diff --git a/design-scratch/ExampleTopic.json b/design-scratch/topic.schema.json similarity index 100% rename from design-scratch/ExampleTopic.json rename to design-scratch/topic.schema.json diff --git a/design-scratch/user.schema.json b/design-scratch/user.schema.json new file mode 100644 index 000000000..e7ac5d8a0 --- /dev/null +++ b/design-scratch/user.schema.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "title": "User", + "description": "Represents a Shrine user", + "properties": { + "userName": { "type": "string" }, + "ID": { "type": "uuid" }, + "domain": { + "type": "string", + "description": "The domain this user is registered with" + } + }, + "required": [ + "userName", + "ID", + "domain" + ] +}