Created
October 30, 2014 10:34
-
-
Save alexmuller/cd374f3c6ebd1fbae3e5 to your computer and use it in GitHub Desktop.
Grouped timeseries with added "count"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from stagecraft.apps.dashboards.models.module import ModuleType | |
grouped_timeseries = ModuleType.objects.get(name='grouped_timeseries') | |
new_json = {u'definitions': {u'axis': {u'type': u'object', u'properties': {u'label': {u'required': True, u'type': u'string'}, u'key': {u'oneOf': [{u'type': u'string'}, {u'type': u'array'}], u'required': False}, u'format': {u'oneOf': [{u'type': u'string'}, {u'type': u'object', u'properties': {u'type': {u'type': u'string'}}}]}}}}, u'$schema': u'http://json-schema.org/draft-03/schema#', u'allOf': [{u'definitions': {u'query-params': {u'type': u'object', u'properties': {u'start_at': {u'required': False, u'type': u'string'}, u'period': {u'allOf': [{u'required': False}, {u'enum': [u'hour', u'day', u'week', u'month', u'quarter'], u'type': u'string'}]}, u'filter_by': {u'items': {u'type': u'string'}, u'required': False, u'type': u'array'}, u'collect': {u'items': {u'pattern': u':(sum|mean|set|count)$', u'type': u'string'}, u'required': False, u'type': u'array'}, u'group_by': {u'oneOf': [{u'required': False, u'type': u'string'}, {u'items': {u'type': u'string'}, u'required': False, u'type': u'array'}]}, u'end_at': {u'required': False, u'type': u'string'}, u'duration': {u'required': False, u'type': u'integer'}, u'sort_by': {u'required': False, u'type': u'string'}}}, u'axis': {u'type': u'object', u'properties': {u'label': {u'required': True, u'type': u'string'}, u'key': {u'oneOf': [{u'type': u'string'}, {u'type': u'array'}], u'required': False}, u'format': {u'oneOf': [{u'type': u'string'}, {u'type': u'object', u'properties': {u'type': {u'type': u'string'}}}]}}}},u'type': u'object', u'id': u'/ModuleCommon', u'properties': {u'date-picker': {u'required': False, u'type': u'object', u'properties': {u'start-date': {u'required': True, u'type': u'string', u'format': u'date-time'}}}, u'value-attribute': {u'type': u'string'}, u'classes': {u'type': [u'array', u'string']}, u'axis-period': {u'oneOf': [{u'enum': [u'day', u'week', u'month', u'quarter']}], u'required': False, u'type': u'string'}, u'axes': {u'type': u'object', u'properties': {u'y': {u'minItems': 1, u'items': {u'$ref': u'#/definitions/axis'}, u'type': u'array'}, u'x': {u'$ref': u'#/definitions/axis'}}}}}, {u'properties': {u'category': {u'required': True, u'type': u'string'}, u'show-total-lines': {u'type': u'boolean'}, u'value-attribute': {u'required': True}, u'axes': {u'type': u'object', u'properties': {u'y': {u'required': True}}}, u'one-hundred-percent': {u'type': u'boolean'}, u'use_stack': {u'type': u'boolean'}, u'currency': {u'oneOf': [{u'enum': [u'gbp']}], u'required': False, u'type': u'string'}, u'show-line-labels': {u'type': u'boolean'}, u'line-label-links': {u'type': u'boolean'}, u'group-mapping': {u'type': u'object'}}}]} | |
grouped_timeseries.json = new_json | |
grouped_timeseries.validate_schema() | |
grouped_timeseries.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(New JSON is just old JSON with "count" added to the valid collect options.)