Skip to content

Instantly share code, notes, and snippets.

@avishaan
Last active July 11, 2016 01:43
Show Gist options
  • Save avishaan/fd8b991347ff892f595f to your computer and use it in GitHub Desktop.
Save avishaan/fd8b991347ff892f595f to your computer and use it in GitHub Desktop.
Dashboard MongoDB object format
// basic json document template
var graphBaseTemplate = {
'_id': '0012938801abfe', //auto assigned by database
'kHospitalName': 'kKaiser',
'kHospitalId': '0012938801abf1',
'kGraphName': 'kCostSavings',
'kGraphId': '0012938801abf2',
'kDepartmentName': 'kHospitalWide',
'kDepartmentId': '0012938801abf3',
'datasets': datasets
};
// single line graph
datasets = [{
'labels': ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
'data': [65, 59, 80, 81, 56, 55, 40],
'datetime': ['2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z'] // optional field
}];
// single line graph with average
datasets = [{
'labels': ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
'data': [65, 59, 80, 81, 56, 55, 40],
'average': 70
}];
// single bar graph
datasets = [{
'labels': ['Physician 1', 'Physician 2', 'Physician 3', 'Physician 4', 'Physician 5'],
'data': [65, 59, 80, 81, 56]
}];
// two line graph with same labels
datasets = [{
'labels': ['January', 'February', 'March', 'April'],
'data': [[65, 59], [80, 81], [56, 55], [40, 45]],
'datetime': ['2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z']
}];
// two line graph with two labels
datasets = [{
'labels': ['January2015', 'February2015', 'March2015', 'April2015', 'May2015', 'June2015', 'July2015'],
'data': [65, 59, 80, 81, 56, 55, 40],
'datetime': ['2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z']
}, {
'labels': ['January2014', 'February2014', 'March2014', 'April2014', 'May2014', 'June2014', 'July2014'],
'data': [65, 59, 80, 81, 56, 55, 40],
'datetime': ['2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z', '2015-12-22T04:24:58.597Z']
}];
@avishaan
Copy link
Author

Need department id so the front end will be able to pick the correct graph for a specified department

@avishaan
Copy link
Author

add createdAt field and userId field for the last person who entered zero

@avishaan
Copy link
Author

need chart type somewhere in there

@avishaan
Copy link
Author

don't embed graph level label on each data element (if applicable)

@avishaan
Copy link
Author

consider adding graph title

@avishaan
Copy link
Author

consider adding graph subtitle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment