{"action":"created","comment":{"url":"https://api.github.com/repos/tidepool-org/platform/pulls/comments/57251604","id":57251604,"diff_hunk":"@@ -0,0 +1,166 @@\n+package data\n+\n+import (\n+\t\"fmt\"\n+\t\"reflect\"\n+\t\"strings\"\n+\n+\tvalid \"github.com/tidepool-org/platform/Godeps/_workspace/src/gopkg.in/bluesuncorp/validator.v8\"\n+\t\"github.com/tidepool-org/platform/validate\"\n+)\n+\n+func init() {\n+\tvalidator.RegisterValidation(rateTag, BasalRateValidator)\n+\tvalidator.RegisterValidation(durationTag, BasalDurationValidator)\n+\tvalidator.RegisterValidation(deliveryTypeTag, BasalDeliveryTypeValidator)\n+\tvalidator.RegisterValidation(insulinTag, BasalInsulinValidator)\n+\tvalidator.RegisterValidation(valueTag, BasalValueValidator)\n+}\n+\n+//Basal represents a basal device data record\n+type Basal struct {\n+\tDeliveryType string          `json:\"deliveryType\" bson:\"deliveryType\" valid:\"basaldeliverytype\"`\n+\tScheduleName string          `json:\"scheduleName\" bson:\"scheduleName\" valid:\"omitempty,required\"`\n+\tRate         float64         `json:\"rate\" bson:\"rate\" valid:\"omitempty,basalrate\"`\n+\tDuration     int             `json:\"duration\" bson:\"duration\" valid:\"omitempty,basalduration\"`\n+\tInsulin      string          `json:\"insulin\" bson:\"insulin,omitempty\" valid:\"omitempty,basalinsulin\"`\n+\tValue        int             `json:\"value\" bson:\"value,omitempty\" valid:\"omitempty,basalvalue\"`\n+\tSuppressed   *SupressedBasal `json:\"suppressed\" bson:\"suppressed,omitempty\" valid:\"omitempty,required\"`\n+\tBase         `bson:\",inline\"`\n+}\n+\n+//SupressedBasal represents a suppressed basal portion of a basal\n+type SupressedBasal struct {\n+\tType         string  `json:\"type\" bson:\"type\" valid:\"required\"`\n+\tDeliveryType string  `json:\"deliveryType\" bson:\"deliveryType\" valid:\"basaldeliverytype\"`\n+\tScheduleName string  `json:\"scheduleName\" bson:\"scheduleName\" valid:\"omitempty,required\"`","path":"data/basal.go","position":36,"original_position":36,"commit_id":"af8082527ae3bd8cf9e41696e96205c229e34308","original_commit_id":"af8082527ae3bd8cf9e41696e96205c229e34308","user":{"login":"darinkrauss","id":1224433,"avatar_url":"https://avatars.githubusercontent.com/u/1224433?v=3","gravatar_id":"","url":"https://api.github.com/users/darinkrauss","html_url":"https://github.com/darinkrauss","followers_url":"https://api.github.com/users/darinkrauss/followers","following_url":"https://api.github.com/users/darinkrauss/following{/other_user}","gists_url":"https://api.github.com/users/darinkrauss/gists{/gist_id}","starred_url":"https://api.github.com/users/darinkrauss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darinkrauss/subscriptions","organizations_url":"https://api.github.com/users/darinkrauss/orgs","repos_url":"https://api.github.com/users/darinkrauss/repos","events_url":"https://api.github.com/users/darinkrauss/events{/privacy}","received_events_url":"https://api.github.com/users/darinkrauss/received_events","type":"User","site_admin":false},"body":"Do we need to coordinate on which fields are omitempty for `json`, `bson`, and `valid`?","created_at":"2016-03-23T22:57:58Z","updated_at":"2016-03-23T22:57:58Z","html_url":"https://github.com/tidepool-org/platform/pull/12#discussion_r57251604","pull_request_url":"https://api.github.com/repos/tidepool-org/platform/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/tidepool-org/platform/pulls/comments/57251604"},"html":{"href":"https://github.com/tidepool-org/platform/pull/12#discussion_r57251604"},"pull_request":{"href":"https://api.github.com/repos/tidepool-org/platform/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/tidepool-org/platform/pulls/12","id":63931702,"html_url":"https://github.com/tidepool-org/platform/pull/12","diff_url":"https://github.com/tidepool-org/platform/pull/12.diff","patch_url":"https://github.com/tidepool-org/platform/pull/12.patch","issue_url":"https://api.github.com/repos/tidepool-org/platform/issues/12","number":12,"state":"open","locked":false,"title":"All data-validation changes (PR only)","user":{"login":"darinkrauss","id":1224433,"avatar_url":"https://avatars.githubusercontent.com/u/1224433?v=3","gravatar_id":"","url":"https://api.github.com/users/darinkrauss","html_url":"https://github.com/darinkrauss","followers_url":"https://api.github.com/users/darinkrauss/followers","following_url":"https://api.github.com/users/darinkrauss/following{/other_user}","gists_url":"https://api.github.com/users/darinkrauss/gists{/gist_id}","starred_url":"https://api.github.com/users/darinkrauss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darinkrauss/subscriptions","organizations_url":"https://api.github.com/users/darinkrauss/orgs","repos_url":"https://api.github.com/users/darinkrauss/repos","events_url":"https://api.github.com/users/darinkrauss/events{/privacy}","received_events_url":"https://api.github.com/users/darinkrauss/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-23T18:35:57Z","updated_at":"2016-03-23T22:57:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33ea3b63ebc9d56f195dd22f74144e7afd2354f8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tidepool-org/platform/pulls/12/commits","review_comments_url":"https://api.github.com/repos/tidepool-org/platform/pulls/12/comments","review_comment_url":"https://api.github.com/repos/tidepool-org/platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tidepool-org/platform/issues/12/comments","statuses_url":"https://api.github.com/repos/tidepool-org/platform/statuses/af8082527ae3bd8cf9e41696e96205c229e34308","head":{"label":"tidepool-org:data-validation-pr","ref":"data-validation-pr","sha":"af8082527ae3bd8cf9e41696e96205c229e34308","user":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"repo":{"id":47368930,"name":"platform","full_name":"tidepool-org/platform","owner":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidepool-org/platform","description":"The Tidepool platform API","fork":false,"url":"https://api.github.com/repos/tidepool-org/platform","forks_url":"https://api.github.com/repos/tidepool-org/platform/forks","keys_url":"https://api.github.com/repos/tidepool-org/platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidepool-org/platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidepool-org/platform/teams","hooks_url":"https://api.github.com/repos/tidepool-org/platform/hooks","issue_events_url":"https://api.github.com/repos/tidepool-org/platform/issues/events{/number}","events_url":"https://api.github.com/repos/tidepool-org/platform/events","assignees_url":"https://api.github.com/repos/tidepool-org/platform/assignees{/user}","branches_url":"https://api.github.com/repos/tidepool-org/platform/branches{/branch}","tags_url":"https://api.github.com/repos/tidepool-org/platform/tags","blobs_url":"https://api.github.com/repos/tidepool-org/platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidepool-org/platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidepool-org/platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidepool-org/platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidepool-org/platform/statuses/{sha}","languages_url":"https://api.github.com/repos/tidepool-org/platform/languages","stargazers_url":"https://api.github.com/repos/tidepool-org/platform/stargazers","contributors_url":"https://api.github.com/repos/tidepool-org/platform/contributors","subscribers_url":"https://api.github.com/repos/tidepool-org/platform/subscribers","subscription_url":"https://api.github.com/repos/tidepool-org/platform/subscription","commits_url":"https://api.github.com/repos/tidepool-org/platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidepool-org/platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidepool-org/platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidepool-org/platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidepool-org/platform/contents/{+path}","compare_url":"https://api.github.com/repos/tidepool-org/platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidepool-org/platform/merges","archive_url":"https://api.github.com/repos/tidepool-org/platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidepool-org/platform/downloads","issues_url":"https://api.github.com/repos/tidepool-org/platform/issues{/number}","pulls_url":"https://api.github.com/repos/tidepool-org/platform/pulls{/number}","milestones_url":"https://api.github.com/repos/tidepool-org/platform/milestones{/number}","notifications_url":"https://api.github.com/repos/tidepool-org/platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidepool-org/platform/labels{/name}","releases_url":"https://api.github.com/repos/tidepool-org/platform/releases{/id}","deployments_url":"https://api.github.com/repos/tidepool-org/platform/deployments","created_at":"2015-12-04T00:06:19Z","updated_at":"2016-03-15T19:16:25Z","pushed_at":"2016-03-23T18:35:57Z","git_url":"git://github.com/tidepool-org/platform.git","ssh_url":"git@github.com:tidepool-org/platform.git","clone_url":"https://github.com/tidepool-org/platform.git","svn_url":"https://github.com/tidepool-org/platform","homepage":"","size":694,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"tidepool-org:initial","ref":"initial","sha":"3d11c5fd66261d6c3a2dcb6222d2fd28b8ec0246","user":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"repo":{"id":47368930,"name":"platform","full_name":"tidepool-org/platform","owner":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidepool-org/platform","description":"The Tidepool platform API","fork":false,"url":"https://api.github.com/repos/tidepool-org/platform","forks_url":"https://api.github.com/repos/tidepool-org/platform/forks","keys_url":"https://api.github.com/repos/tidepool-org/platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidepool-org/platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidepool-org/platform/teams","hooks_url":"https://api.github.com/repos/tidepool-org/platform/hooks","issue_events_url":"https://api.github.com/repos/tidepool-org/platform/issues/events{/number}","events_url":"https://api.github.com/repos/tidepool-org/platform/events","assignees_url":"https://api.github.com/repos/tidepool-org/platform/assignees{/user}","branches_url":"https://api.github.com/repos/tidepool-org/platform/branches{/branch}","tags_url":"https://api.github.com/repos/tidepool-org/platform/tags","blobs_url":"https://api.github.com/repos/tidepool-org/platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidepool-org/platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidepool-org/platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidepool-org/platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidepool-org/platform/statuses/{sha}","languages_url":"https://api.github.com/repos/tidepool-org/platform/languages","stargazers_url":"https://api.github.com/repos/tidepool-org/platform/stargazers","contributors_url":"https://api.github.com/repos/tidepool-org/platform/contributors","subscribers_url":"https://api.github.com/repos/tidepool-org/platform/subscribers","subscription_url":"https://api.github.com/repos/tidepool-org/platform/subscription","commits_url":"https://api.github.com/repos/tidepool-org/platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidepool-org/platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidepool-org/platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidepool-org/platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidepool-org/platform/contents/{+path}","compare_url":"https://api.github.com/repos/tidepool-org/platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidepool-org/platform/merges","archive_url":"https://api.github.com/repos/tidepool-org/platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidepool-org/platform/downloads","issues_url":"https://api.github.com/repos/tidepool-org/platform/issues{/number}","pulls_url":"https://api.github.com/repos/tidepool-org/platform/pulls{/number}","milestones_url":"https://api.github.com/repos/tidepool-org/platform/milestones{/number}","notifications_url":"https://api.github.com/repos/tidepool-org/platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidepool-org/platform/labels{/name}","releases_url":"https://api.github.com/repos/tidepool-org/platform/releases{/id}","deployments_url":"https://api.github.com/repos/tidepool-org/platform/deployments","created_at":"2015-12-04T00:06:19Z","updated_at":"2016-03-15T19:16:25Z","pushed_at":"2016-03-23T18:35:57Z","git_url":"git://github.com/tidepool-org/platform.git","ssh_url":"git@github.com:tidepool-org/platform.git","clone_url":"https://github.com/tidepool-org/platform.git","svn_url":"https://github.com/tidepool-org/platform","homepage":"","size":694,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tidepool-org/platform/pulls/12"},"html":{"href":"https://github.com/tidepool-org/platform/pull/12"},"issue":{"href":"https://api.github.com/repos/tidepool-org/platform/issues/12"},"comments":{"href":"https://api.github.com/repos/tidepool-org/platform/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/tidepool-org/platform/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/tidepool-org/platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tidepool-org/platform/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/tidepool-org/platform/statuses/af8082527ae3bd8cf9e41696e96205c229e34308"}}}}