· 6 years ago · Jan 11, 2019, 04:18 AM
1{
2 "swagger": "2.0",
3 "info": {
4 "version": "v7.78.1",
5 "title": "Fitbit Plus API",
6 "x-logo": {
7 "url": "http://developer.twinehealth.com/images/Fitbit_Plus_lockup_2C_RGB-32.png"
8 },
9 "contact": {
10 "email": "apiteam@twinehealth.com"
11 },
12 "description": "# Overview\nThe Fitbit Plus API is a RESTful API. The requests and responses are formated according to the\n[JSON API](http://jsonapi.org/format/1.0/) specification.\n\nIn addition to this documentation, we also provide an\n[OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) \"yaml\" file describing the API:\n[Fitbit Plus API Specification](swagger.yaml).\n\n# Authentication\nAuthentication for the Fitbit Plus API is based on the\n[OAuth 2.0 Authorization Framework](https://tools.ietf.org/html/rfc6749). Fitbit Plus currently supports grant\ntypes of **client_credentials** and **refresh_token**.\n\nSee [POST /oauth/token](#operation/createToken) for details on the request and response formats.\n<!-- ReDoc-Inject: <security-definitions> -->\n\n## Building Integrations\nWe will provide customers with unique client credentials for each application/integration they build, allowing us\nto enforce appropriate access controls and monitor API usage.\nThe client credentials will be scoped to the organization, and allow full access to all patients and related data\nwithin that organization.\n\nThese credentials are appropriate for creating an integration that does one of the following:\n - background reporting/analysis\n - synchronizing data with another system (such as an EMR)\n\nThe API credentials and oauth flows we currently support are **not** well suited for creating a user-facing\napplication that allows a user (patient, coach, or admin) to login and have access to data which is appropriate to\nthat specific user. It is possible to build such an application, but it is not possible to use Fitbit Plus as a\nfederated identity provider. You would need to have a separate means of verifying a user's identity. We do not\ncurrently support the required password-based oauth flow to make this possible.\n\n# Paging\nThe Fitbit Plus API supports two different pagination strategies for GET collection endpoints.\n\n#### Skip-based paging\n\nSkip-based paging uses the query parameters `page[size]` and `page[number]` to specify the max number of resources returned and the page number. We default to skip-based paging if there are no page parameters. The response will include a `links` object containing links to the first, last, prev, and next pages of data.\n\nIf the contents of the collection change while you are iterating through the collection, you will see duplicate or missing documents. For example, if you are iterating through the `calender_event` resource via `GET /pub/calendar_event?sort=start_at&page[size]=50&page[number]=1`, and a new `calendar_event` is created that has a `start_at` value before the first `calendar_event`, when you fetch the next page at `GET /pub/calendar_event?sort=start_at&page[size]=50&page[number]=2`, the first entry in the second response will be a duplicate of the last entry in the first response.\n\n#### Cursor-based paging\nCursor-based paging uses the query parameters `page[limit]` and `page[after]` to specify the max number of entries returned and identify where to begin the next page. Add `page[limit]` to the parameters to use cursor-based paging. The response will include a `links` object containing a link to the next page of data, if the next page exists.\n\nCursor-based paging is not subject to duplication if new resources are added to the collection. For example, if you are iterating through the `calender_event` resource via `GET /pub/calendar_event?sort=start_at&page[limit]=50`, and a new `calendar_event` is created that has a `start_at` value before the first `calendar_event`, you will not see a duplicate entry when you fetch the next page at `GET /pub/calendar_event?sort=start_at&page[limit]=50&page[after]=<cursor>`.\n\nWe encourage the use of cursor-based paging for performance reasons.\n\nIn either form of paging, you can determine whether any resources were missed by comparing the number of fetched resources against `meta.count`. Set `page[size]` or `page[limit]` to 0 to get only the count.\n\nIt is not valid to mix the two strategies.\n"
13 },
14 "host": "api.twinehealth.com",
15 "basePath": "/pub",
16 "schemes": [
17 "https"
18 ],
19 "consumes": [
20 "application/vnd.api+json"
21 ],
22 "produces": [
23 "application/vnd.api+json"
24 ],
25 "securityDefinitions": {
26 "OAuth2": {
27 "type": "oauth2",
28 "description": "Fitbit Plus allows customers to access data for their organization using client credentials.\nOAuth2 is a safe and secure way to give you access.\n",
29 "flow": "application",
30 "tokenUrl": "/oauth/token",
31 "scopes": {
32 "group": "access patients and data within a group",
33 "organization": "access patients and data within an organization"
34 }
35 }
36 },
37 "tags": [
38 {
39 "name": "oauth",
40 "description": "Authentication operations"
41 },
42 {
43 "name": "organization",
44 "description": "An organization is a Fitbit Plus customer. No data is accessible across organizations."
45 },
46 {
47 "name": "group",
48 "description": "A group is a cohort of patients within an organization. The creation of groups allows for the segmentation of dashboards and analytics. For example, a group might correspond to the patients in a particular practice or the employees of a particular employer."
49 },
50 {
51 "name": "coach",
52 "description": "A coach is a person that supports a patient"
53 },
54 {
55 "name": "reward program",
56 "description": "A reward program provides the details for a rewards program for a group. Different rewards programs can be created for different periods of time specified by the start_at and end_at dates. A reward program can activated for a patient any time between these dates. An activated reward program for a patient is called a reward program activation."
57 },
58 {
59 "name": "action",
60 "description": "An action is an actionable item in a patient's plan."
61 },
62 {
63 "name": "bundle",
64 "description": "A bundle is a collection of actions (an action plan) in a patient's plan summary."
65 },
66 {
67 "name": "calendar event",
68 "description": "A calendar event represents an event involving or relevant to a patient which will or has occurred on a specific date or during a specific period of time."
69 },
70 {
71 "name": "calendar event response",
72 "description": "A calendar event response indicates the attendee's response to a calendar event. Only `POST` for creation is allowed as the responses are updated into the corresponding calendar events."
73 },
74 {
75 "name": "email history",
76 "description": "Email history represents a single email that was sent using Fitbit Plus."
77 },
78 {
79 "name": "health profile",
80 "description": "A health profile contains a set of health questions and answers for a patient."
81 },
82 {
83 "name": "health profile answer",
84 "description": "A health profile answer is the answer to a question for a patient."
85 },
86 {
87 "name": "health profile question",
88 "description": "A health profile question contains a health question and the corresponding answer for a patient."
89 },
90 {
91 "name": "health question definition",
92 "description": "A health question definition specifies a health question and the corresponding answer choices."
93 },
94 {
95 "name": "metric",
96 "description": "A metric is a quantitative result for a patient. For example, vital signs, lab results, etc. are all metrics."
97 },
98 {
99 "name": "patient",
100 "description": "A patient is the core user of Fitbit Plus."
101 },
102 {
103 "name": "plan",
104 "description": "A plan is the set of actions and associated goals for a patient."
105 },
106 {
107 "name": "reward",
108 "description": "A reward allocates a portion of the budget from the reward program activation for achieving a particular goal and sets a target date."
109 },
110 {
111 "name": "reward earning",
112 "description": "A reward earning specifies the portion of a reward that was earned and at what date."
113 },
114 {
115 "name": "reward earning fulfillment",
116 "description": "A reward earning fulfillment specifies the portion of a reward earning that was fulfilled and at what date."
117 },
118 {
119 "name": "reward program activation",
120 "description": "A reward program activation is the activation of a reward program for a specific patient."
121 }
122 ],
123 "x-tagGroups": [
124 {
125 "name": "Authentication (oauth)",
126 "tags": [
127 "oauth"
128 ]
129 },
130 {
131 "name": "Admin",
132 "tags": [
133 "organization",
134 "group",
135 "coach",
136 "reward program"
137 ]
138 },
139 {
140 "name": "Patient Data",
141 "tags": [
142 "action",
143 "bundle",
144 "calendar event",
145 "calendar event response",
146 "email history",
147 "health profile",
148 "health profile answer",
149 "health profile question",
150 "health question definition",
151 "metric",
152 "patient",
153 "plan",
154 "reward",
155 "reward earning",
156 "reward earning fulfillment",
157 "reward program activation"
158 ]
159 }
160 ],
161 "paths": {
162 "/oauth/token": {
163 "post": {
164 "tags": [
165 "oauth"
166 ],
167 "summary": "Create an oauth token",
168 "description": "Create an OAuth 2.0 Bearer token. A valid bearer token is required for all other API requests.\n\nBe sure to set the header `Content-Type: \"application/vnd.api+json\"`. Otherwise, you will get an error\n403 Forbidden. Using `Content-Type: \"application/json\"` is permitted (to support older oauth clients) but when\nusing `application/json` the body should have a body in the following format instead of nesting under\n`data.attributes`:\n```\n{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"95c78ab2-167f-40b8-8bec-8398d4b87454\",\n \"client_secret\": \"35d18dc9-a3dd-4948-b787-063a490b9354\"\n}\n```\n",
169 "operationId": "createToken",
170 "consumes": [
171 "application/vnd.api+json",
172 "application/json"
173 ],
174 "parameters": [
175 {
176 "name": "include",
177 "description": "List of related resources to include in the response",
178 "in": "query",
179 "required": false,
180 "type": "string",
181 "enum": [
182 "groups",
183 "organization"
184 ]
185 },
186 {
187 "name": "body",
188 "in": "body",
189 "required": true,
190 "schema": {
191 "$ref": "#/definitions/CreateTokenRequest"
192 }
193 }
194 ],
195 "responses": {
196 "201": {
197 "description": "Created",
198 "schema": {
199 "$ref": "#/definitions/CreateTokenResponse"
200 }
201 },
202 "401": {
203 "description": "Unauthorized",
204 "schema": {
205 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
206 }
207 },
208 "403": {
209 "description": "Forbidden",
210 "schema": {
211 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
212 }
213 },
214 "409": {
215 "description": "Invalid Request",
216 "schema": {
217 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
218 }
219 }
220 },
221 "security": [
222 {
223 "OAuth2": [
224 "group",
225 "organization"
226 ]
227 }
228 ]
229 }
230 },
231 "/oauth/token/{id}/groups": {
232 "get": {
233 "tags": [
234 "oauth"
235 ],
236 "summary": "Get the groups for a token",
237 "description": "Get the list of groups a token can be used to access.",
238 "operationId": "fetchTokenGroups",
239 "parameters": [
240 {
241 "name": "id",
242 "in": "path",
243 "description": "Token identifier",
244 "required": true,
245 "type": "string"
246 }
247 ],
248 "responses": {
249 "200": {
250 "description": "OK",
251 "schema": {
252 "$ref": "#/definitions/FetchGroupsResponse"
253 }
254 },
255 "401": {
256 "description": "Unauthorized",
257 "schema": {
258 "$ref": "#/definitions/FetchErrorResponse"
259 }
260 },
261 "403": {
262 "description": "Forbidden",
263 "schema": {
264 "$ref": "#/definitions/FetchErrorResponse"
265 }
266 }
267 },
268 "security": [
269 {
270 "OAuth2": [
271 "group",
272 "organization"
273 ]
274 }
275 ]
276 }
277 },
278 "/oauth/token/{id}/organization": {
279 "get": {
280 "tags": [
281 "oauth"
282 ],
283 "summary": "Get the organization for a token",
284 "description": "Get the organization a token can be used to access.",
285 "operationId": "fetchTokenOrganization",
286 "parameters": [
287 {
288 "name": "id",
289 "in": "path",
290 "description": "Token identifier",
291 "required": true,
292 "type": "string"
293 }
294 ],
295 "responses": {
296 "200": {
297 "description": "OK",
298 "schema": {
299 "$ref": "#/definitions/FetchOrganizationResponse"
300 }
301 },
302 "401": {
303 "description": "Unauthorized",
304 "schema": {
305 "$ref": "#/definitions/FetchErrorResponse"
306 }
307 },
308 "403": {
309 "description": "Forbidden",
310 "schema": {
311 "$ref": "#/definitions/FetchErrorResponse"
312 }
313 }
314 }
315 }
316 },
317 "/organization/{id}": {
318 "get": {
319 "tags": [
320 "organization"
321 ],
322 "summary": "Get an organization",
323 "description": "Get an organization record by id.",
324 "operationId": "fetchOrganization",
325 "parameters": [
326 {
327 "name": "id",
328 "in": "path",
329 "description": "Organization identifier",
330 "required": true,
331 "type": "string"
332 }
333 ],
334 "responses": {
335 "200": {
336 "description": "OK",
337 "schema": {
338 "$ref": "#/definitions/FetchOrganizationResponse"
339 }
340 },
341 "401": {
342 "description": "Unauthorized",
343 "schema": {
344 "$ref": "#/definitions/FetchErrorResponse"
345 }
346 },
347 "403": {
348 "description": "Forbidden",
349 "schema": {
350 "$ref": "#/definitions/FetchErrorResponse"
351 }
352 }
353 }
354 }
355 },
356 "/group": {
357 "post": {
358 "tags": [
359 "group"
360 ],
361 "summary": "Create a group",
362 "description": "Create a group record.",
363 "operationId": "createGroup",
364 "parameters": [
365 {
366 "name": "body",
367 "in": "body",
368 "required": true,
369 "schema": {
370 "$ref": "#/definitions/CreateGroupRequest"
371 }
372 }
373 ],
374 "responses": {
375 "201": {
376 "description": "Created",
377 "schema": {
378 "$ref": "#/definitions/CreateGroupResponse"
379 }
380 },
381 "401": {
382 "description": "Unauthorized",
383 "schema": {
384 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
385 }
386 },
387 "403": {
388 "description": "Forbidden",
389 "schema": {
390 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
391 }
392 },
393 "409": {
394 "description": "Invalid Request",
395 "schema": {
396 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
397 }
398 }
399 }
400 },
401 "get": {
402 "tags": [
403 "group"
404 ],
405 "summary": "List groups",
406 "description": "Get a list of groups matching the specified filters.",
407 "operationId": "fetchGroups",
408 "parameters": [
409 {
410 "name": "filter[organization]",
411 "in": "query",
412 "description": "Organization identifier",
413 "required": true,
414 "type": "string"
415 },
416 {
417 "name": "filter[name]",
418 "in": "query",
419 "description": "Group name",
420 "required": false,
421 "type": "string"
422 }
423 ],
424 "responses": {
425 "200": {
426 "description": "OK",
427 "schema": {
428 "$ref": "#/definitions/FetchGroupsResponse"
429 }
430 },
431 "401": {
432 "description": "Unauthorized",
433 "schema": {
434 "$ref": "#/definitions/FetchErrorResponse"
435 }
436 },
437 "403": {
438 "description": "Forbidden",
439 "schema": {
440 "$ref": "#/definitions/FetchErrorResponse"
441 }
442 }
443 }
444 }
445 },
446 "/group/{id}": {
447 "get": {
448 "tags": [
449 "group"
450 ],
451 "summary": "Get a group",
452 "description": "Get a group record by id.",
453 "operationId": "fetchGroup",
454 "parameters": [
455 {
456 "name": "id",
457 "in": "path",
458 "description": "Group identifier",
459 "required": true,
460 "type": "string"
461 }
462 ],
463 "responses": {
464 "200": {
465 "description": "OK",
466 "schema": {
467 "$ref": "#/definitions/FetchGroupResponse"
468 }
469 },
470 "401": {
471 "description": "Unauthorized",
472 "schema": {
473 "$ref": "#/definitions/FetchErrorResponse"
474 }
475 },
476 "403": {
477 "description": "Forbidden",
478 "schema": {
479 "$ref": "#/definitions/FetchErrorResponse"
480 }
481 }
482 }
483 }
484 },
485 "/coach/{id}": {
486 "get": {
487 "tags": [
488 "coach"
489 ],
490 "summary": "Get a coach",
491 "description": "Get a coach record by id.",
492 "operationId": "fetchCoach",
493 "parameters": [
494 {
495 "name": "id",
496 "in": "path",
497 "description": "Coach identifier",
498 "required": true,
499 "type": "string"
500 }
501 ],
502 "responses": {
503 "200": {
504 "description": "OK",
505 "schema": {
506 "$ref": "#/definitions/FetchCoachResponse"
507 }
508 },
509 "401": {
510 "description": "Unauthorized",
511 "schema": {
512 "$ref": "#/definitions/FetchErrorResponse"
513 }
514 },
515 "403": {
516 "description": "Forbidden",
517 "schema": {
518 "$ref": "#/definitions/FetchErrorResponse"
519 }
520 }
521 }
522 }
523 },
524 "/reward_program": {
525 "post": {
526 "tags": [
527 "reward program"
528 ],
529 "summary": "Create a reward program",
530 "description": "Create a reward program for a group.",
531 "operationId": "createRewardProgram",
532 "parameters": [
533 {
534 "name": "body",
535 "in": "body",
536 "required": true,
537 "schema": {
538 "$ref": "#/definitions/CreateRewardProgramRequest"
539 }
540 }
541 ],
542 "responses": {
543 "200": {
544 "description": "OK",
545 "schema": {
546 "$ref": "#/definitions/CreateRewardProgramResponse"
547 }
548 },
549 "401": {
550 "description": "Unauthorized",
551 "schema": {
552 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
553 }
554 },
555 "403": {
556 "description": "Forbidden",
557 "schema": {
558 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
559 }
560 },
561 "409": {
562 "description": "Invalid Request",
563 "schema": {
564 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
565 }
566 }
567 }
568 },
569 "get": {
570 "tags": [
571 "reward program"
572 ],
573 "summary": "List reward programs",
574 "description": "Get a list of reward programs matching the specified filters.",
575 "operationId": "fetchRewardPrograms",
576 "parameters": [
577 {
578 "name": "filter[groups]",
579 "in": "query",
580 "description": "Comma-separated list of group identifiers",
581 "required": true,
582 "type": "string"
583 }
584 ],
585 "responses": {
586 "200": {
587 "description": "OK",
588 "schema": {
589 "$ref": "#/definitions/FetchRewardProgramsResponse"
590 }
591 },
592 "401": {
593 "description": "Unauthorized",
594 "schema": {
595 "$ref": "#/definitions/FetchErrorResponse"
596 }
597 },
598 "403": {
599 "description": "Forbidden",
600 "schema": {
601 "$ref": "#/definitions/FetchErrorResponse"
602 }
603 }
604 }
605 }
606 },
607 "/reward_program/{id}": {
608 "get": {
609 "tags": [
610 "reward program"
611 ],
612 "summary": "Get a reward program",
613 "description": "Get a reward program record by id.",
614 "operationId": "fetchRewardProgram",
615 "parameters": [
616 {
617 "name": "id",
618 "in": "path",
619 "description": "Reward program identifier",
620 "required": true,
621 "type": "string"
622 }
623 ],
624 "responses": {
625 "200": {
626 "description": "OK",
627 "schema": {
628 "$ref": "#/definitions/FetchRewardProgramResponse"
629 }
630 },
631 "401": {
632 "description": "Unauthorized",
633 "schema": {
634 "$ref": "#/definitions/FetchErrorResponse"
635 }
636 },
637 "403": {
638 "description": "Forbidden",
639 "schema": {
640 "$ref": "#/definitions/FetchErrorResponse"
641 }
642 }
643 }
644 }
645 },
646 "/reward_program/{id}/group": {
647 "get": {
648 "tags": [
649 "reward program"
650 ],
651 "summary": "Get group for a reward program",
652 "description": "Get the group related to a reward program.",
653 "operationId": "fetchRewardProgramGroup",
654 "parameters": [
655 {
656 "name": "id",
657 "in": "path",
658 "description": "Reward program identifier",
659 "required": true,
660 "type": "string"
661 }
662 ],
663 "responses": {
664 "200": {
665 "description": "OK",
666 "schema": {
667 "$ref": "#/definitions/FetchGroupsResponse"
668 }
669 },
670 "401": {
671 "description": "Unauthorized",
672 "schema": {
673 "$ref": "#/definitions/FetchErrorResponse"
674 }
675 },
676 "403": {
677 "description": "Forbidden",
678 "schema": {
679 "$ref": "#/definitions/FetchErrorResponse"
680 }
681 }
682 }
683 }
684 },
685 "/action": {
686 "post": {
687 "tags": [
688 "action"
689 ],
690 "summary": "Create action",
691 "description": "Create a plan action",
692 "operationId": "createAction",
693 "parameters": [
694 {
695 "name": "body",
696 "in": "body",
697 "required": true,
698 "schema": {
699 "$ref": "#/definitions/CreateActionRequest"
700 }
701 }
702 ],
703 "responses": {
704 "201": {
705 "description": "OK",
706 "schema": {
707 "$ref": "#/definitions/CreateActionResponse"
708 }
709 },
710 "401": {
711 "description": "Unauthorized",
712 "schema": {
713 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
714 }
715 },
716 "403": {
717 "description": "Forbidden",
718 "schema": {
719 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
720 }
721 },
722 "409": {
723 "description": "Invalid Request",
724 "schema": {
725 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
726 }
727 }
728 }
729 }
730 },
731 "/action/{id}": {
732 "get": {
733 "tags": [
734 "action"
735 ],
736 "summary": "Get an action",
737 "description": "Get a health action from a patient's plan.",
738 "operationId": "fetchAction",
739 "parameters": [
740 {
741 "name": "id",
742 "in": "path",
743 "description": "Action identifier",
744 "required": true,
745 "type": "string"
746 }
747 ],
748 "responses": {
749 "200": {
750 "description": "OK",
751 "schema": {
752 "$ref": "#/definitions/FetchActionResponse"
753 }
754 },
755 "401": {
756 "description": "Unauthorized",
757 "schema": {
758 "$ref": "#/definitions/FetchErrorResponse"
759 }
760 },
761 "403": {
762 "description": "Forbidden",
763 "schema": {
764 "$ref": "#/definitions/FetchErrorResponse"
765 }
766 }
767 }
768 },
769 "patch": {
770 "tags": [
771 "action"
772 ],
773 "summary": "Update an action",
774 "description": "Update a health action from a patient's plan.",
775 "operationId": "updateAction",
776 "parameters": [
777 {
778 "name": "id",
779 "in": "path",
780 "description": "Action identifier",
781 "required": true,
782 "type": "string"
783 },
784 {
785 "name": "body",
786 "in": "body",
787 "required": true,
788 "schema": {
789 "$ref": "#/definitions/UpdateActionRequest"
790 }
791 }
792 ],
793 "responses": {
794 "200": {
795 "description": "OK",
796 "schema": {
797 "$ref": "#/definitions/UpdateActionResponse"
798 }
799 },
800 "401": {
801 "description": "Unauthorized",
802 "schema": {
803 "$ref": "#/definitions/FetchErrorResponse"
804 }
805 },
806 "403": {
807 "description": "Forbidden",
808 "schema": {
809 "$ref": "#/definitions/FetchErrorResponse"
810 }
811 },
812 "409": {
813 "description": "Invalid Request",
814 "schema": {
815 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
816 }
817 }
818 }
819 }
820 },
821 "/bundle": {
822 "post": {
823 "tags": [
824 "bundle"
825 ],
826 "summary": "Create bundle",
827 "description": "Create a bundle in a patient's plan",
828 "operationId": "createBundle",
829 "parameters": [
830 {
831 "name": "body",
832 "in": "body",
833 "required": true,
834 "schema": {
835 "$ref": "#/definitions/CreateBundleRequest"
836 }
837 }
838 ],
839 "responses": {
840 "200": {
841 "description": "OK",
842 "schema": {
843 "$ref": "#/definitions/CreateBundleResponse"
844 }
845 },
846 "401": {
847 "description": "Unauthorized",
848 "schema": {
849 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
850 }
851 },
852 "403": {
853 "description": "Forbidden",
854 "schema": {
855 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
856 }
857 },
858 "409": {
859 "description": "Invalid Request",
860 "schema": {
861 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
862 }
863 }
864 }
865 }
866 },
867 "/bundle/{id}": {
868 "get": {
869 "tags": [
870 "bundle"
871 ],
872 "summary": "Get a bundle",
873 "description": "Get a bundle from a patient's plan.",
874 "operationId": "fetchBundle",
875 "parameters": [
876 {
877 "name": "id",
878 "in": "path",
879 "description": "Bundle identifier",
880 "required": true,
881 "type": "string"
882 }
883 ],
884 "responses": {
885 "200": {
886 "description": "OK",
887 "schema": {
888 "$ref": "#/definitions/FetchBundleResponse"
889 }
890 },
891 "401": {
892 "description": "Unauthorized",
893 "schema": {
894 "$ref": "#/definitions/FetchErrorResponse"
895 }
896 },
897 "403": {
898 "description": "Forbidden",
899 "schema": {
900 "$ref": "#/definitions/FetchErrorResponse"
901 }
902 }
903 }
904 },
905 "patch": {
906 "tags": [
907 "bundle"
908 ],
909 "summary": "Update a bundle",
910 "description": "Updte a bundle from a patient's plan.",
911 "operationId": "updateBundle",
912 "parameters": [
913 {
914 "name": "id",
915 "in": "path",
916 "description": "Bundle identifier",
917 "required": true,
918 "type": "string"
919 },
920 {
921 "name": "body",
922 "in": "body",
923 "required": true,
924 "schema": {
925 "$ref": "#/definitions/UpdateBundleRequest"
926 }
927 }
928 ],
929 "responses": {
930 "200": {
931 "description": "OK",
932 "schema": {
933 "$ref": "#/definitions/UpdateBundleResponse"
934 }
935 },
936 "401": {
937 "description": "Unauthorized",
938 "schema": {
939 "$ref": "#/definitions/FetchErrorResponse"
940 }
941 },
942 "403": {
943 "description": "Forbidden",
944 "schema": {
945 "$ref": "#/definitions/FetchErrorResponse"
946 }
947 },
948 "409": {
949 "description": "Invalid Request",
950 "schema": {
951 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
952 }
953 }
954 }
955 }
956 },
957 "/calendar_event": {
958 "post": {
959 "tags": [
960 "calendar event"
961 ],
962 "summary": "Create calendar event",
963 "description": "Create a calendar event for a patient. Attribute `all_day` must be set to `true` and `end_at` cannot be set for `plan-check-in` event type.",
964 "operationId": "createCalendarEvent",
965 "parameters": [
966 {
967 "name": "body",
968 "in": "body",
969 "required": true,
970 "schema": {
971 "$ref": "#/definitions/CreateCalendarEventRequest"
972 }
973 }
974 ],
975 "responses": {
976 "201": {
977 "description": "OK",
978 "schema": {
979 "$ref": "#/definitions/CreateCalendarEventResponse"
980 }
981 },
982 "401": {
983 "description": "Unauthorized",
984 "schema": {
985 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
986 }
987 },
988 "403": {
989 "description": "Forbidden",
990 "schema": {
991 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
992 }
993 },
994 "409": {
995 "description": "Invalid Request",
996 "schema": {
997 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
998 }
999 }
1000 }
1001 },
1002 "get": {
1003 "tags": [
1004 "calendar event"
1005 ],
1006 "summary": "List calendar events",
1007 "description": "Get a list of calendar events",
1008 "operationId": "fetchCalendarEvents",
1009 "parameters": [
1010 {
1011 "name": "filter[patient]",
1012 "in": "query",
1013 "type": "string",
1014 "description": "Patient id to fetch calendar event. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, `filter[organization]`, or `filter[attendees]`.\n"
1015 },
1016 {
1017 "name": "filter[groups]",
1018 "in": "query",
1019 "type": "string",
1020 "description": "Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, `filter[organization]`, or `filter[attendees]`.\n"
1021 },
1022 {
1023 "name": "filter[organization]",
1024 "in": "query",
1025 "type": "string",
1026 "description": "Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, `filter[organization]`, or `filter[attendees]`.\n"
1027 },
1028 {
1029 "name": "filter[attendees]",
1030 "in": "query",
1031 "type": "string",
1032 "description": "Comma-separated list of coach or patient ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, `filter[organization]`, or `filter[attendees]`.\n"
1033 },
1034 {
1035 "name": "filter[type]",
1036 "in": "query",
1037 "type": "string",
1038 "description": "Calendar event type",
1039 "enum": [
1040 "plan-check-in",
1041 "reminder",
1042 "telephone-call",
1043 "office-visit",
1044 "video-call"
1045 ]
1046 },
1047 {
1048 "name": "filter[completed]",
1049 "in": "query",
1050 "type": "boolean",
1051 "description": "If not specified, return all calendar events. If set to `true` return only events marked as completed, if set to `false`, return only events not marked as completed yet."
1052 },
1053 {
1054 "name": "filter[start_at]",
1055 "in": "query",
1056 "type": "string",
1057 "description": "The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for events starting in November 2017 (America/New_York): `filter[start_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00`\n"
1058 },
1059 {
1060 "name": "filter[end_at]",
1061 "in": "query",
1062 "type": "string",
1063 "description": "The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for events ending in November 2017 (America/New_York): `filter[end_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00`\n"
1064 },
1065 {
1066 "name": "filter[completed_at]",
1067 "in": "query",
1068 "type": "string",
1069 "description": "The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for events completed in November 2017 (America/New_York): `filter[completed_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00`\n"
1070 },
1071 {
1072 "name": "filter[created_at]",
1073 "in": "query",
1074 "type": "string",
1075 "description": "The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for events created in November 2017 (America/New_York): `filter[created_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00`\n"
1076 },
1077 {
1078 "name": "filter[updated_at]",
1079 "in": "query",
1080 "type": "string",
1081 "description": "The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for events updated in November 2017 (America/New_York): `filter[updated_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00`\n"
1082 },
1083 {
1084 "name": "page[number]",
1085 "in": "query",
1086 "description": "Page number",
1087 "required": false,
1088 "type": "integer",
1089 "default": 1
1090 },
1091 {
1092 "name": "page[size]",
1093 "in": "query",
1094 "description": "Page size",
1095 "required": false,
1096 "type": "integer",
1097 "default": 10,
1098 "minimum": 0,
1099 "maximum": 50
1100 },
1101 {
1102 "name": "page[limit]",
1103 "in": "query",
1104 "description": "Page limit",
1105 "type": "integer",
1106 "required": false,
1107 "default": 50,
1108 "minimum": 0
1109 },
1110 {
1111 "name": "page[cursor]",
1112 "in": "query",
1113 "description": "Page cursor",
1114 "type": "string",
1115 "required": false
1116 },
1117 {
1118 "name": "include",
1119 "description": "List of related resources to include in the response",
1120 "in": "query",
1121 "required": false,
1122 "type": "string",
1123 "enum": [
1124 "owner"
1125 ]
1126 }
1127 ],
1128 "responses": {
1129 "200": {
1130 "description": "OK",
1131 "schema": {
1132 "$ref": "#/definitions/FetchCalendarEventsResponse"
1133 }
1134 },
1135 "401": {
1136 "description": "Unauthorized",
1137 "schema": {
1138 "$ref": "#/definitions/FetchErrorResponse"
1139 }
1140 },
1141 "403": {
1142 "description": "Forbidden",
1143 "schema": {
1144 "$ref": "#/definitions/FetchErrorResponse"
1145 }
1146 },
1147 "409": {
1148 "description": "Invalid Request",
1149 "schema": {
1150 "$ref": "#/definitions/FetchErrorResponse"
1151 }
1152 }
1153 }
1154 }
1155 },
1156 "/calendar_event/{id}": {
1157 "get": {
1158 "tags": [
1159 "calendar event"
1160 ],
1161 "summary": "Get a calendar event",
1162 "description": "Get a calendar event by id",
1163 "operationId": "fetchCalendarEvent",
1164 "parameters": [
1165 {
1166 "name": "id",
1167 "in": "path",
1168 "description": "Calendar event identifier",
1169 "required": true,
1170 "type": "string"
1171 }
1172 ],
1173 "responses": {
1174 "200": {
1175 "description": "OK",
1176 "schema": {
1177 "$ref": "#/definitions/FetchCalendarEventResponse"
1178 }
1179 },
1180 "401": {
1181 "description": "Unauthorized",
1182 "schema": {
1183 "$ref": "#/definitions/FetchErrorResponse"
1184 }
1185 },
1186 "403": {
1187 "description": "Forbidden",
1188 "schema": {
1189 "$ref": "#/definitions/FetchErrorResponse"
1190 }
1191 }
1192 }
1193 },
1194 "patch": {
1195 "tags": [
1196 "calendar event"
1197 ],
1198 "summary": "Update a calendar event",
1199 "description": "Update a calendar event for a patient. Attribute `all_day` must be true and `end_at` cannot be specified for `plan-check-in` event type. To mark a calendar event as 'completed', set `completed_at` and `completed_by` to desired values. To mark a completed calendar event as 'not completed', set `completed_at` and `completed_by` to `null`. Attendees can be added or removed, but response status cannot be updated. Use the calendar event response api for response status updates instead.",
1200 "operationId": "updateCalendarEvent",
1201 "parameters": [
1202 {
1203 "name": "id",
1204 "in": "path",
1205 "description": "Calendar event identifier",
1206 "required": true,
1207 "type": "string"
1208 },
1209 {
1210 "name": "body",
1211 "in": "body",
1212 "required": true,
1213 "schema": {
1214 "$ref": "#/definitions/UpdateCalendarEventRequest"
1215 }
1216 }
1217 ],
1218 "responses": {
1219 "200": {
1220 "description": "OK",
1221 "schema": {
1222 "$ref": "#/definitions/UpdateCalendarEventResponse"
1223 }
1224 },
1225 "401": {
1226 "description": "Unauthorized",
1227 "schema": {
1228 "$ref": "#/definitions/FetchErrorResponse"
1229 }
1230 },
1231 "403": {
1232 "description": "Forbidden",
1233 "schema": {
1234 "$ref": "#/definitions/FetchErrorResponse"
1235 }
1236 },
1237 "409": {
1238 "description": "Invalid Request",
1239 "schema": {
1240 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
1241 }
1242 }
1243 }
1244 },
1245 "delete": {
1246 "tags": [
1247 "calendar event"
1248 ],
1249 "summary": "Delete a calendar event",
1250 "description": "Delete a calendar event by id",
1251 "operationId": "deleteCalendarEvent",
1252 "parameters": [
1253 {
1254 "name": "id",
1255 "in": "path",
1256 "description": "Calendar event identifier",
1257 "required": true,
1258 "type": "string"
1259 }
1260 ],
1261 "responses": {
1262 "200": {
1263 "description": "OK"
1264 },
1265 "401": {
1266 "description": "Unauthorized",
1267 "schema": {
1268 "$ref": "#/definitions/FetchErrorResponse"
1269 }
1270 },
1271 "403": {
1272 "description": "Forbidden",
1273 "schema": {
1274 "$ref": "#/definitions/FetchErrorResponse"
1275 }
1276 }
1277 }
1278 }
1279 },
1280 "/calendar_event_response": {
1281 "post": {
1282 "tags": [
1283 "calendar event response"
1284 ],
1285 "summary": "Create calendar event response",
1286 "description": "Create a calendar event response for an attendee of a calendar event, the attendee can be a coach or patient. Calendar event responses cannot be fetched, updated nor deleted. Use calendar event api to fetch the response status for attendees.",
1287 "operationId": "createCalendarEventResponse",
1288 "parameters": [
1289 {
1290 "name": "body",
1291 "in": "body",
1292 "required": true,
1293 "schema": {
1294 "$ref": "#/definitions/CreateCalendarEventResponseRequest"
1295 }
1296 }
1297 ],
1298 "responses": {
1299 "201": {
1300 "description": "OK",
1301 "schema": {
1302 "$ref": "#/definitions/CreateCalendarEventResponseRequest"
1303 }
1304 },
1305 "401": {
1306 "description": "Unauthorized",
1307 "schema": {
1308 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
1309 }
1310 },
1311 "403": {
1312 "description": "Forbidden",
1313 "schema": {
1314 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
1315 }
1316 },
1317 "409": {
1318 "description": "Invalid Request",
1319 "schema": {
1320 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
1321 }
1322 }
1323 }
1324 }
1325 },
1326 "/email_history": {
1327 "get": {
1328 "tags": [
1329 "email history"
1330 ],
1331 "summary": "List email histories",
1332 "description": "Get a list of email histories",
1333 "operationId": "fetchEmailHistories",
1334 "parameters": [
1335 {
1336 "name": "filter[receiver]",
1337 "in": "query",
1338 "type": "string",
1339 "description": "Fitbit Plus user id of email recipient. Required if filter[sender] is not defined."
1340 },
1341 {
1342 "name": "filter[sender]",
1343 "in": "query",
1344 "type": "string",
1345 "description": "Fitbit Plus user id of email sender. Required if filter[receiver] is not defined."
1346 },
1347 {
1348 "name": "filter[emailType]",
1349 "in": "query",
1350 "type": "string",
1351 "description": "Type of email"
1352 },
1353 {
1354 "name": "sort",
1355 "in": "query",
1356 "description": "valid sorts:\n * send_time - ascending by send_time\n * -send_time - descending by send_time\n",
1357 "type": "string",
1358 "enum": [
1359 "send_time",
1360 "-send_time"
1361 ]
1362 }
1363 ],
1364 "responses": {
1365 "200": {
1366 "description": "OK",
1367 "schema": {
1368 "$ref": "#/definitions/FetchEmailHistoriesResponse"
1369 }
1370 },
1371 "401": {
1372 "description": "Unauthorized",
1373 "schema": {
1374 "$ref": "#/definitions/FetchErrorResponse"
1375 }
1376 },
1377 "403": {
1378 "description": "Forbidden",
1379 "schema": {
1380 "$ref": "#/definitions/FetchErrorResponse"
1381 }
1382 },
1383 "409": {
1384 "description": "Invalid Request",
1385 "schema": {
1386 "$ref": "#/definitions/FetchErrorResponse"
1387 }
1388 }
1389 }
1390 }
1391 },
1392 "/email_history/{id}": {
1393 "get": {
1394 "tags": [
1395 "email history"
1396 ],
1397 "summary": "Get an email history",
1398 "description": "Get an email history by id",
1399 "operationId": "fetchEmailHistory",
1400 "parameters": [
1401 {
1402 "name": "id",
1403 "in": "path",
1404 "description": "Email history identifier",
1405 "required": true,
1406 "type": "string"
1407 }
1408 ],
1409 "responses": {
1410 "200": {
1411 "description": "OK",
1412 "schema": {
1413 "$ref": "#/definitions/FetchEmailHistoryResponse"
1414 }
1415 },
1416 "401": {
1417 "description": "Unauthorized",
1418 "schema": {
1419 "$ref": "#/definitions/FetchErrorResponse"
1420 }
1421 },
1422 "403": {
1423 "description": "Forbidden",
1424 "schema": {
1425 "$ref": "#/definitions/FetchErrorResponse"
1426 }
1427 }
1428 }
1429 }
1430 },
1431 "/health_profile": {
1432 "get": {
1433 "tags": [
1434 "health profile"
1435 ],
1436 "summary": "List health profiles",
1437 "description": "Get a list of health profiles",
1438 "operationId": "fetchHealthProfiles",
1439 "parameters": [
1440 {
1441 "name": "filter[patient]",
1442 "in": "query",
1443 "type": "string",
1444 "description": "Patient id to fetch health profile. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`.\n"
1445 },
1446 {
1447 "name": "filter[groups]",
1448 "in": "query",
1449 "type": "string",
1450 "description": "Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`.\n"
1451 },
1452 {
1453 "name": "filter[organization]",
1454 "in": "query",
1455 "type": "string",
1456 "description": "Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`.\n"
1457 },
1458 {
1459 "name": "page[number]",
1460 "in": "query",
1461 "description": "Page number",
1462 "required": false,
1463 "type": "integer",
1464 "default": 1
1465 },
1466 {
1467 "name": "page[size]",
1468 "in": "query",
1469 "description": "Page size",
1470 "required": false,
1471 "type": "integer",
1472 "default": 10,
1473 "minimum": 0,
1474 "maximum": 50
1475 },
1476 {
1477 "name": "page[limit]",
1478 "in": "query",
1479 "description": "Page limit",
1480 "type": "integer",
1481 "required": false,
1482 "default": 50,
1483 "minimum": 0
1484 },
1485 {
1486 "name": "page[cursor]",
1487 "in": "query",
1488 "description": "Page cursor",
1489 "type": "string",
1490 "required": false
1491 },
1492 {
1493 "name": "include",
1494 "description": "List of related resources to include in the response",
1495 "in": "query",
1496 "required": false,
1497 "type": "string",
1498 "enum": [
1499 "patient",
1500 "questions"
1501 ]
1502 }
1503 ],
1504 "responses": {
1505 "200": {
1506 "description": "OK",
1507 "schema": {
1508 "$ref": "#/definitions/FetchHealthProfilesResponse"
1509 }
1510 },
1511 "401": {
1512 "description": "Unauthorized",
1513 "schema": {
1514 "$ref": "#/definitions/FetchErrorResponse"
1515 }
1516 },
1517 "403": {
1518 "description": "Forbidden",
1519 "schema": {
1520 "$ref": "#/definitions/FetchErrorResponse"
1521 }
1522 },
1523 "409": {
1524 "description": "Invalid Request",
1525 "schema": {
1526 "$ref": "#/definitions/FetchErrorResponse"
1527 }
1528 }
1529 }
1530 }
1531 },
1532 "/health_profile/{id}": {
1533 "get": {
1534 "tags": [
1535 "health profile"
1536 ],
1537 "summary": "Get a health profile",
1538 "description": "Get a health profile by id",
1539 "operationId": "fetchHealthProfile",
1540 "parameters": [
1541 {
1542 "name": "id",
1543 "in": "path",
1544 "description": "Health profile identifier",
1545 "required": true,
1546 "type": "string"
1547 },
1548 {
1549 "name": "include",
1550 "description": "List of related resources to include in the response",
1551 "in": "query",
1552 "required": false,
1553 "type": "string",
1554 "enum": [
1555 "patient",
1556 "questions"
1557 ]
1558 }
1559 ],
1560 "responses": {
1561 "200": {
1562 "description": "OK",
1563 "schema": {
1564 "$ref": "#/definitions/FetchHealthProfileResponse"
1565 }
1566 },
1567 "401": {
1568 "description": "Unauthorized",
1569 "schema": {
1570 "$ref": "#/definitions/FetchErrorResponse"
1571 }
1572 },
1573 "403": {
1574 "description": "Forbidden",
1575 "schema": {
1576 "$ref": "#/definitions/FetchErrorResponse"
1577 }
1578 }
1579 }
1580 }
1581 },
1582 "/health_profile_question/{id}": {
1583 "get": {
1584 "tags": [
1585 "health profile question"
1586 ],
1587 "summary": "Get a health profile question",
1588 "description": "Get a health profile by id",
1589 "operationId": "fetchHealthProfileQuestion",
1590 "parameters": [
1591 {
1592 "name": "id",
1593 "in": "path",
1594 "description": "Health profile question identifier",
1595 "required": true,
1596 "type": "string"
1597 },
1598 {
1599 "name": "include",
1600 "description": "List of related resources to include in the response",
1601 "in": "query",
1602 "required": false,
1603 "type": "string",
1604 "enum": [
1605 "question_definition",
1606 "answer"
1607 ]
1608 }
1609 ],
1610 "responses": {
1611 "200": {
1612 "description": "OK",
1613 "schema": {
1614 "$ref": "#/definitions/FetchHealthProfileQuestionResponse"
1615 }
1616 },
1617 "401": {
1618 "description": "Unauthorized",
1619 "schema": {
1620 "$ref": "#/definitions/FetchErrorResponse"
1621 }
1622 },
1623 "403": {
1624 "description": "Forbidden",
1625 "schema": {
1626 "$ref": "#/definitions/FetchErrorResponse"
1627 }
1628 }
1629 }
1630 }
1631 },
1632 "/health_profile_answer": {
1633 "get": {
1634 "tags": [
1635 "health profile answer"
1636 ],
1637 "summary": "List health profile answers",
1638 "description": "Get a list of health profile answers",
1639 "operationId": "fetchHealthProfileAnswers",
1640 "parameters": [
1641 {
1642 "name": "filter[patient]",
1643 "in": "query",
1644 "type": "string",
1645 "description": "Patient id to fetch healt profile answers. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`.\n"
1646 },
1647 {
1648 "name": "filter[groups]",
1649 "in": "query",
1650 "type": "string",
1651 "description": "Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`.\n"
1652 },
1653 {
1654 "name": "filter[organization]",
1655 "in": "query",
1656 "type": "string",
1657 "description": "Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`.\n"
1658 },
1659 {
1660 "name": "page[number]",
1661 "in": "query",
1662 "description": "Page number",
1663 "required": false,
1664 "type": "integer",
1665 "default": 1
1666 },
1667 {
1668 "name": "page[size]",
1669 "in": "query",
1670 "description": "Page size",
1671 "required": false,
1672 "type": "integer",
1673 "default": 50,
1674 "minimum": 0,
1675 "maximum": 100
1676 },
1677 {
1678 "name": "page[limit]",
1679 "in": "query",
1680 "description": "Page limit",
1681 "type": "integer",
1682 "required": false,
1683 "default": 50,
1684 "minimum": 0
1685 },
1686 {
1687 "name": "page[cursor]",
1688 "in": "query",
1689 "description": "Page cursor",
1690 "type": "string",
1691 "required": false
1692 },
1693 {
1694 "name": "include",
1695 "description": "List of related resources to include in the response",
1696 "in": "query",
1697 "required": false,
1698 "type": "string",
1699 "enum": [
1700 "patient"
1701 ]
1702 }
1703 ],
1704 "responses": {
1705 "200": {
1706 "description": "OK",
1707 "schema": {
1708 "$ref": "#/definitions/FetchHealthProfileAnswersResponse"
1709 }
1710 },
1711 "401": {
1712 "description": "Unauthorized",
1713 "schema": {
1714 "$ref": "#/definitions/FetchErrorResponse"
1715 }
1716 },
1717 "403": {
1718 "description": "Forbidden",
1719 "schema": {
1720 "$ref": "#/definitions/FetchErrorResponse"
1721 }
1722 },
1723 "409": {
1724 "description": "Invalid Request",
1725 "schema": {
1726 "$ref": "#/definitions/FetchErrorResponse"
1727 }
1728 }
1729 }
1730 }
1731 },
1732 "/health_profile_answer/{id}": {
1733 "get": {
1734 "tags": [
1735 "health profile answer"
1736 ],
1737 "summary": "Get a health profile answer",
1738 "description": "Get a health profile answer by id",
1739 "operationId": "fetchHealthProfileAnswer",
1740 "parameters": [
1741 {
1742 "name": "id",
1743 "in": "path",
1744 "description": "Health profile answer identifier",
1745 "required": true,
1746 "type": "string"
1747 },
1748 {
1749 "name": "include",
1750 "description": "List of related resources to include in the response",
1751 "in": "query",
1752 "required": false,
1753 "type": "string",
1754 "enum": [
1755 "patient"
1756 ]
1757 }
1758 ],
1759 "responses": {
1760 "200": {
1761 "description": "OK",
1762 "schema": {
1763 "$ref": "#/definitions/FetchHealthProfileAnswerResponse"
1764 }
1765 },
1766 "401": {
1767 "description": "Unauthorized",
1768 "schema": {
1769 "$ref": "#/definitions/FetchErrorResponse"
1770 }
1771 },
1772 "403": {
1773 "description": "Forbidden",
1774 "schema": {
1775 "$ref": "#/definitions/FetchErrorResponse"
1776 }
1777 }
1778 }
1779 }
1780 },
1781 "/health_question_definition": {
1782 "get": {
1783 "tags": [
1784 "health question definition"
1785 ],
1786 "summary": "List health question definitions",
1787 "description": "Get a list of all health question definitions",
1788 "operationId": "fetchHealthQuestionDefinitions",
1789 "responses": {
1790 "200": {
1791 "description": "OK",
1792 "schema": {
1793 "$ref": "#/definitions/FetchHealthQuestionDefinitionsResponse"
1794 }
1795 },
1796 "401": {
1797 "description": "Unauthorized",
1798 "schema": {
1799 "$ref": "#/definitions/FetchErrorResponse"
1800 }
1801 },
1802 "403": {
1803 "description": "Forbidden",
1804 "schema": {
1805 "$ref": "#/definitions/FetchErrorResponse"
1806 }
1807 },
1808 "409": {
1809 "description": "Invalid Request",
1810 "schema": {
1811 "$ref": "#/definitions/FetchErrorResponse"
1812 }
1813 }
1814 }
1815 }
1816 },
1817 "/health_question_definition/{id}": {
1818 "get": {
1819 "tags": [
1820 "health question definition"
1821 ],
1822 "summary": "Get a health question definition",
1823 "description": "Get a health question definition by id",
1824 "operationId": "fetchHealthQuestionDefinition",
1825 "parameters": [
1826 {
1827 "name": "id",
1828 "in": "path",
1829 "description": "Health question definition identifier",
1830 "required": true,
1831 "type": "string"
1832 }
1833 ],
1834 "responses": {
1835 "200": {
1836 "description": "OK",
1837 "schema": {
1838 "$ref": "#/definitions/FetchHealthQuestionDefinitionResponse"
1839 }
1840 },
1841 "401": {
1842 "description": "Unauthorized",
1843 "schema": {
1844 "$ref": "#/definitions/FetchErrorResponse"
1845 }
1846 },
1847 "403": {
1848 "description": "Forbidden",
1849 "schema": {
1850 "$ref": "#/definitions/FetchErrorResponse"
1851 }
1852 }
1853 }
1854 }
1855 },
1856 "/patient_health_metric": {
1857 "post": {
1858 "tags": [
1859 "metric"
1860 ],
1861 "summary": "Create patient health metrics",
1862 "description": "Create one or more patient health metrics.\n\nExample for creating a patient health result with a patient specified using `meta.query` instead of `id`:\n\n```JSON\n {\n \"data\": {\n \"type\": \"patient_health_metric\",\n \"attributes\": {\n \"code\": {\n \"system\": \"LOINC\",\n \"value\": \"13457-7\"\n },\n \"type\": \"ldl_cholesterol\",\n \"occurred_at\": \"2017-03-14T11:00:57.000Z\",\n \"value\": 121,\n \"unit\": \"mg/dl\"\n },\n \"relationships\": {\n \"patient\": {\n \"data\": {\n \"type\": \"patient\",\n \"meta\": {\n \"query\": {\n \"identifier\": {\n \"system\": \"medical-record-number\",\n \"value\": \"121212\"\n },\n \"organization\": \"58c4554710123c5c40dbab81\"\n }\n }\n }\n }\n }\n }\n }\n```\n",
1863 "operationId": "createPatientHealthMetric",
1864 "parameters": [
1865 {
1866 "name": "body",
1867 "in": "body",
1868 "required": true,
1869 "schema": {
1870 "$ref": "#/definitions/CreatePatientHealthMetricRequest"
1871 }
1872 }
1873 ],
1874 "responses": {
1875 "200": {
1876 "description": "OK",
1877 "schema": {
1878 "$ref": "#/definitions/CreatePatientHealthMetricResponse"
1879 }
1880 },
1881 "401": {
1882 "description": "Unauthorized",
1883 "schema": {
1884 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
1885 }
1886 },
1887 "403": {
1888 "description": "Forbidden",
1889 "schema": {
1890 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
1891 }
1892 },
1893 "409": {
1894 "description": "Invalid Request",
1895 "schema": {
1896 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
1897 }
1898 }
1899 }
1900 },
1901 "get": {
1902 "tags": [
1903 "metric"
1904 ],
1905 "summary": "List patient health metrics",
1906 "description": "Get a list of patient health metrics.",
1907 "operationId": "fetchPatientHealthMetrics",
1908 "parameters": [
1909 {
1910 "name": "filter[patient]",
1911 "in": "query",
1912 "description": "Filter the patient health metrics for a specified patient",
1913 "required": true,
1914 "type": "string"
1915 },
1916 {
1917 "name": "page[number]",
1918 "in": "query",
1919 "description": "Page number",
1920 "required": false,
1921 "type": "integer",
1922 "default": 1
1923 },
1924 {
1925 "name": "page[size]",
1926 "in": "query",
1927 "description": "Page size",
1928 "required": false,
1929 "type": "integer",
1930 "default": 10,
1931 "minimum": 0,
1932 "maximum": 50
1933 },
1934 {
1935 "name": "page[limit]",
1936 "in": "query",
1937 "description": "Page limit",
1938 "type": "integer",
1939 "required": false,
1940 "default": 50,
1941 "minimum": 0
1942 },
1943 {
1944 "name": "page[cursor]",
1945 "in": "query",
1946 "description": "Page cursor",
1947 "type": "string",
1948 "required": false
1949 }
1950 ],
1951 "responses": {
1952 "200": {
1953 "description": "OK",
1954 "schema": {
1955 "$ref": "#/definitions/FetchPatientHealthMetricResponse"
1956 }
1957 },
1958 "401": {
1959 "description": "Unauthorized",
1960 "schema": {
1961 "$ref": "#/definitions/FetchErrorResponse"
1962 }
1963 },
1964 "403": {
1965 "description": "Forbidden",
1966 "schema": {
1967 "$ref": "#/definitions/FetchErrorResponse"
1968 }
1969 },
1970 "409": {
1971 "description": "Invalid Request",
1972 "schema": {
1973 "$ref": "#/definitions/FetchErrorResponse"
1974 }
1975 }
1976 }
1977 }
1978 },
1979 "/patient_health_metric/{id}": {
1980 "get": {
1981 "tags": [
1982 "metric"
1983 ],
1984 "summary": "Get a patient health metric",
1985 "description": "Get the plan summary for a patient.",
1986 "operationId": "fetchPatientHealthMetric",
1987 "parameters": [
1988 {
1989 "name": "id",
1990 "in": "path",
1991 "description": "Patient health metric identifier",
1992 "required": true,
1993 "type": "string"
1994 }
1995 ],
1996 "responses": {
1997 "200": {
1998 "description": "OK",
1999 "schema": {
2000 "$ref": "#/definitions/FetchPatientHealthMetricResponse"
2001 }
2002 },
2003 "401": {
2004 "description": "Unauthorized",
2005 "schema": {
2006 "$ref": "#/definitions/FetchErrorResponse"
2007 }
2008 },
2009 "403": {
2010 "description": "Forbidden",
2011 "schema": {
2012 "$ref": "#/definitions/FetchErrorResponse"
2013 }
2014 }
2015 }
2016 }
2017 },
2018 "/patient": {
2019 "post": {
2020 "tags": [
2021 "patient"
2022 ],
2023 "summary": "Create a patient",
2024 "description": "Create a patient record.\n\nExample for creating a patient with a group specified using `meta.query` instead of `id`:\n\n```JSON\n{\n \"data\": {\n \"type\": \"patient\",\n \"attributes\": {\n \"first_name\": \"Andrew\",\n \"last_name\": \"Smith\"\n },\n \"relationships\": {\n \"groups\": {\n \"data\": [\n {\n \"type\": \"group\",\n \"meta\": {\n \"query\": {\n \"organization\": \"58c88de7c93eb96357a87033\",\n \"name\": \"Patients Lead\"\n }\n }\n }\n ]\n }\n }\n }\n}\n```\n",
2025 "operationId": "createPatient",
2026 "parameters": [
2027 {
2028 "name": "body",
2029 "in": "body",
2030 "required": true,
2031 "schema": {
2032 "$ref": "#/definitions/CreatePatientRequest"
2033 }
2034 }
2035 ],
2036 "responses": {
2037 "201": {
2038 "description": "Created",
2039 "schema": {
2040 "$ref": "#/definitions/CreatePatientResponse"
2041 }
2042 },
2043 "401": {
2044 "description": "Unauthorized",
2045 "schema": {
2046 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2047 }
2048 },
2049 "403": {
2050 "description": "Forbidden",
2051 "schema": {
2052 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2053 }
2054 },
2055 "409": {
2056 "description": "Invalid Request",
2057 "schema": {
2058 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2059 }
2060 }
2061 }
2062 },
2063 "get": {
2064 "tags": [
2065 "patient"
2066 ],
2067 "summary": "List patients",
2068 "description": "Get a list of patients.",
2069 "operationId": "fetchPatients",
2070 "parameters": [
2071 {
2072 "name": "filter[groups]",
2073 "in": "query",
2074 "type": "string",
2075 "description": "Comma-separated list of group ids. Note that either `filter[group]` or `filter[organization]` must be specified."
2076 },
2077 {
2078 "name": "filter[organization]",
2079 "in": "query",
2080 "type": "string",
2081 "description": "Fitbit Plus organization id. Note that either `filter[group]` or `filter[organization]` must be specified."
2082 },
2083 {
2084 "name": "filter[identifier][system]",
2085 "in": "query",
2086 "type": "string",
2087 "description": "Identifier system (example: \"MyEHR\") - requires a \"filter[identifier][value]\" parameter"
2088 },
2089 {
2090 "name": "filter[identifier][value]",
2091 "in": "query",
2092 "type": "string",
2093 "description": "Identifier value (example: \"12345\") - requires a \"filter[identifier][system]\" parameter"
2094 },
2095 {
2096 "name": "filter[archived]",
2097 "in": "query",
2098 "type": "boolean",
2099 "description": "If not specified, return all patients. If set to 'true' return only archived patients, if set to 'false', return only patients who are not archived."
2100 },
2101 {
2102 "name": "filter[created_at]",
2103 "in": "query",
2104 "type": "string",
2105 "description": "The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for patients created in November 2017 (America/New_York): `filter[created_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00`\n"
2106 },
2107 {
2108 "name": "filter[updated_at]",
2109 "in": "query",
2110 "type": "string",
2111 "description": "The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for patients updated in November 2017 (America/New_York): `filter[updated_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00`\n"
2112 },
2113 {
2114 "name": "page[number]",
2115 "in": "query",
2116 "description": "Page number",
2117 "required": false,
2118 "type": "integer",
2119 "default": 1
2120 },
2121 {
2122 "name": "page[size]",
2123 "in": "query",
2124 "description": "Page size",
2125 "required": false,
2126 "type": "integer",
2127 "default": 10,
2128 "minimum": 0,
2129 "maximum": 50
2130 },
2131 {
2132 "name": "page[limit]",
2133 "in": "query",
2134 "description": "Page limit",
2135 "type": "integer",
2136 "required": false,
2137 "default": 50,
2138 "minimum": 0
2139 },
2140 {
2141 "name": "page[cursor]",
2142 "in": "query",
2143 "description": "Page cursor",
2144 "type": "string",
2145 "required": false
2146 }
2147 ],
2148 "responses": {
2149 "200": {
2150 "description": "OK",
2151 "schema": {
2152 "$ref": "#/definitions/FetchPatientsResponse"
2153 }
2154 },
2155 "401": {
2156 "description": "Unauthorized",
2157 "schema": {
2158 "$ref": "#/definitions/FetchErrorResponse"
2159 }
2160 },
2161 "403": {
2162 "description": "Forbidden",
2163 "schema": {
2164 "$ref": "#/definitions/FetchErrorResponse"
2165 }
2166 },
2167 "409": {
2168 "description": "Invalid Request",
2169 "schema": {
2170 "$ref": "#/definitions/FetchErrorResponse"
2171 }
2172 }
2173 }
2174 },
2175 "put": {
2176 "tags": [
2177 "patient"
2178 ],
2179 "summary": "Upsert patient",
2180 "description": "Create a new patient or update an existing patient",
2181 "operationId": "upsertPatient",
2182 "parameters": [
2183 {
2184 "name": "body",
2185 "in": "body",
2186 "required": true,
2187 "schema": {
2188 "$ref": "#/definitions/UpsertPatientRequest"
2189 }
2190 }
2191 ],
2192 "responses": {
2193 "200": {
2194 "description": "OK",
2195 "schema": {
2196 "$ref": "#/definitions/CreatePatientResponse"
2197 }
2198 },
2199 "401": {
2200 "description": "Unauthorized",
2201 "schema": {
2202 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2203 }
2204 },
2205 "403": {
2206 "description": "Forbidden",
2207 "schema": {
2208 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2209 }
2210 },
2211 "409": {
2212 "description": "Invalid Request",
2213 "schema": {
2214 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2215 }
2216 }
2217 }
2218 }
2219 },
2220 "/patient/{id}": {
2221 "get": {
2222 "tags": [
2223 "patient"
2224 ],
2225 "summary": "Get a patient",
2226 "description": "Gets a patient record by id.",
2227 "operationId": "fetchPatient",
2228 "parameters": [
2229 {
2230 "name": "id",
2231 "in": "path",
2232 "description": "Patient identifier",
2233 "required": true,
2234 "type": "string"
2235 }
2236 ],
2237 "responses": {
2238 "200": {
2239 "description": "OK",
2240 "schema": {
2241 "$ref": "#/definitions/FetchPatientResponse"
2242 }
2243 },
2244 "401": {
2245 "description": "Unauthorized",
2246 "schema": {
2247 "$ref": "#/definitions/FetchErrorResponse"
2248 }
2249 },
2250 "403": {
2251 "description": "Forbidden",
2252 "schema": {
2253 "$ref": "#/definitions/FetchErrorResponse"
2254 }
2255 }
2256 }
2257 },
2258 "patch": {
2259 "tags": [
2260 "patient"
2261 ],
2262 "summary": "Update a patient",
2263 "description": "Update a patient record.",
2264 "operationId": "updatePatient",
2265 "parameters": [
2266 {
2267 "name": "id",
2268 "in": "path",
2269 "description": "Patient identifier",
2270 "required": true,
2271 "type": "string"
2272 },
2273 {
2274 "name": "body",
2275 "in": "body",
2276 "required": true,
2277 "schema": {
2278 "$ref": "#/definitions/UpdatePatientRequest"
2279 }
2280 }
2281 ],
2282 "responses": {
2283 "200": {
2284 "description": "OK",
2285 "schema": {
2286 "$ref": "#/definitions/UpdatePatientResponse"
2287 }
2288 },
2289 "401": {
2290 "description": "Unauthorized",
2291 "schema": {
2292 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2293 }
2294 },
2295 "403": {
2296 "description": "Forbidden",
2297 "schema": {
2298 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2299 }
2300 },
2301 "409": {
2302 "description": "Invalid Request",
2303 "schema": {
2304 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2305 }
2306 }
2307 }
2308 }
2309 },
2310 "/patient/{id}/groups": {
2311 "get": {
2312 "tags": [
2313 "patient"
2314 ],
2315 "summary": "List groups for a patient",
2316 "description": "Get the list of groups for a patient.",
2317 "operationId": "fetchPatientGroups",
2318 "parameters": [
2319 {
2320 "name": "id",
2321 "in": "path",
2322 "description": "Patient identifier",
2323 "required": true,
2324 "type": "string"
2325 }
2326 ],
2327 "responses": {
2328 "200": {
2329 "description": "OK",
2330 "schema": {
2331 "$ref": "#/definitions/FetchGroupsResponse"
2332 }
2333 },
2334 "401": {
2335 "description": "Unauthorized",
2336 "schema": {
2337 "$ref": "#/definitions/FetchErrorResponse"
2338 }
2339 },
2340 "403": {
2341 "description": "Forbidden",
2342 "schema": {
2343 "$ref": "#/definitions/FetchErrorResponse"
2344 }
2345 }
2346 }
2347 }
2348 },
2349 "/patient/{id}/coaches": {
2350 "get": {
2351 "tags": [
2352 "patient"
2353 ],
2354 "summary": "List coaches for a patient",
2355 "description": "Get the list of coaches for a patient.",
2356 "operationId": "fetchPatientCoaches",
2357 "parameters": [
2358 {
2359 "name": "id",
2360 "in": "path",
2361 "description": "Patient identifier",
2362 "required": true,
2363 "type": "string"
2364 }
2365 ],
2366 "responses": {
2367 "200": {
2368 "description": "OK",
2369 "schema": {
2370 "$ref": "#/definitions/FetchCoachesResponse"
2371 }
2372 },
2373 "401": {
2374 "description": "Unauthorized",
2375 "schema": {
2376 "$ref": "#/definitions/FetchErrorResponse"
2377 }
2378 },
2379 "403": {
2380 "description": "Forbidden",
2381 "schema": {
2382 "$ref": "#/definitions/FetchErrorResponse"
2383 }
2384 }
2385 }
2386 }
2387 },
2388 "/patient_plan_summary": {
2389 "get": {
2390 "tags": [
2391 "plan"
2392 ],
2393 "summary": "List patient plan summaries",
2394 "description": "Get a list of patient plan summaries",
2395 "operationId": "fetchPatientPlanSummaries",
2396 "parameters": [
2397 {
2398 "name": "filter[patient]",
2399 "in": "query",
2400 "type": "string",
2401 "description": "Patient id to fetch plan summary for",
2402 "required": true
2403 },
2404 {
2405 "name": "include",
2406 "description": "List of related resources to include in the response",
2407 "in": "query",
2408 "required": false,
2409 "type": "string",
2410 "enum": [
2411 "actions",
2412 "bundles",
2413 "patient",
2414 "current_results"
2415 ]
2416 }
2417 ],
2418 "responses": {
2419 "200": {
2420 "description": "OK",
2421 "schema": {
2422 "$ref": "#/definitions/FetchPatientPlanSummariesResponse"
2423 }
2424 },
2425 "401": {
2426 "description": "Unauthorized",
2427 "schema": {
2428 "$ref": "#/definitions/FetchErrorResponse"
2429 }
2430 },
2431 "403": {
2432 "description": "Forbidden",
2433 "schema": {
2434 "$ref": "#/definitions/FetchErrorResponse"
2435 }
2436 }
2437 }
2438 }
2439 },
2440 "/patient_plan_summary/{id}": {
2441 "get": {
2442 "tags": [
2443 "plan"
2444 ],
2445 "summary": "Get the plan summary for a patient",
2446 "description": "Get the plan summary for a patient.",
2447 "operationId": "fetchPatientPlanSummary",
2448 "parameters": [
2449 {
2450 "name": "id",
2451 "in": "path",
2452 "description": "Plan summary identifier",
2453 "required": true,
2454 "type": "string"
2455 },
2456 {
2457 "name": "include",
2458 "description": "List of related resources to include in the response",
2459 "in": "query",
2460 "required": false,
2461 "type": "string",
2462 "enum": [
2463 "actions",
2464 "bundles",
2465 "patient",
2466 "current_results"
2467 ]
2468 }
2469 ],
2470 "responses": {
2471 "200": {
2472 "description": "OK",
2473 "schema": {
2474 "$ref": "#/definitions/FetchPatientPlanSummaryResponse"
2475 }
2476 },
2477 "401": {
2478 "description": "Unauthorized",
2479 "schema": {
2480 "$ref": "#/definitions/FetchErrorResponse"
2481 }
2482 },
2483 "403": {
2484 "description": "Forbidden",
2485 "schema": {
2486 "$ref": "#/definitions/FetchErrorResponse"
2487 }
2488 }
2489 }
2490 },
2491 "patch": {
2492 "tags": [
2493 "plan"
2494 ],
2495 "summary": "Update a plan summary",
2496 "description": "Update a plan summary record for a patient.",
2497 "operationId": "updatePatientPlanSummary",
2498 "parameters": [
2499 {
2500 "name": "id",
2501 "in": "path",
2502 "description": "Plan summary identifier",
2503 "required": true,
2504 "type": "string"
2505 },
2506 {
2507 "name": "body",
2508 "in": "body",
2509 "required": true,
2510 "schema": {
2511 "$ref": "#/definitions/UpdatePatientPlanSummaryRequest"
2512 }
2513 }
2514 ],
2515 "responses": {
2516 "200": {
2517 "description": "OK",
2518 "schema": {
2519 "$ref": "#/definitions/UpdatePatientPlanSummaryResponse"
2520 }
2521 },
2522 "401": {
2523 "description": "Unauthorized",
2524 "schema": {
2525 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2526 }
2527 },
2528 "403": {
2529 "description": "Forbidden",
2530 "schema": {
2531 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2532 }
2533 },
2534 "409": {
2535 "description": "Invalid Request",
2536 "schema": {
2537 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2538 }
2539 }
2540 }
2541 }
2542 },
2543 "/reward": {
2544 "post": {
2545 "tags": [
2546 "reward"
2547 ],
2548 "summary": "Create a reward",
2549 "description": "Create a reward for a patient.",
2550 "operationId": "createReward",
2551 "parameters": [
2552 {
2553 "name": "body",
2554 "in": "body",
2555 "required": true,
2556 "schema": {
2557 "$ref": "#/definitions/CreateRewardRequest"
2558 }
2559 }
2560 ],
2561 "responses": {
2562 "200": {
2563 "description": "OK",
2564 "schema": {
2565 "$ref": "#/definitions/CreateRewardResponse"
2566 }
2567 },
2568 "401": {
2569 "description": "Unauthorized",
2570 "schema": {
2571 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2572 }
2573 },
2574 "403": {
2575 "description": "Forbidden",
2576 "schema": {
2577 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2578 }
2579 },
2580 "409": {
2581 "description": "Invalid Request",
2582 "schema": {
2583 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2584 }
2585 }
2586 }
2587 },
2588 "get": {
2589 "tags": [
2590 "reward"
2591 ],
2592 "summary": "List rewards",
2593 "description": "Get a list of rewards matching the specified filters.",
2594 "operationId": "fetchRewards",
2595 "parameters": [
2596 {
2597 "name": "filter[patient]",
2598 "in": "query",
2599 "description": "Patient identifier",
2600 "required": true,
2601 "type": "string"
2602 },
2603 {
2604 "name": "filter[reward_program_activation]",
2605 "in": "query",
2606 "description": "Reward program activation identifier",
2607 "type": "string"
2608 },
2609 {
2610 "name": "filter[thread]",
2611 "in": "query",
2612 "description": "Thread identifier",
2613 "type": "string"
2614 }
2615 ],
2616 "responses": {
2617 "200": {
2618 "description": "OK",
2619 "schema": {
2620 "$ref": "#/definitions/FetchRewardsResponse"
2621 }
2622 },
2623 "401": {
2624 "description": "Unauthorized",
2625 "schema": {
2626 "$ref": "#/definitions/FetchErrorResponse"
2627 }
2628 },
2629 "403": {
2630 "description": "Forbidden",
2631 "schema": {
2632 "$ref": "#/definitions/FetchErrorResponse"
2633 }
2634 }
2635 }
2636 }
2637 },
2638 "/reward/{id}": {
2639 "get": {
2640 "tags": [
2641 "reward"
2642 ],
2643 "summary": "Get a reward",
2644 "description": "Get a reward record by id.",
2645 "operationId": "fetchReward",
2646 "parameters": [
2647 {
2648 "name": "id",
2649 "in": "path",
2650 "description": "Reward identifier",
2651 "required": true,
2652 "type": "string"
2653 }
2654 ],
2655 "responses": {
2656 "200": {
2657 "description": "OK",
2658 "schema": {
2659 "$ref": "#/definitions/FetchRewardResponse"
2660 }
2661 },
2662 "401": {
2663 "description": "Unauthorized",
2664 "schema": {
2665 "$ref": "#/definitions/FetchErrorResponse"
2666 }
2667 },
2668 "403": {
2669 "description": "Forbidden",
2670 "schema": {
2671 "$ref": "#/definitions/FetchErrorResponse"
2672 }
2673 }
2674 }
2675 }
2676 },
2677 "/reward_earning": {
2678 "post": {
2679 "tags": [
2680 "reward earning"
2681 ],
2682 "summary": "Create a reward earning",
2683 "description": "Create a reward earning for a reward. There can only be one earning for a reward. It is possilble to create multiple reward earnings simultaneously by providing and array of reward earnings in the data property.",
2684 "operationId": "createRewardEarning",
2685 "parameters": [
2686 {
2687 "name": "body",
2688 "in": "body",
2689 "required": true,
2690 "schema": {
2691 "$ref": "#/definitions/CreateRewardEarningRequest"
2692 }
2693 }
2694 ],
2695 "responses": {
2696 "200": {
2697 "description": "OK",
2698 "schema": {
2699 "$ref": "#/definitions/CreateRewardEarningResponse"
2700 }
2701 },
2702 "401": {
2703 "description": "Unauthorized",
2704 "schema": {
2705 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2706 }
2707 },
2708 "403": {
2709 "description": "Forbidden",
2710 "schema": {
2711 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2712 }
2713 },
2714 "409": {
2715 "description": "Invalid Request",
2716 "schema": {
2717 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2718 }
2719 }
2720 }
2721 },
2722 "get": {
2723 "tags": [
2724 "reward earning"
2725 ],
2726 "summary": "List reward earnings",
2727 "description": "Get a list of reward earnings matching the specified filters.",
2728 "operationId": "fetchRewardEarnings",
2729 "parameters": [
2730 {
2731 "name": "filter[groups]",
2732 "in": "query",
2733 "description": "Group identifiers",
2734 "required": true,
2735 "type": "string"
2736 },
2737 {
2738 "name": "filter[patient]",
2739 "in": "query",
2740 "description": "Patient identifier",
2741 "required": true,
2742 "type": "string"
2743 },
2744 {
2745 "name": "filter[ready_for_fulfillment]",
2746 "in": "query",
2747 "description": "If true, only returns those reward earnings for which ready_for_fulfillment is true and fulfilled_at is null. If false, only returns those reward earnings for which ready_for_fulfillment is false and fulfilled_at is null.",
2748 "type": "boolean"
2749 }
2750 ],
2751 "responses": {
2752 "200": {
2753 "description": "OK",
2754 "schema": {
2755 "$ref": "#/definitions/FetchRewardEarningsResponse"
2756 }
2757 },
2758 "401": {
2759 "description": "Unauthorized",
2760 "schema": {
2761 "$ref": "#/definitions/FetchErrorResponse"
2762 }
2763 },
2764 "403": {
2765 "description": "Forbidden",
2766 "schema": {
2767 "$ref": "#/definitions/FetchErrorResponse"
2768 }
2769 }
2770 }
2771 }
2772 },
2773 "/reward_earning/{id}": {
2774 "get": {
2775 "tags": [
2776 "reward earning"
2777 ],
2778 "summary": "Get a reward earning",
2779 "description": "Get a reward earning record by id.",
2780 "operationId": "fetchRewardEarning",
2781 "parameters": [
2782 {
2783 "name": "id",
2784 "in": "path",
2785 "description": "Reward earning identifier",
2786 "required": true,
2787 "type": "string"
2788 }
2789 ],
2790 "responses": {
2791 "200": {
2792 "description": "OK",
2793 "schema": {
2794 "$ref": "#/definitions/FetchRewardEarningResponse"
2795 }
2796 },
2797 "401": {
2798 "description": "Unauthorized",
2799 "schema": {
2800 "$ref": "#/definitions/FetchErrorResponse"
2801 }
2802 },
2803 "403": {
2804 "description": "Forbidden",
2805 "schema": {
2806 "$ref": "#/definitions/FetchErrorResponse"
2807 }
2808 }
2809 }
2810 }
2811 },
2812 "/reward_earning_fulfillment": {
2813 "post": {
2814 "tags": [
2815 "reward earning fulfillment"
2816 ],
2817 "summary": "Create a reward earning fulfillment",
2818 "description": "Create a reward earning fulfillment for a reward earning. There can only be one fulfillment for each earning.",
2819 "operationId": "createRewardEarningFulfillment",
2820 "parameters": [
2821 {
2822 "name": "body",
2823 "in": "body",
2824 "required": true,
2825 "schema": {
2826 "$ref": "#/definitions/CreateRewardEarningFulfillmentRequest"
2827 }
2828 }
2829 ],
2830 "responses": {
2831 "200": {
2832 "description": "OK",
2833 "schema": {
2834 "$ref": "#/definitions/CreateRewardEarningFulfillmentResponse"
2835 }
2836 },
2837 "401": {
2838 "description": "Unauthorized",
2839 "schema": {
2840 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2841 }
2842 },
2843 "403": {
2844 "description": "Forbidden",
2845 "schema": {
2846 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2847 }
2848 },
2849 "409": {
2850 "description": "Invalid Request",
2851 "schema": {
2852 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2853 }
2854 }
2855 }
2856 },
2857 "get": {
2858 "tags": [
2859 "reward earning fulfillment"
2860 ],
2861 "summary": "List reward earning fulfillments",
2862 "description": "Get a list of reward earning fulfillments matching the specified filters.",
2863 "operationId": "fetchRewardEarningFulfillments",
2864 "parameters": [
2865 {
2866 "name": "filter[patient]",
2867 "in": "query",
2868 "description": "Patient identifier",
2869 "required": true,
2870 "type": "string"
2871 }
2872 ],
2873 "responses": {
2874 "200": {
2875 "description": "OK",
2876 "schema": {
2877 "$ref": "#/definitions/FetchRewardEarningFulfillmentsResponse"
2878 }
2879 },
2880 "401": {
2881 "description": "Unauthorized",
2882 "schema": {
2883 "$ref": "#/definitions/FetchErrorResponse"
2884 }
2885 },
2886 "403": {
2887 "description": "Forbidden",
2888 "schema": {
2889 "$ref": "#/definitions/FetchErrorResponse"
2890 }
2891 }
2892 }
2893 }
2894 },
2895 "/reward_earning_fulfillment/{id}": {
2896 "get": {
2897 "tags": [
2898 "reward earning fulfillment"
2899 ],
2900 "summary": "Get a reward earning fulfillment",
2901 "description": "Get a reward earning fulfillment record by id.",
2902 "operationId": "fetchRewardEarningFulfillment",
2903 "parameters": [
2904 {
2905 "name": "id",
2906 "in": "path",
2907 "description": "Reward earning fulfillment identifier",
2908 "required": true,
2909 "type": "string"
2910 }
2911 ],
2912 "responses": {
2913 "200": {
2914 "description": "OK",
2915 "schema": {
2916 "$ref": "#/definitions/FetchRewardEarningFulfillmentResponse"
2917 }
2918 },
2919 "401": {
2920 "description": "Unauthorized",
2921 "schema": {
2922 "$ref": "#/definitions/FetchErrorResponse"
2923 }
2924 },
2925 "403": {
2926 "description": "Forbidden",
2927 "schema": {
2928 "$ref": "#/definitions/FetchErrorResponse"
2929 }
2930 }
2931 }
2932 }
2933 },
2934 "/reward_program_activation": {
2935 "post": {
2936 "tags": [
2937 "reward program activation"
2938 ],
2939 "summary": "Create a reward program activation",
2940 "description": "Create a reward program activation for a patient. There can only be one activation for a patient for a given reward program.",
2941 "operationId": "createRewardProgramActivation",
2942 "parameters": [
2943 {
2944 "name": "body",
2945 "in": "body",
2946 "required": true,
2947 "schema": {
2948 "$ref": "#/definitions/CreateRewardProgramActivationRequest"
2949 }
2950 }
2951 ],
2952 "responses": {
2953 "200": {
2954 "description": "OK",
2955 "schema": {
2956 "$ref": "#/definitions/CreateRewardProgramActivationResponse"
2957 }
2958 },
2959 "401": {
2960 "description": "Unauthorized",
2961 "schema": {
2962 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2963 }
2964 },
2965 "403": {
2966 "description": "Forbidden",
2967 "schema": {
2968 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2969 }
2970 },
2971 "409": {
2972 "description": "Invalid Request",
2973 "schema": {
2974 "$ref": "#/definitions/CreateOrUpdateErrorResponse"
2975 }
2976 }
2977 }
2978 },
2979 "get": {
2980 "tags": [
2981 "reward program activation"
2982 ],
2983 "summary": "List reward program activations",
2984 "description": "Get a list of reward program activations matching the specified filters.",
2985 "operationId": "fetchRewardProgramActivations",
2986 "parameters": [
2987 {
2988 "name": "filter[patient]",
2989 "in": "query",
2990 "description": "Patient identifier",
2991 "required": true,
2992 "type": "string"
2993 }
2994 ],
2995 "responses": {
2996 "200": {
2997 "description": "OK",
2998 "schema": {
2999 "$ref": "#/definitions/FetchRewardProgramActivationsResponse"
3000 }
3001 },
3002 "401": {
3003 "description": "Unauthorized",
3004 "schema": {
3005 "$ref": "#/definitions/FetchErrorResponse"
3006 }
3007 },
3008 "403": {
3009 "description": "Forbidden",
3010 "schema": {
3011 "$ref": "#/definitions/FetchErrorResponse"
3012 }
3013 }
3014 }
3015 }
3016 },
3017 "/reward_program_activation/{id}": {
3018 "get": {
3019 "tags": [
3020 "reward program activation"
3021 ],
3022 "summary": "Get a reward program activation",
3023 "description": "Get a reward program activationrecord by id.",
3024 "operationId": "fetchRewardProgramActivation",
3025 "parameters": [
3026 {
3027 "name": "id",
3028 "in": "path",
3029 "description": "Reward program activation identifier",
3030 "required": true,
3031 "type": "string"
3032 }
3033 ],
3034 "responses": {
3035 "200": {
3036 "description": "OK",
3037 "schema": {
3038 "$ref": "#/definitions/FetchRewardProgramActivationResponse"
3039 }
3040 },
3041 "401": {
3042 "description": "Unauthorized",
3043 "schema": {
3044 "$ref": "#/definitions/FetchErrorResponse"
3045 }
3046 },
3047 "403": {
3048 "description": "Forbidden",
3049 "schema": {
3050 "$ref": "#/definitions/FetchErrorResponse"
3051 }
3052 }
3053 }
3054 }
3055 }
3056 },
3057 "definitions": {
3058 "Resource": {
3059 "type": "object",
3060 "properties": {
3061 "type": {
3062 "type": "string"
3063 },
3064 "id": {
3065 "type": "string"
3066 },
3067 "attributes": {
3068 "type": "object"
3069 }
3070 }
3071 },
3072 "CreateOrUpdateMetaResponse": {
3073 "type": "object",
3074 "properties": {
3075 "req_id": {
3076 "type": "string"
3077 },
3078 "ignored": {
3079 "type": "array",
3080 "items": {
3081 "type": "string"
3082 }
3083 }
3084 }
3085 },
3086 "FetchMetaResponse": {
3087 "type": "object",
3088 "properties": {
3089 "req_id": {
3090 "type": "string"
3091 },
3092 "count": {
3093 "type": "integer"
3094 }
3095 }
3096 },
3097 "CollectionResponseLinks": {
3098 "type": "object",
3099 "properties": {
3100 "self": {
3101 "type": "string"
3102 },
3103 "next": {
3104 "type": "string"
3105 },
3106 "prev": {
3107 "type": "string"
3108 },
3109 "last": {
3110 "type": "string"
3111 }
3112 }
3113 },
3114 "Error": {
3115 "type": "object",
3116 "properties": {
3117 "status": {
3118 "type": "string"
3119 },
3120 "code": {
3121 "type": "string",
3122 "enum": [
3123 "Forbidden",
3124 "InvalidParameter",
3125 "InvalidBodyParameter",
3126 "ResourceNotFound",
3127 "Unauthorized",
3128 "InvalidCredentials",
3129 "InvalidGrantType"
3130 ]
3131 },
3132 "title": {
3133 "type": "string"
3134 },
3135 "detail": {
3136 "type": "string"
3137 },
3138 "source": {
3139 "type": "object",
3140 "properties": {
3141 "parameter": {
3142 "type": "string"
3143 },
3144 "pointer": {
3145 "type": "string"
3146 }
3147 }
3148 }
3149 }
3150 },
3151 "CreateOrUpdateErrorResponse": {
3152 "type": "object",
3153 "properties": {
3154 "meta": {
3155 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
3156 },
3157 "errors": {
3158 "$ref": "#/definitions/Error"
3159 }
3160 },
3161 "example": {
3162 "meta": {
3163 "req_id": "d07c8b12-c95e-4a06-8424-92aac94bb445"
3164 },
3165 "errors": [
3166 {
3167 "code": "Unauthorized",
3168 "detail": "A valid bearer token is required",
3169 "status": "401"
3170 }
3171 ]
3172 }
3173 },
3174 "FetchErrorResponse": {
3175 "type": "object",
3176 "properties": {
3177 "meta": {
3178 "$ref": "#/definitions/FetchMetaResponse"
3179 },
3180 "errors": {
3181 "$ref": "#/definitions/Error"
3182 }
3183 },
3184 "example": {
3185 "meta": {
3186 "req_id": "d07c8b12-c95e-4a06-8424-92aac94bb445"
3187 },
3188 "errors": [
3189 {
3190 "code": "Unauthorized",
3191 "detail": "A valid bearer token is required",
3192 "status": "401"
3193 }
3194 ]
3195 }
3196 },
3197 "TokenResource": {
3198 "type": "object",
3199 "required": [
3200 "type",
3201 "id"
3202 ],
3203 "properties": {
3204 "type": {
3205 "type": "string",
3206 "example": "token",
3207 "enum": [
3208 "token"
3209 ]
3210 },
3211 "id": {
3212 "type": "string",
3213 "example": "57b36c9a04ad8c2224f2af35"
3214 },
3215 "attributes": {
3216 "required": [
3217 "access_token",
3218 "refresh_token",
3219 "token_type",
3220 "expires_in"
3221 ],
3222 "properties": {
3223 "access_token": {
3224 "type": "string",
3225 "example": "a01fe2bb-1977-48d9-b722-ac7f9135143f"
3226 },
3227 "refresh_token": {
3228 "type": "string",
3229 "example": "b452cb17-72e2-4e90-b9c6-d77a0b66cf7c"
3230 },
3231 "token_type": {
3232 "type": "string",
3233 "enum": [
3234 "bearer"
3235 ],
3236 "example": "bearer"
3237 },
3238 "expires_in": {
3239 "type": "integer",
3240 "example": 3600
3241 }
3242 }
3243 },
3244 "relationships": {
3245 "type": "object",
3246 "properties": {
3247 "groups": {
3248 "required": [
3249 "links",
3250 "data"
3251 ],
3252 "properties": {
3253 "data": {
3254 "type": "array",
3255 "items": {
3256 "type": "object",
3257 "required": [
3258 "type",
3259 "id"
3260 ],
3261 "properties": {
3262 "type": {
3263 "type": "string",
3264 "enum": [
3265 "group"
3266 ],
3267 "example": "group"
3268 },
3269 "id": {
3270 "type": "string",
3271 "example": "57b36d6f04ad8c2224f2af36"
3272 }
3273 }
3274 }
3275 },
3276 "links": {
3277 "required": [
3278 "related"
3279 ],
3280 "properties": {
3281 "related": {
3282 "type": "string",
3283 "pattern": "/oauth/token/[0-9a-z]+/groups",
3284 "example": "/oauth/token/57b36d8804ad8c2224f2af37/groups"
3285 }
3286 }
3287 }
3288 }
3289 },
3290 "organization": {
3291 "required": [
3292 "links",
3293 "data"
3294 ],
3295 "properties": {
3296 "data": {
3297 "required": [
3298 "type",
3299 "id"
3300 ],
3301 "properties": {
3302 "type": {
3303 "type": "string",
3304 "enum": [
3305 "organization"
3306 ],
3307 "example": "organization"
3308 },
3309 "id": {
3310 "type": "string",
3311 "example": "57b36d6f04ad8c2224f2af36"
3312 }
3313 }
3314 },
3315 "links": {
3316 "required": [
3317 "related"
3318 ],
3319 "properties": {
3320 "related": {
3321 "type": "string",
3322 "pattern": "/oauth/token/[0-9a-z]+/organization",
3323 "example": "/oauth/token/57b36d8804ad8c2224f2af37/organization"
3324 }
3325 }
3326 }
3327 }
3328 }
3329 }
3330 }
3331 }
3332 },
3333 "CreateTokenRequest": {
3334 "type": "object",
3335 "required": [
3336 "data"
3337 ],
3338 "properties": {
3339 "data": {
3340 "type": "object",
3341 "required": [
3342 "attributes"
3343 ],
3344 "properties": {
3345 "type": {
3346 "type": "string",
3347 "enum": [
3348 "token"
3349 ],
3350 "example": "token"
3351 },
3352 "attributes": {
3353 "type": "object",
3354 "required": [
3355 "client_id",
3356 "grant_type"
3357 ],
3358 "properties": {
3359 "grant_type": {
3360 "type": "string",
3361 "enum": [
3362 "refresh_token",
3363 "client_credentials"
3364 ],
3365 "example": "client_credentials"
3366 },
3367 "client_id": {
3368 "type": "string",
3369 "description": "Contact Fitbit Plus API Support to get a client id and secret.",
3370 "example": "19391dc5-8af8-4152-93e8-74ff9361607e"
3371 },
3372 "client_secret": {
3373 "type": "string",
3374 "description": "Contact Fitbit Plus API Support to get a client id and secret. Secret is required if grant_type is \"client_credentials\"",
3375 "example": "63eca384-7a65-42e2-872b-afd3e8659d0a"
3376 },
3377 "refresh_token": {
3378 "type": "string",
3379 "description": "Required if grant_type is \"refresh_token\"",
3380 "example": "b7dcc4a4-593b-4410-a0c5-97ae48939396"
3381 }
3382 }
3383 }
3384 }
3385 }
3386 },
3387 "example": {
3388 "data": {
3389 "type": "oauth/token",
3390 "attributes": {
3391 "grant_type": "client_credentials",
3392 "client_id": "95c78ab2-167f-40b8-8bec-8398d4b87454",
3393 "client_secret": "35d18dc9-a3dd-4948-b787-063a490b9354"
3394 }
3395 }
3396 }
3397 },
3398 "CreateTokenResponse": {
3399 "type": "object",
3400 "required": [
3401 "data"
3402 ],
3403 "properties": {
3404 "meta": {
3405 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
3406 },
3407 "data": {
3408 "$ref": "#/definitions/TokenResource"
3409 },
3410 "included": {
3411 "type": "array",
3412 "items": {
3413 "$ref": "#/definitions/GroupResource"
3414 }
3415 }
3416 },
3417 "example": {
3418 "meta": {
3419 "req_id": "2de51f1a-bafa-4e48-a0d0-cd8d4a9ffb28"
3420 },
3421 "data": {
3422 "type": "oauth/token",
3423 "id": "5817a24d678a7c2cbf5df3ee",
3424 "attributes": {
3425 "access_token": "c1b83534-76c1-4a27-b1d4-8140e24dd7c6",
3426 "refresh_token": "a38d192a-76fd-4b1d-954c-893c9d29c8f4",
3427 "token_type": "bearer",
3428 "expires_in": 3601
3429 },
3430 "relationships": {
3431 "groups": {
3432 "data": [
3433 {
3434 "type": "group",
3435 "id": "5755db2a3db4179179999acf"
3436 }
3437 ],
3438 "links": {
3439 "related": "/pub/oauth/token/5817a24d678a7c2cbf5df3ee/groups"
3440 }
3441 }
3442 }
3443 }
3444 }
3445 },
3446 "OrganizationResource": {
3447 "type": "object",
3448 "required": [
3449 "id",
3450 "type",
3451 "attributes"
3452 ],
3453 "properties": {
3454 "id": {
3455 "type": "string",
3456 "example": "57b36e3c04ad8c2224f2af38"
3457 },
3458 "type": {
3459 "type": "string",
3460 "enum": [
3461 "organization"
3462 ],
3463 "example": "organization"
3464 },
3465 "attributes": {
3466 "required": [
3467 "name"
3468 ],
3469 "properties": {
3470 "name": {
3471 "type": "string",
3472 "example": "Health Activation Partners"
3473 }
3474 }
3475 },
3476 "links": {
3477 "readOnly": true,
3478 "required": [
3479 "self"
3480 ],
3481 "properties": {
3482 "self": {
3483 "type": "string",
3484 "pattern": "/organization/[0-9a-z]+",
3485 "example": "/organization/57b36e3c04ad8c2224f2af38"
3486 }
3487 }
3488 }
3489 }
3490 },
3491 "FetchOrganizationResponse": {
3492 "type": "object",
3493 "required": [
3494 "data"
3495 ],
3496 "properties": {
3497 "meta": {
3498 "$ref": "#/definitions/FetchMetaResponse"
3499 },
3500 "data": {
3501 "$ref": "#/definitions/OrganizationResource"
3502 }
3503 },
3504 "example": {
3505 "meta": {
3506 "req_id": "aeb94ed8-d7f9-4e72-a78f-e276c4f52c2a"
3507 },
3508 "data": {
3509 "type": "organization",
3510 "id": "5873b63605376e337a89d64a",
3511 "attributes": {
3512 "name": "Health Activation Partners"
3513 },
3514 "links": {
3515 "self": "/pub/organization/5873b63605376e337a89d64a"
3516 }
3517 }
3518 }
3519 },
3520 "GroupResource": {
3521 "type": "object",
3522 "required": [
3523 "id",
3524 "type",
3525 "attributes"
3526 ],
3527 "properties": {
3528 "id": {
3529 "type": "string",
3530 "example": "57b36e3c04ad8c2224f2af38"
3531 },
3532 "type": {
3533 "type": "string",
3534 "enum": [
3535 "group"
3536 ],
3537 "example": "group"
3538 },
3539 "attributes": {
3540 "type": "object",
3541 "required": [
3542 "name"
3543 ],
3544 "properties": {
3545 "name": {
3546 "type": "string",
3547 "example": "Team Health",
3548 "description": "The name of the group"
3549 },
3550 "bio": {
3551 "type": "string",
3552 "description": "A description of the group",
3553 "example": "Team Health is all about the patient experience."
3554 }
3555 }
3556 },
3557 "links": {
3558 "type": "object",
3559 "readOnly": true,
3560 "required": [
3561 "self"
3562 ],
3563 "properties": {
3564 "self": {
3565 "type": "string",
3566 "pattern": "/group/[0-9a-z]+",
3567 "example": "/group/57b36e3c04ad8c2224f2af38"
3568 }
3569 }
3570 }
3571 }
3572 },
3573 "FetchGroupResponse": {
3574 "type": "object",
3575 "required": [
3576 "data"
3577 ],
3578 "properties": {
3579 "meta": {
3580 "$ref": "#/definitions/FetchMetaResponse"
3581 },
3582 "data": {
3583 "$ref": "#/definitions/GroupResource"
3584 }
3585 },
3586 "example": {
3587 "meta": {
3588 "req_id": "2b59851e-0f6c-4a8f-a8a6-15bd7c0346e7"
3589 },
3590 "data": {
3591 "type": "group",
3592 "id": "5755db2a3db4179179999acf",
3593 "attributes": {
3594 "name": "Patients Lead"
3595 },
3596 "links": {
3597 "self": "/pub/group/5755db2a3db4179179999acf"
3598 }
3599 }
3600 }
3601 },
3602 "FetchGroupsResponse": {
3603 "type": "object",
3604 "required": [
3605 "data"
3606 ],
3607 "properties": {
3608 "meta": {
3609 "$ref": "#/definitions/FetchMetaResponse"
3610 },
3611 "data": {
3612 "type": "array",
3613 "items": {
3614 "$ref": "#/definitions/GroupResource"
3615 }
3616 }
3617 },
3618 "example": {
3619 "meta": {
3620 "req_id": "ab554093-6081-4d37-aa7b-ca6312367ca4",
3621 "count": 1
3622 },
3623 "links": {
3624 "self": "/pub/oauth/token/5817a24d678a7c2cbf5df3ee/groups"
3625 },
3626 "data": [
3627 {
3628 "type": "group",
3629 "id": "5755db2a3db4179179999acf",
3630 "attributes": {
3631 "name": "Patients Lead"
3632 },
3633 "links": {
3634 "self": "/pub/group/5755db2a3db4179179999acf"
3635 }
3636 }
3637 ]
3638 }
3639 },
3640 "CreateGroupRequest": {
3641 "type": "object",
3642 "required": [
3643 "data"
3644 ],
3645 "properties": {
3646 "data": {
3647 "$ref": "#/definitions/GroupResource"
3648 }
3649 },
3650 "example": {
3651 "data": {
3652 "type": "group",
3653 "attributes": {
3654 "name": "New Group"
3655 }
3656 }
3657 }
3658 },
3659 "CreateGroupResponse": {
3660 "type": "object",
3661 "required": [
3662 "data"
3663 ],
3664 "properties": {
3665 "meta": {
3666 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
3667 },
3668 "data": {
3669 "$ref": "#/definitions/GroupResource"
3670 }
3671 },
3672 "example": {
3673 "meta": {
3674 "req_id": "6ac6d0f2-00b2-4031-8c35-97b2bfb0aced"
3675 },
3676 "data": {
3677 "type": "group",
3678 "id": "5817acae6f5316c0d05ba8b8",
3679 "attributes": {
3680 "name": "New Group"
3681 },
3682 "links": {
3683 "self": "/pub/group/5817acae6f5316c0d05ba8b8"
3684 }
3685 }
3686 }
3687 },
3688 "CoachResource": {
3689 "type": "object",
3690 "required": [
3691 "id",
3692 "type",
3693 "attributes"
3694 ],
3695 "properties": {
3696 "id": {
3697 "type": "string",
3698 "example": "57b36e3c04ad8c2224f2af38"
3699 },
3700 "type": {
3701 "type": "string",
3702 "enum": [
3703 "coach"
3704 ],
3705 "example": "coach"
3706 },
3707 "attributes": {
3708 "type": "object",
3709 "properties": {
3710 "first_name": {
3711 "type": "string",
3712 "example": "Clarisa"
3713 },
3714 "last_name": {
3715 "type": "string",
3716 "example": "Rivera"
3717 }
3718 }
3719 },
3720 "links": {
3721 "type": "object",
3722 "readOnly": true,
3723 "required": [
3724 "self"
3725 ],
3726 "properties": {
3727 "self": {
3728 "type": "string",
3729 "pattern": "/coach/[0-9a-z]+",
3730 "example": "/coach/57b36e3c04ad8c2224f2af38"
3731 }
3732 }
3733 }
3734 }
3735 },
3736 "FetchCoachResponse": {
3737 "type": "object",
3738 "required": [
3739 "data"
3740 ],
3741 "properties": {
3742 "meta": {
3743 "$ref": "#/definitions/FetchMetaResponse"
3744 },
3745 "data": {
3746 "$ref": "#/definitions/CoachResource"
3747 }
3748 },
3749 "example": {
3750 "meta": {
3751 "req_id": "b928037e-98ed-434f-b0c4-d74b1a38a560"
3752 },
3753 "data": {
3754 "type": "coach",
3755 "id": "581630c3237d84a9403533c6",
3756 "attributes": {
3757 "first_name": "Clarisa",
3758 "last_name": "Rivera"
3759 },
3760 "links": {
3761 "self": "/pub/coach/581630c3237d84a9403533c6"
3762 }
3763 },
3764 "included": []
3765 }
3766 },
3767 "FetchCoachesResponse": {
3768 "type": "object",
3769 "required": [
3770 "data"
3771 ],
3772 "properties": {
3773 "meta": {
3774 "$ref": "#/definitions/FetchMetaResponse"
3775 },
3776 "data": {
3777 "type": "array",
3778 "items": {
3779 "$ref": "#/definitions/CoachResource"
3780 }
3781 }
3782 },
3783 "example": {
3784 "meta": {
3785 "req_id": "48c47326-0c8b-4c5e-85da-7fc0d00f1e4d",
3786 "count": 1
3787 },
3788 "links": {
3789 "self": "/pub/patient/58163112237d84a94035f78b/coaches"
3790 },
3791 "data": [
3792 {
3793 "type": "coach",
3794 "id": "581630c3237d84a9403533c6",
3795 "attributes": {
3796 "first_name": "Clarisa",
3797 "last_name": "Rivera"
3798 },
3799 "links": {
3800 "self": "/pub/coach/581630c3237d84a9403533c6"
3801 }
3802 }
3803 ],
3804 "included": []
3805 }
3806 },
3807 "RewardProgramResource": {
3808 "type": "object",
3809 "required": [
3810 "type"
3811 ],
3812 "properties": {
3813 "type": {
3814 "type": "string"
3815 },
3816 "id": {
3817 "type": "string"
3818 },
3819 "attributes": {
3820 "type": "object",
3821 "required": [
3822 "name",
3823 "start_at",
3824 "end_at",
3825 "budget_value"
3826 ],
3827 "properties": {
3828 "name": {
3829 "description": "Name of the reward program",
3830 "type": "string"
3831 },
3832 "tagline": {
3833 "description": "Tagline of the reward program - designed to be one line",
3834 "type": "string"
3835 },
3836 "description": {
3837 "description": "Description of the reward program - designed to be a comprehensive text description",
3838 "type": "string"
3839 },
3840 "start_at": {
3841 "description": "Date at which the reward program starts.",
3842 "type": "string",
3843 "format": "dateTime"
3844 },
3845 "end_at": {
3846 "description": "Date at which the reward program ends. (Must be after the start_at)",
3847 "type": "string",
3848 "format": "dateTime"
3849 },
3850 "budget_value": {
3851 "description": "Value of the budget for the reward program. (Must be greater than 0)",
3852 "type": "number"
3853 },
3854 "budget_unit": {
3855 "description": "Unit of the budget for the reard program.",
3856 "type": "string",
3857 "enum": [
3858 "dollar",
3859 "point",
3860 "credit"
3861 ],
3862 "default": "dollar"
3863 },
3864 "duration_active": {
3865 "description": "Number of days that a program can be active after it has been activated for a patient. (Must be greater than 0)",
3866 "type": "number",
3867 "default": 540
3868 },
3869 "fulfill_as_earned": {
3870 "description": "If true, the rewards created for a patient for the program can be fulfulled as they are earned. If false, the rewards should only be fulfilled when the program is deactivated.",
3871 "type": "boolean",
3872 "default": false
3873 },
3874 "frozen": {
3875 "description": "If true, the reward program cannot be activated for a patient and new rewards cannot be created for the program.",
3876 "type": "boolean",
3877 "default": false
3878 }
3879 }
3880 },
3881 "relationships": {
3882 "type": "object",
3883 "required": [
3884 "group"
3885 ],
3886 "properties": {
3887 "group": {
3888 "type": "object",
3889 "required": [
3890 "data"
3891 ],
3892 "properties": {
3893 "data": {
3894 "type": "object",
3895 "required": [
3896 "type",
3897 "id"
3898 ],
3899 "properties": {
3900 "type": {
3901 "type": "string"
3902 },
3903 "id": {
3904 "type": "string"
3905 }
3906 }
3907 }
3908 }
3909 }
3910 }
3911 }
3912 }
3913 },
3914 "CreateRewardProgramRequest": {
3915 "type": "object",
3916 "required": [
3917 "data"
3918 ],
3919 "properties": {
3920 "data": {
3921 "$ref": "#/definitions/RewardProgramResource"
3922 }
3923 }
3924 },
3925 "CreateRewardProgramResponse": {
3926 "type": "object",
3927 "required": [
3928 "data"
3929 ],
3930 "properties": {
3931 "meta": {
3932 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
3933 },
3934 "data": {
3935 "$ref": "#/definitions/RewardProgramResource"
3936 }
3937 }
3938 },
3939 "FetchRewardProgramResponse": {
3940 "type": "object",
3941 "required": [
3942 "data"
3943 ],
3944 "properties": {
3945 "meta": {
3946 "$ref": "#/definitions/FetchMetaResponse"
3947 },
3948 "data": {
3949 "$ref": "#/definitions/RewardProgramResource"
3950 }
3951 }
3952 },
3953 "FetchRewardProgramsResponse": {
3954 "type": "object",
3955 "required": [
3956 "data"
3957 ],
3958 "properties": {
3959 "meta": {
3960 "$ref": "#/definitions/FetchMetaResponse"
3961 },
3962 "data": {
3963 "type": "array",
3964 "items": {
3965 "$ref": "#/definitions/RewardProgramResource"
3966 }
3967 }
3968 }
3969 },
3970 "Identifier": {
3971 "type": "object",
3972 "required": [
3973 "system",
3974 "value"
3975 ],
3976 "properties": {
3977 "label": {
3978 "type": "string"
3979 },
3980 "system": {
3981 "type": "string"
3982 },
3983 "value": {
3984 "type": "string"
3985 }
3986 }
3987 },
3988 "ActionMetric": {
3989 "type": "object",
3990 "properties": {
3991 "metric_type": {
3992 "type": "string"
3993 },
3994 "unit": {
3995 "type": "string"
3996 },
3997 "goal": {
3998 "type": "object"
3999 },
4000 "validations": {
4001 "type": "object",
4002 "properties": {
4003 "minimum": {
4004 "type": "object",
4005 "properties": {
4006 "value": {
4007 "type": "number"
4008 },
4009 "unit": {
4010 "type": "string"
4011 }
4012 }
4013 },
4014 "maximum": {
4015 "type": "object",
4016 "properties": {
4017 "value": {
4018 "type": "number"
4019 },
4020 "unit": {
4021 "type": "string"
4022 }
4023 }
4024 }
4025 }
4026 }
4027 }
4028 },
4029 "ActionWindow": {
4030 "type": "object",
4031 "required": [
4032 "type"
4033 ],
4034 "properties": {
4035 "title": {
4036 "type": "string"
4037 },
4038 "type": {
4039 "type": "string"
4040 },
4041 "_id": {
4042 "type": "string"
4043 }
4044 }
4045 },
4046 "ActionResource": {
4047 "type": "object",
4048 "required": [
4049 "type",
4050 "id"
4051 ],
4052 "properties": {
4053 "type": {
4054 "type": "string"
4055 },
4056 "id": {
4057 "type": "string"
4058 },
4059 "attributes": {
4060 "type": "object",
4061 "required": [
4062 "type",
4063 "title",
4064 "effective_from"
4065 ],
4066 "properties": {
4067 "type": {
4068 "type": "string",
4069 "enum": [
4070 "other_lifestyle"
4071 ]
4072 },
4073 "title": {
4074 "type": "string"
4075 },
4076 "static_title": {
4077 "type": "string",
4078 "readOnly": true
4079 },
4080 "effective_from": {
4081 "type": "string",
4082 "format": "dateTime"
4083 },
4084 "effective_to": {
4085 "type": "string",
4086 "format": "dateTime"
4087 },
4088 "tracking": {
4089 "type": "boolean"
4090 },
4091 "_thread": {
4092 "type": "string"
4093 },
4094 "adherence": {
4095 "type": "object",
4096 "readOnly": true,
4097 "properties": {
4098 "due": {
4099 "type": "integer"
4100 },
4101 "complete": {
4102 "type": "integer"
4103 },
4104 "streak": {
4105 "type": "object",
4106 "properties": {
4107 "count": {
4108 "type": "integer"
4109 },
4110 "updated_at": {
4111 "type": "string",
4112 "format": "dateTime"
4113 }
4114 }
4115 }
4116 }
4117 },
4118 "frequency_goal": {
4119 "type": "object",
4120 "properties": {
4121 "weeks": {
4122 "type": "object",
4123 "properties": {
4124 "days": {
4125 "type": "array",
4126 "items": {
4127 "description": "Days of week that the action is scheduled for. Zero-indexed, ex 0 represents Sunday, etc.",
4128 "type": "integer",
4129 "maxItems": 7,
4130 "enum": [
4131 0,
4132 1,
4133 2,
4134 3,
4135 4,
4136 5,
4137 6
4138 ]
4139 }
4140 }
4141 }
4142 }
4143 }
4144 },
4145 "identifiers": {
4146 "type": "array",
4147 "items": {
4148 "$ref": "#/definitions/Identifier"
4149 }
4150 },
4151 "details": {
4152 "type": "object",
4153 "additionalProperties": true
4154 },
4155 "intake": {
4156 "type": "object",
4157 "additionalProperties": true
4158 },
4159 "metric_required": {
4160 "type": "boolean"
4161 },
4162 "metrics": {
4163 "type": "array",
4164 "items": {
4165 "$ref": "#/definitions/ActionMetric"
4166 }
4167 },
4168 "windows": {
4169 "type": "array",
4170 "items": {
4171 "$ref": "#/definitions/ActionWindow"
4172 }
4173 }
4174 }
4175 },
4176 "relationships": {
4177 "type": "object",
4178 "properties": {
4179 "plan": {
4180 "type": "object",
4181 "properties": {
4182 "data": {
4183 "type": "object",
4184 "properties": {
4185 "type": {
4186 "type": "string"
4187 },
4188 "id": {
4189 "type": "string"
4190 }
4191 }
4192 },
4193 "links": {
4194 "type": "object"
4195 }
4196 }
4197 }
4198 }
4199 }
4200 }
4201 },
4202 "CreateActionRequest": {
4203 "type": "object",
4204 "required": [
4205 "data"
4206 ],
4207 "properties": {
4208 "data": {
4209 "$ref": "#/definitions/ActionResource"
4210 }
4211 },
4212 "example": {
4213 "data": {
4214 "type": "action",
4215 "attributes": {
4216 "effective_from": "2017-02-20T11:12:13.000Z",
4217 "title": "Record Blood Pressure",
4218 "type": "blood_pressure",
4219 "frequency_goal": {
4220 "weeks": {
4221 "days": [
4222 0
4223 ]
4224 }
4225 },
4226 "metrics": [
4227 {
4228 "metric_type": "blood_pressure",
4229 "unit": "mmHg",
4230 "goal": {
4231 "data": {
4232 "systolic": {
4233 "value": 150,
4234 "unit": "mmHg"
4235 },
4236 "diastolic": {
4237 "value": 95,
4238 "unit": "mmHg"
4239 }
4240 }
4241 }
4242 }
4243 ]
4244 },
4245 "relationships": {
4246 "plan": {
4247 "data": {
4248 "type": "patient_plan_summary",
4249 "id": "58aacf0d076adcef394bac35"
4250 }
4251 },
4252 "bundles": {
4253 "data": [
4254 {
4255 "type": "bundle",
4256 "id": "58aacf0d076adcef394bac30"
4257 }
4258 ]
4259 }
4260 }
4261 }
4262 }
4263 },
4264 "CreateActionResponse": {
4265 "type": "object",
4266 "required": [
4267 "data"
4268 ],
4269 "properties": {
4270 "meta": {
4271 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
4272 },
4273 "data": {
4274 "$ref": "#/definitions/ActionResource"
4275 }
4276 },
4277 "example": {
4278 "data": {
4279 "type": "action",
4280 "id": "58aacf0d076adcef394bac36",
4281 "attributes": {
4282 "_thread": "blood_pressure",
4283 "adherence": {
4284 "due": 0,
4285 "complete": 0,
4286 "streak": {
4287 "count": 0
4288 }
4289 },
4290 "effective_from": "2017-02-20T11:12:13.000Z",
4291 "frequency_goal": {
4292 "weeks": {
4293 "days": [
4294 0
4295 ]
4296 }
4297 },
4298 "frequency_goal_prorated": 0,
4299 "identifiers": [],
4300 "metric_required": false,
4301 "metrics": [
4302 {
4303 "metric_type": "blood_pressure",
4304 "unit": "mmHg",
4305 "goal": {
4306 "data": {
4307 "diastolic": {
4308 "unit": "mmHg",
4309 "value": 95
4310 },
4311 "systolic": {
4312 "unit": "mmHg",
4313 "value": 150
4314 }
4315 }
4316 },
4317 "_id": "58aacf0d076adcef394bac37",
4318 "accepted_values": []
4319 }
4320 ],
4321 "title": "Record Blood Pressure",
4322 "tracking": true,
4323 "windows": [],
4324 "type": "blood_pressure",
4325 "options": [],
4326 "created_at": "2017-02-20T11:12:13.000Z",
4327 "created_by": "596541ec076adcef394bac2d",
4328 "updated_at": "2017-02-20T11:12:13.000Z",
4329 "updated_by": "596541ec076adcef394bac2d"
4330 },
4331 "links": {
4332 "self": "/action/58aacf0d076adcef394bac36"
4333 },
4334 "relationships": {
4335 "plan": {
4336 "links": {
4337 "related": "/action/58aacf0d076adcef394bac36/plan"
4338 },
4339 "data": {
4340 "type": "patient_plan_summary",
4341 "id": "58aacf0d076adcef394bac35"
4342 }
4343 },
4344 "bundles": {
4345 "links": {
4346 "related": "/action/58aacf0d076adcef394bac36/bundles"
4347 },
4348 "data": [
4349 {
4350 "type": "bundle",
4351 "id": "58aacf0d076adcef394bac30"
4352 }
4353 ]
4354 }
4355 }
4356 },
4357 "included": [],
4358 "meta": {
4359 "req_id": "014ea6d2-4717-4915-b4bc-98454180614e"
4360 }
4361 }
4362 },
4363 "UpdateActionRequest": {
4364 "type": "object",
4365 "required": [
4366 "data"
4367 ],
4368 "properties": {
4369 "data": {
4370 "$ref": "#/definitions/ActionResource"
4371 }
4372 }
4373 },
4374 "UpdateActionResponse": {
4375 "type": "object",
4376 "required": [
4377 "data"
4378 ],
4379 "properties": {
4380 "meta": {
4381 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
4382 },
4383 "data": {
4384 "$ref": "#/definitions/ActionResource"
4385 }
4386 }
4387 },
4388 "FetchActionResponse": {
4389 "type": "object",
4390 "required": [
4391 "data"
4392 ],
4393 "properties": {
4394 "meta": {
4395 "$ref": "#/definitions/FetchMetaResponse"
4396 },
4397 "data": {
4398 "$ref": "#/definitions/ActionResource"
4399 }
4400 },
4401 "example": {
4402 "data": {
4403 "type": "action",
4404 "id": "59653f699fc8be3938f04491",
4405 "attributes": {
4406 "_thread": "weight",
4407 "adherence": {
4408 "due": 1,
4409 "complete": 1,
4410 "streak": {
4411 "count": 1,
4412 "updated_at": "2017-07-11T21:13:13.215Z"
4413 }
4414 },
4415 "effective_from": "2017-07-10T21:13:13.212Z",
4416 "effective_to": "2017-07-11T21:13:13.215Z",
4417 "frequency_goal": {
4418 "weeks": {
4419 "days": [
4420 0
4421 ]
4422 }
4423 },
4424 "frequency_goal_prorated": 0,
4425 "identifiers": [
4426 {
4427 "label": "Super Health Actions",
4428 "system": "http://super.health.example.com",
4429 "value": "action-0123",
4430 "_id": "59653f699fc8be3938f04494"
4431 }
4432 ],
4433 "details": {
4434 "some": "mixed value"
4435 },
4436 "metric_required": true,
4437 "metrics": [
4438 {
4439 "metric_type": "weight",
4440 "unit": "lb",
4441 "goal": {
4442 "data": {
4443 "unit": "lb",
4444 "value": 210
4445 }
4446 },
4447 "_id": "59653f699fc8be3938f04493",
4448 "accepted_values": [],
4449 "validations": {
4450 "maximum": {
4451 "unit": "lb",
4452 "value": 999
4453 },
4454 "minimum": {
4455 "unit": "lb",
4456 "value": 0
4457 }
4458 }
4459 }
4460 ],
4461 "title": "Measure Weight",
4462 "tracking": true,
4463 "windows": [
4464 {
4465 "title": "Morning",
4466 "type": "morning",
4467 "_id": "59653f699fc8be3938f04492"
4468 }
4469 ],
4470 "type": "weight",
4471 "options": []
4472 },
4473 "links": {
4474 "self": "/action/59653f699fc8be3938f04491"
4475 },
4476 "relationships": {
4477 "plan": {
4478 "links": {
4479 "related": "/action/59653f699fc8be3938f04491/plan"
4480 }
4481 },
4482 "bundles": {
4483 "links": {
4484 "related": "/action/59653f699fc8be3938f04491/bundles"
4485 },
4486 "data": []
4487 }
4488 }
4489 },
4490 "included": [],
4491 "meta": {
4492 "req_id": "63bf4340-f256-400e-b391-d801d2a251f6"
4493 }
4494 }
4495 },
4496 "BundleResource": {
4497 "type": "object",
4498 "required": [
4499 "type",
4500 "id"
4501 ],
4502 "properties": {
4503 "type": {
4504 "type": "string"
4505 },
4506 "id": {
4507 "type": "string"
4508 },
4509 "attributes": {
4510 "type": "object",
4511 "required": [
4512 "type",
4513 "title",
4514 "effective_from"
4515 ],
4516 "properties": {
4517 "type": {
4518 "type": "string"
4519 },
4520 "title": {
4521 "type": "string"
4522 },
4523 "effective_from": {
4524 "type": "string",
4525 "format": "dateTime"
4526 },
4527 "effective_to": {
4528 "type": "string",
4529 "format": "dateTime"
4530 },
4531 "_thread": {
4532 "type": "string"
4533 }
4534 }
4535 },
4536 "relationships": {
4537 "type": "object",
4538 "properties": {
4539 "plan": {
4540 "type": "object",
4541 "properties": {
4542 "data": {
4543 "type": "object",
4544 "properties": {
4545 "type": {
4546 "type": "string"
4547 },
4548 "id": {
4549 "type": "string"
4550 }
4551 }
4552 },
4553 "links": {
4554 "type": "object"
4555 }
4556 }
4557 },
4558 "actions": {
4559 "type": "object",
4560 "properties": {
4561 "data": {
4562 "type": "object",
4563 "properties": {
4564 "type": {
4565 "type": "string"
4566 },
4567 "id": {
4568 "type": "string"
4569 }
4570 }
4571 },
4572 "links": {
4573 "type": "object"
4574 }
4575 }
4576 }
4577 }
4578 }
4579 }
4580 },
4581 "UpdateBundleRequest": {
4582 "type": "object",
4583 "required": [
4584 "data"
4585 ],
4586 "properties": {
4587 "data": {
4588 "$ref": "#/definitions/BundleResource"
4589 }
4590 }
4591 },
4592 "UpdateBundleResponse": {
4593 "type": "object",
4594 "required": [
4595 "data"
4596 ],
4597 "properties": {
4598 "meta": {
4599 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
4600 },
4601 "data": {
4602 "$ref": "#/definitions/BundleResource"
4603 }
4604 }
4605 },
4606 "CreateBundleRequest": {
4607 "type": "object",
4608 "required": [
4609 "data"
4610 ],
4611 "properties": {
4612 "data": {
4613 "$ref": "#/definitions/BundleResource"
4614 }
4615 }
4616 },
4617 "CreateBundleResponse": {
4618 "type": "object",
4619 "required": [
4620 "data"
4621 ],
4622 "properties": {
4623 "meta": {
4624 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
4625 },
4626 "data": {
4627 "$ref": "#/definitions/BundleResource"
4628 }
4629 }
4630 },
4631 "FetchBundleResponse": {
4632 "type": "object",
4633 "required": [
4634 "data"
4635 ],
4636 "properties": {
4637 "meta": {
4638 "$ref": "#/definitions/FetchMetaResponse"
4639 },
4640 "data": {
4641 "$ref": "#/definitions/BundleResource"
4642 }
4643 },
4644 "example": {
4645 "data": {
4646 "type": "bundle",
4647 "id": "596535d9608f63d531b7e34a",
4648 "attributes": {
4649 "type": "weight",
4650 "title": "Weight",
4651 "_actions": [
4652 "596535d9608f63d531b7e344"
4653 ],
4654 "effective_from": "2017-07-11T20:31:25.000Z",
4655 "effective_to": "2017-07-11T20:32:25.000Z",
4656 "_thread": "123"
4657 },
4658 "links": {
4659 "self": "/bundle/596535d9608f63d531b7e34a"
4660 },
4661 "relationships": {
4662 "plan": {
4663 "links": {
4664 "related": "/bundle/596535d9608f63d531b7e34a/plan"
4665 }
4666 },
4667 "actions": {
4668 "links": {
4669 "related": "/bundle/596535d9608f63d531b7e34a/actions"
4670 },
4671 "data": [
4672 {
4673 "type": "action",
4674 "id": "596535d9608f63d531b7e344"
4675 }
4676 ]
4677 }
4678 }
4679 },
4680 "included": [],
4681 "meta": {
4682 "req_id": "c0f8d53a-d763-4beb-b0b1-9ec6da146a14"
4683 }
4684 }
4685 },
4686 "CalendarEventResource": {
4687 "type": "object",
4688 "properties": {
4689 "type": {
4690 "type": "string",
4691 "enum": [
4692 "calendar_event"
4693 ]
4694 },
4695 "id": {
4696 "type": "string"
4697 },
4698 "attributes": {
4699 "type": "object",
4700 "properties": {
4701 "completed_by": {
4702 "type": "object",
4703 "description": "The coach who marked the calendar event as completed. Only valid for `plan-check-in` event type."
4704 },
4705 "completed_at": {
4706 "type": "string",
4707 "format": "ISODate",
4708 "example": "2017-11-03T06:17:34.652Z",
4709 "description": "The date and time when the calendar event is marked as completed. Only valid for `plan-check-in` event type."
4710 },
4711 "type": {
4712 "type": "string",
4713 "description": "The type of calendar event. Immutable after event creation.",
4714 "enum": [
4715 "plan-check-in",
4716 "reminder",
4717 "telephone-call",
4718 "office-visit",
4719 "video-call"
4720 ]
4721 },
4722 "time_zone": {
4723 "type": "string",
4724 "description": "The time zone in which the dates for the calendar event are specified",
4725 "example": "America/New_York"
4726 },
4727 "all_day": {
4728 "type": "boolean",
4729 "description": "True if the calendar event is an all day event, false otherwise. Must be set to true for `plan-check-in` event type. If it is true, then `start_at` and `end_at` must also be set to beginning of day, except `plan-check-in` event type does not need an `end_at` date. If it is false, then `start_at` and `end_at` must be on the same day."
4730 },
4731 "start_at": {
4732 "type": "string",
4733 "format": "ISODate",
4734 "description": "The date and time when the calendar event starts",
4735 "example": "2017-11-03T04:00:00.000Z"
4736 },
4737 "end_at": {
4738 "type": "string",
4739 "format": "ISODate",
4740 "description": "The date and time when the calendar event ends. Not valid for `plan-check-in` event type.",
4741 "example": "2017-11-03T08:00:00.000Z"
4742 },
4743 "title": {
4744 "type": "string",
4745 "description": "The title of the calendar event. Must not be empty or null"
4746 },
4747 "location": {
4748 "type": "string"
4749 },
4750 "description": {
4751 "type": "string"
4752 },
4753 "attendees": {
4754 "type": "array",
4755 "description": "List of attendees for the calendar event",
4756 "items": {
4757 "type": "object",
4758 "properties": {
4759 "user": {
4760 "type": "string"
4761 },
4762 "response_status": {
4763 "type": "string",
4764 "description": "Status of responses from attendees",
4765 "enum": [
4766 "needsAction",
4767 "declined",
4768 "tentative",
4769 "accepted"
4770 ]
4771 }
4772 }
4773 }
4774 }
4775 }
4776 },
4777 "links": {
4778 "type": "object",
4779 "properties": {
4780 "self": {
4781 "type": "string",
4782 "pattern": "/calendar_event/[0-9a-z]+",
4783 "example": "/calendar_event/5a0c8e2aa9d454cc1509a142"
4784 }
4785 }
4786 },
4787 "relationships": {
4788 "type": "object",
4789 "properties": {
4790 "owner": {
4791 "type": "object",
4792 "required": [
4793 "data"
4794 ],
4795 "properties": {
4796 "data": {
4797 "type": "object",
4798 "properties": {
4799 "type": {
4800 "type": "string"
4801 },
4802 "id": {
4803 "type": "string"
4804 }
4805 }
4806 },
4807 "links": {
4808 "type": "object",
4809 "properties": {
4810 "related": {
4811 "type": "string",
4812 "pattern": "/pub/calendar_event/[0-9a-z]+",
4813 "example": "/pub/calendar_event/5a0c8e2aa9d454cc1509a142/owner"
4814 }
4815 }
4816 }
4817 },
4818 "description": "The owner is the patient for whom the calendar event is created specificially for"
4819 }
4820 }
4821 }
4822 },
4823 "example": {
4824 "type": "calendar_event",
4825 "id": "5a0c8e2aa9d454cc1509a142",
4826 "attributes": {
4827 "completed_at": "2017-11-03T06:17:34.652Z",
4828 "completed_by": "5a0c8e27a9d454cc150997c9",
4829 "type": "plan-check-in",
4830 "time_zone": "America/New_York",
4831 "all_day": true,
4832 "start_at": "2017-11-03T04:00:00.000Z",
4833 "end_at": "2017-11-03T08:00:00.000Z",
4834 "title": "Plan Check-In",
4835 "attendees": [
4836 {
4837 "_id": "5ac7e74679f6868274a42e28",
4838 "user": "5a0c8e27a9d454cc150997c9",
4839 "response_status": "needsAction"
4840 },
4841 {
4842 "_id": "5ac7e74679f6868274a42e27",
4843 "user": "5a0c8e27a9d454cc150997f7",
4844 "response_status": "needsAction"
4845 }
4846 ],
4847 "created_at": "2017-10-20T10:59:40.000Z",
4848 "created_by": "5a0c8e27a9d454cc150997c9",
4849 "updated_at": "2017-10-20T10:59:40.000Z",
4850 "updated_by": "5a0c8e27a9d454cc150997c9"
4851 },
4852 "relationships": {
4853 "owner": {
4854 "links": {
4855 "related": "/pub/calendar_event/5a0c8e2aa9d454cc1509a142/owner"
4856 },
4857 "data": {
4858 "type": "patient",
4859 "id": "5a0c8e27a9d454cc150997f7"
4860 }
4861 }
4862 },
4863 "links": {
4864 "self": "/pub/calendar_event/5a0c8e2aa9d454cc1509a142"
4865 }
4866 }
4867 },
4868 "CreateCalendarEventRequest": {
4869 "type": "object",
4870 "required": [
4871 "data"
4872 ],
4873 "properties": {
4874 "data": {
4875 "type": "object",
4876 "required": [
4877 "type",
4878 "attributes",
4879 "relationships"
4880 ],
4881 "properties": {
4882 "type": {
4883 "$ref": "#/definitions/CalendarEventResource/properties/type"
4884 },
4885 "attributes": {
4886 "required": [
4887 "type",
4888 "start_at",
4889 "title",
4890 "attendees"
4891 ],
4892 "allOf": [
4893 {
4894 "$ref": "#/definitions/CalendarEventResource/properties/attributes"
4895 }
4896 ]
4897 },
4898 "relationships": {
4899 "type": "object",
4900 "properties": {
4901 "owner": {
4902 "type": "object",
4903 "required": [
4904 "data"
4905 ],
4906 "properties": {
4907 "data": {
4908 "$ref": "#/definitions/CalendarEventResource/properties/relationships/properties/owner/properties/data"
4909 }
4910 }
4911 }
4912 }
4913 }
4914 }
4915 }
4916 },
4917 "example": {
4918 "data": {
4919 "type": "calendar_event",
4920 "attributes": {
4921 "type": "plan-check-in",
4922 "time_zone": "America/New_York",
4923 "all_day": true,
4924 "start_at": "2018-02-20T00:00:00Z",
4925 "title": "Plan Check-In",
4926 "attendees": [
4927 {
4928 "user": "5a0c8e27a9d454cc150997c9"
4929 },
4930 {
4931 "user": "5a0c8e27a9d454cc150997f7"
4932 }
4933 ]
4934 },
4935 "relationships": {
4936 "owner": {
4937 "data": {
4938 "type": "patient",
4939 "id": "5a0c8e27a9d454cc150997f7"
4940 }
4941 }
4942 }
4943 }
4944 }
4945 },
4946 "CreateCalendarEventResponse": {
4947 "type": "object",
4948 "properties": {
4949 "meta": {
4950 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
4951 },
4952 "data": {
4953 "$ref": "#/definitions/CalendarEventResource"
4954 }
4955 }
4956 },
4957 "UpdateCalendarEventRequest": {
4958 "type": "object",
4959 "properties": {
4960 "data": {
4961 "type": "object",
4962 "required": [
4963 "type",
4964 "id"
4965 ],
4966 "properties": {
4967 "type": {
4968 "$ref": "#/definitions/CalendarEventResource/properties/type"
4969 },
4970 "id": {
4971 "$ref": "#/definitions/CalendarEventResource/properties/id"
4972 },
4973 "attributes": {
4974 "allOf": [
4975 {
4976 "$ref": "#/definitions/CalendarEventResource/properties/attributes"
4977 }
4978 ]
4979 },
4980 "relationships": {
4981 "type": "object",
4982 "properties": {
4983 "owner": {
4984 "type": "object",
4985 "properties": {
4986 "data": {
4987 "$ref": "#/definitions/CalendarEventResource/properties/relationships/properties/owner/properties/data"
4988 }
4989 }
4990 }
4991 }
4992 }
4993 }
4994 }
4995 },
4996 "example": {
4997 "data": {
4998 "type": "calendar_event",
4999 "id": "42ba7c2da9d45415234345b3",
5000 "attributes": {
5001 "completed_at": "2017-11-03T06:17:34.652Z",
5002 "completed_by": "5a0c8e27a9d454cc150997c9",
5003 "type": "telephone-call",
5004 "time_zone": "America/New_York",
5005 "all_day": false,
5006 "start_at": "2018-02-20T14:00:00Z",
5007 "end_at": "2018-02-20T18:00:00Z",
5008 "title": "Telephone Call",
5009 "attendees": [
5010 {
5011 "user": "5a0c8e27a9d454cc150997c9"
5012 },
5013 {
5014 "user": "5a0c8e27a9d454cc150997f7"
5015 }
5016 ]
5017 },
5018 "relationships": {
5019 "owner": {
5020 "data": {
5021 "type": "patient",
5022 "id": "5a0c8e27a9d454cc150997f7"
5023 }
5024 }
5025 }
5026 }
5027 }
5028 },
5029 "UpdateCalendarEventResponse": {
5030 "type": "object",
5031 "properties": {
5032 "meta": {
5033 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
5034 },
5035 "data": {
5036 "$ref": "#/definitions/CalendarEventResource"
5037 }
5038 }
5039 },
5040 "FetchCalendarEventResponse": {
5041 "type": "object",
5042 "properties": {
5043 "meta": {
5044 "$ref": "#/definitions/FetchMetaResponse"
5045 },
5046 "data": {
5047 "$ref": "#/definitions/CalendarEventResource"
5048 },
5049 "included": {
5050 "description": "Related resources which are included in the response based on the `include` param.\nAttributes of each resource will vary depending on the type.\nSee [patient](#operation/fetchPatient)\n",
5051 "type": "array",
5052 "items": {
5053 "$ref": "#/definitions/Resource"
5054 }
5055 }
5056 }
5057 },
5058 "FetchCalendarEventsResponse": {
5059 "type": "object",
5060 "properties": {
5061 "meta": {
5062 "$ref": "#/definitions/FetchMetaResponse"
5063 },
5064 "links": {
5065 "$ref": "#/definitions/CollectionResponseLinks"
5066 },
5067 "data": {
5068 "type": "array",
5069 "items": {
5070 "$ref": "#/definitions/CalendarEventResource"
5071 }
5072 },
5073 "included": {
5074 "description": "Related resources which are included in the response based on the `include` param.\nAttributes of each resource will vary depending on the type.\nSee [patient](#operation/fetchPatient)\n",
5075 "type": "array",
5076 "items": {
5077 "$ref": "#/definitions/Resource"
5078 }
5079 }
5080 }
5081 },
5082 "CalendarEventResponseResource": {
5083 "type": "object",
5084 "properties": {
5085 "type": {
5086 "type": "string",
5087 "enum": [
5088 "calendar_event_response"
5089 ]
5090 },
5091 "id": {
5092 "type": "string"
5093 },
5094 "attributes": {
5095 "type": "object",
5096 "properties": {
5097 "attendee": {
5098 "type": "object",
5099 "description": "The attendee in the attendees list of the calendar event."
5100 },
5101 "response_status": {
5102 "type": "string",
5103 "description": "The response status for the attendee.",
5104 "enum": [
5105 "accepted",
5106 "declined",
5107 "tentative"
5108 ]
5109 }
5110 }
5111 },
5112 "links": {
5113 "type": "object",
5114 "properties": {
5115 "self": {
5116 "type": "string",
5117 "pattern": "/calendar_event_response/[0-9a-z]+",
5118 "example": "/calendar_event_response/5ad0f966ceb0909e4bfa84dd"
5119 }
5120 }
5121 },
5122 "relationships": {
5123 "type": "object",
5124 "properties": {
5125 "user": {
5126 "type": "object",
5127 "required": [
5128 "data"
5129 ],
5130 "properties": {
5131 "data": {
5132 "type": "object",
5133 "properties": {
5134 "type": {
5135 "type": "string"
5136 },
5137 "id": {
5138 "type": "string"
5139 }
5140 }
5141 },
5142 "links": {
5143 "type": "object",
5144 "properties": {
5145 "related": {
5146 "type": "string",
5147 "pattern": "/pub/calendar_event_response/[0-9a-z]+",
5148 "example": "/pub/calendar_event_response/5ad0f966ceb0909e4bfa84dd/user"
5149 }
5150 }
5151 }
5152 },
5153 "description": "The user is the coach or patient for whom the calendar event response is created specificially for"
5154 },
5155 "calendar_event": {
5156 "type": "object",
5157 "required": [
5158 "data"
5159 ],
5160 "properties": {
5161 "data": {
5162 "type": "object",
5163 "properties": {
5164 "type": {
5165 "type": "string"
5166 },
5167 "id": {
5168 "type": "string"
5169 }
5170 }
5171 },
5172 "links": {
5173 "type": "object",
5174 "properties": {
5175 "related": {
5176 "type": "string",
5177 "pattern": "/pub/calendar_event_response/[0-9a-z]+",
5178 "example": "/pub/calendar_event_response/5ad0f966ceb0909e4bfa84dd/calendar_event"
5179 }
5180 }
5181 }
5182 },
5183 "description": "The calendar_event is the calendar event for which the calendar event response is created specificially for"
5184 }
5185 }
5186 }
5187 },
5188 "example": {
5189 "type": "calendar_event_response",
5190 "id": "5ad0f966ceb0909e4bfa84dd",
5191 "attributes": {
5192 "attendee": "5ac7e74679f6868274a42e28",
5193 "response_status": "accepted"
5194 },
5195 "relationships": {
5196 "user": {
5197 "links": {
5198 "related": "/pub/calendar_event_response/5ad0f966ceb0909e4bfa84dd/user"
5199 },
5200 "data": {
5201 "type": "user",
5202 "id": "5a0c8e27a9d454cc150997f7"
5203 }
5204 },
5205 "calendar_event": {
5206 "links": {
5207 "related": "/pub/calendar_event_response/5ad0f966ceb0909e4bfa84dd/calendar_event"
5208 },
5209 "data": {
5210 "type": "calendar_event",
5211 "id": "5755db2a3db4179179999acf"
5212 }
5213 }
5214 },
5215 "links": {
5216 "self": "/pub/calendar_event_response/5ad0f966ceb0909e4bfa84dd"
5217 }
5218 }
5219 },
5220 "CreateCalendarEventResponseRequest": {
5221 "type": "object",
5222 "required": [
5223 "data"
5224 ],
5225 "properties": {
5226 "data": {
5227 "type": "object",
5228 "required": [
5229 "type",
5230 "attributes",
5231 "relationships"
5232 ],
5233 "properties": {
5234 "type": {
5235 "$ref": "#/definitions/CalendarEventResponseResource/properties/type"
5236 },
5237 "attributes": {
5238 "required": [
5239 "attendee",
5240 "response_status"
5241 ],
5242 "allOf": [
5243 {
5244 "$ref": "#/definitions/CalendarEventResponseResource/properties/attributes"
5245 }
5246 ]
5247 },
5248 "relationships": {
5249 "type": "object",
5250 "properties": {
5251 "user": {
5252 "type": "object",
5253 "required": [
5254 "data"
5255 ],
5256 "properties": {
5257 "data": {
5258 "$ref": "#/definitions/CalendarEventResponseResource/properties/relationships/properties/user/properties/data"
5259 }
5260 }
5261 },
5262 "calendar_event": {
5263 "type": "object",
5264 "required": [
5265 "data"
5266 ],
5267 "properties": {
5268 "data": {
5269 "$ref": "#/definitions/CalendarEventResponseResource/properties/relationships/properties/calendar_event/properties/data"
5270 }
5271 }
5272 }
5273 }
5274 }
5275 }
5276 }
5277 },
5278 "example": {
5279 "data": {
5280 "type": "calendar_event_response",
5281 "attributes": {
5282 "attendee": "5ac7e74679f6868274a42e28",
5283 "response_status": "accepted"
5284 },
5285 "relationships": {
5286 "user": {
5287 "data": {
5288 "type": "user",
5289 "id": "5a0c8e27a9d454cc150997f7"
5290 }
5291 },
5292 "calendar_event": {
5293 "data": {
5294 "type": "calendar_event",
5295 "id": "5755db2a3db4179179999acf"
5296 }
5297 }
5298 }
5299 }
5300 }
5301 },
5302 "EmailHistoryResource": {
5303 "type": "object",
5304 "required": [
5305 "type"
5306 ],
5307 "properties": {
5308 "type": {
5309 "type": "string"
5310 },
5311 "id": {
5312 "type": "string"
5313 },
5314 "attributes": {
5315 "type": "object",
5316 "properties": {
5317 "twine_email_id": {
5318 "description": "Unique identifier for this email.",
5319 "type": "string"
5320 },
5321 "email_address": {
5322 "description": "Address email was sent to.",
5323 "type": "string"
5324 },
5325 "email_type": {
5326 "description": "Type of email.",
5327 "type": "string"
5328 },
5329 "send_time": {
5330 "description": "Time email was sent.",
5331 "type": "string",
5332 "format": "dateTime"
5333 },
5334 "status_times": {
5335 "description": "Status of email. Multiple statuses may be defined. The current status is the one with the most recent date.",
5336 "type": "object",
5337 "properties": {
5338 "processed": {
5339 "description": "Time email was processed.",
5340 "type": "string",
5341 "format": "dateTime"
5342 },
5343 "dropped": {
5344 "description": "Time email was dropped.",
5345 "type": "string",
5346 "format": "dateTime"
5347 },
5348 "deferred": {
5349 "description": "Time email was deferred.",
5350 "type": "string",
5351 "format": "dateTime"
5352 },
5353 "bounce": {
5354 "description": "Time email was bounced.",
5355 "type": "string",
5356 "format": "dateTime"
5357 },
5358 "open": {
5359 "description": "Time email was opened.",
5360 "type": "string",
5361 "format": "dateTime"
5362 },
5363 "spamreport": {
5364 "description": "Time email was reported as spam.",
5365 "type": "string",
5366 "format": "dateTime"
5367 },
5368 "unsubscribe": {
5369 "description": "Time email was unsubscribed from.",
5370 "type": "string",
5371 "format": "dateTime"
5372 },
5373 "click": {
5374 "description": "Time email was clicked.",
5375 "type": "string",
5376 "format": "dateTime"
5377 },
5378 "delivered": {
5379 "description": "Time email was delivered.",
5380 "type": "string",
5381 "format": "dateTime"
5382 }
5383 }
5384 }
5385 }
5386 },
5387 "relationships": {
5388 "type": "object",
5389 "properties": {
5390 "sender": {
5391 "type": "object",
5392 "properties": {
5393 "data": {
5394 "type": "object",
5395 "properties": {
5396 "type": {
5397 "type": "string"
5398 },
5399 "id": {
5400 "type": "string"
5401 }
5402 }
5403 }
5404 }
5405 },
5406 "receiver": {
5407 "type": "object",
5408 "properties": {
5409 "data": {
5410 "type": "object",
5411 "properties": {
5412 "type": {
5413 "type": "string"
5414 },
5415 "id": {
5416 "type": "string"
5417 }
5418 }
5419 }
5420 }
5421 }
5422 }
5423 }
5424 },
5425 "example": {
5426 "type": "email_history",
5427 "id": "595fddec28c5041b84467592",
5428 "attributes": {
5429 "created_at": "2017-07-07T19:15:56.229Z",
5430 "created_by": "595fd88ef4be5b1a797ff19b",
5431 "email_address": "tony@example.com",
5432 "email_type": "invite",
5433 "send_time": "2017-02-25T13:35:01.000Z",
5434 "status_times": {
5435 "delivered": "2017-02-25T13:35:03.000Z",
5436 "open": "2017-02-25T14:20:00.000Z",
5437 "processed": "2017-02-25T13:35:02.000Z"
5438 },
5439 "twine_email_id": "576226e5-7e25-4469-b10d-2bc6a725bfbc",
5440 "updated_at": "2017-07-07T19:15:56.229Z",
5441 "updated_by": "595fd88ef4be5b1a797ff19b"
5442 },
5443 "relationships": {
5444 "receiver": {
5445 "data": {
5446 "id": "595fddea28c5041b84466bbe",
5447 "type": "patient"
5448 },
5449 "links": {
5450 "related": "/pub/email_history/595fddec28c5041b84467592/receiver"
5451 }
5452 },
5453 "sender": {
5454 "links": {
5455 "related": "/pub/email_history/595fddec28c5041b84467592/sender"
5456 }
5457 }
5458 },
5459 "links": {
5460 "self": "/pub/email_history/595fddec28c5041b84467592"
5461 }
5462 }
5463 },
5464 "FetchEmailHistoryResponse": {
5465 "type": "object",
5466 "required": [
5467 "data"
5468 ],
5469 "properties": {
5470 "meta": {
5471 "$ref": "#/definitions/FetchMetaResponse"
5472 },
5473 "data": {
5474 "$ref": "#/definitions/EmailHistoryResource"
5475 }
5476 }
5477 },
5478 "FetchEmailHistoriesResponse": {
5479 "type": "object",
5480 "required": [
5481 "data"
5482 ],
5483 "properties": {
5484 "meta": {
5485 "$ref": "#/definitions/FetchMetaResponse"
5486 },
5487 "data": {
5488 "type": "array",
5489 "items": {
5490 "$ref": "#/definitions/EmailHistoryResource"
5491 }
5492 }
5493 }
5494 },
5495 "HealthProfileResource": {
5496 "type": "object",
5497 "required": [
5498 "type"
5499 ],
5500 "properties": {
5501 "type": {
5502 "type": "string"
5503 },
5504 "id": {
5505 "type": "string"
5506 },
5507 "attributes": {
5508 "type": "object",
5509 "properties": {
5510 "stats": {
5511 "type": "array",
5512 "description": "List of category, answered and total counts for questions in the health profile",
5513 "items": {
5514 "type": "object",
5515 "description": "The category, answered and total counts for questions in the health profile",
5516 "properties": {
5517 "category": {
5518 "type": "string",
5519 "enum": [
5520 "lifestyle_behaviors",
5521 "mental_wellbeing",
5522 "preventative_care",
5523 "overall"
5524 ]
5525 },
5526 "answered": {
5527 "type": "number"
5528 },
5529 "total": {
5530 "type": "number"
5531 }
5532 }
5533 }
5534 }
5535 }
5536 },
5537 "links": {
5538 "type": "object",
5539 "readOnly": true,
5540 "required": [
5541 "self"
5542 ],
5543 "properties": {
5544 "self": {
5545 "type": "string",
5546 "pattern": "/health_profile/[0-9a-z]+",
5547 "example": "/health_profile/59d441ac21741161bbe266b5"
5548 }
5549 }
5550 },
5551 "relationships": {
5552 "type": "object",
5553 "properties": {
5554 "patient": {
5555 "type": "object",
5556 "readOnly": true,
5557 "properties": {
5558 "data": {
5559 "type": "object",
5560 "properties": {
5561 "type": {
5562 "type": "string"
5563 },
5564 "id": {
5565 "type": "string"
5566 }
5567 }
5568 },
5569 "links": {
5570 "type": "object",
5571 "readOnly": true,
5572 "properties": {
5573 "related": {
5574 "type": "string",
5575 "pattern": "/pub/health_profile/[0-9a-z]+",
5576 "example": "/pub/health_profile/59d441ac21741161bbe266b5/patient"
5577 }
5578 }
5579 }
5580 }
5581 },
5582 "questions": {
5583 "type": "object",
5584 "readOnly": true,
5585 "properties": {
5586 "data": {
5587 "type": "array",
5588 "items": {
5589 "type": "object",
5590 "properties": {
5591 "type": {
5592 "type": "string"
5593 },
5594 "id": {
5595 "type": "string"
5596 }
5597 }
5598 }
5599 },
5600 "links": {
5601 "type": "object",
5602 "readOnly": true,
5603 "properties": {
5604 "related": {
5605 "type": "string",
5606 "pattern": "/pub/health_profile/[0-9a-z]+",
5607 "example": "/pub/health_profile/59d441ac21741161bbe266b5/questions"
5608 }
5609 }
5610 }
5611 }
5612 }
5613 }
5614 }
5615 },
5616 "example": {
5617 "type": "health_profile",
5618 "id": "59d441ac21741161bbe266b5",
5619 "attributes": {
5620 "created_at": "2017-07-07T19:15:56.229Z",
5621 "stats": [
5622 {
5623 "category": "lifestyle_behaviors",
5624 "answered": 5,
5625 "total": 11
5626 },
5627 {
5628 "category": "mental_wellbeing",
5629 "answered": 3,
5630 "total": 5
5631 },
5632 {
5633 "category": "preventative_care",
5634 "answered": 1,
5635 "total": 3
5636 },
5637 {
5638 "category": "overall",
5639 "answered": 9,
5640 "total": 19
5641 }
5642 ],
5643 "updated_at": "2017-07-07T19:15:56.229Z"
5644 },
5645 "relationships": {
5646 "patient": {
5647 "data": {
5648 "id": "595fddea28c5041b84466bbe",
5649 "type": "patient"
5650 },
5651 "links": {
5652 "related": "/pub/health_profile/59d441ac21741161bbe266b5/patient"
5653 }
5654 },
5655 "questions": {
5656 "data": [
5657 {
5658 "id": "595fddea28c5041b84466bbe",
5659 "type": "health_profile_question"
5660 }
5661 ],
5662 "links": {
5663 "related": "/pub/health_profile/59d441ac21741161bbe266b5/questions"
5664 }
5665 }
5666 },
5667 "links": {
5668 "self": "/pub/health_profile/59d441ac21741161bbe266b5"
5669 }
5670 }
5671 },
5672 "FetchHealthProfileResponse": {
5673 "type": "object",
5674 "required": [
5675 "data"
5676 ],
5677 "properties": {
5678 "meta": {
5679 "$ref": "#/definitions/FetchMetaResponse"
5680 },
5681 "data": {
5682 "$ref": "#/definitions/HealthProfileResource"
5683 },
5684 "included": {
5685 "description": "Related resources which are included in the response based on the `include` param.\nAttributes of each resource will vary depending on the type.\nSee [patient](#operation/fetchPatient), [question](#operation/fetchHealthProfileQuestion)\n",
5686 "type": "array",
5687 "items": {
5688 "$ref": "#/definitions/Resource"
5689 }
5690 }
5691 }
5692 },
5693 "FetchHealthProfilesResponse": {
5694 "type": "object",
5695 "required": [
5696 "data"
5697 ],
5698 "properties": {
5699 "meta": {
5700 "$ref": "#/definitions/FetchMetaResponse"
5701 },
5702 "links": {
5703 "$ref": "#/definitions/CollectionResponseLinks"
5704 },
5705 "data": {
5706 "type": "array",
5707 "items": {
5708 "$ref": "#/definitions/HealthProfileResource"
5709 }
5710 },
5711 "included": {
5712 "description": "Related resources which are included in the response based on the `include` param.\nAttributes of each resource will vary depending on the type.\nSee [patient](#operation/fetchPatient), [question](#operation/fetchHealthProfileQuestion)\n",
5713 "type": "array",
5714 "items": {
5715 "$ref": "#/definitions/Resource"
5716 }
5717 }
5718 }
5719 },
5720 "HealthProfileQuestionResource": {
5721 "type": "object",
5722 "required": [
5723 "type",
5724 "id"
5725 ],
5726 "properties": {
5727 "type": {
5728 "type": "string"
5729 },
5730 "id": {
5731 "type": "string"
5732 },
5733 "attributes": {
5734 "type": "object",
5735 "description": "A health profile question does not have any attribute since it only relates an answer to the corresponding question definition.\n"
5736 },
5737 "links": {
5738 "type": "object",
5739 "readOnly": true,
5740 "required": [
5741 "self"
5742 ],
5743 "properties": {
5744 "self": {
5745 "type": "string",
5746 "pattern": "/pub/health_profile_question/[0-9a-z]+",
5747 "example": "/pub/health_profile_question/59d435931d078505ba744e88"
5748 }
5749 }
5750 },
5751 "relationships": {
5752 "type": "object",
5753 "properties": {
5754 "answer": {
5755 "type": "object",
5756 "properties": {
5757 "data": {
5758 "type": "object",
5759 "properties": {
5760 "type": {
5761 "type": "string"
5762 },
5763 "id": {
5764 "type": "string"
5765 }
5766 }
5767 },
5768 "links": {
5769 "type": "object",
5770 "readOnly": true,
5771 "properties": {
5772 "related": {
5773 "type": "string",
5774 "pattern": "/pub/health_profile_question/[0-9a-z]+/answer",
5775 "example": "/pub/health_profile_question/59d435931d078505ba744e88/answer"
5776 }
5777 }
5778 }
5779 }
5780 },
5781 "profile": {
5782 "type": "object",
5783 "properties": {
5784 "links": {
5785 "type": "object",
5786 "readOnly": true,
5787 "properties": {
5788 "related": {
5789 "type": "string",
5790 "pattern": "/pub/health_profile_question/[0-9a-z]+/profile",
5791 "example": "/pub/health_profile_question/59d435931d078505ba744e88/profile"
5792 }
5793 }
5794 }
5795 }
5796 },
5797 "question_definition": {
5798 "type": "object",
5799 "properties": {
5800 "data": {
5801 "type": "object",
5802 "properties": {
5803 "type": {
5804 "type": "string"
5805 },
5806 "id": {
5807 "type": "string"
5808 }
5809 }
5810 },
5811 "links": {
5812 "readOnly": true,
5813 "properties": {
5814 "links": {
5815 "type": "object",
5816 "readOnly": true,
5817 "properties": {
5818 "related": {
5819 "type": "string",
5820 "pattern": "/pub/health_profile_question/[0-9a-z]+/question_definition",
5821 "example": "/pub/health_profile_question/59d435931d078505ba744e88/question_definition"
5822 }
5823 }
5824 }
5825 }
5826 }
5827 }
5828 }
5829 }
5830 }
5831 },
5832 "example": {
5833 "type": "health_profile_question",
5834 "id": "52b36e3c04ad8c2224f2aa67",
5835 "attribute": {},
5836 "relationships": {
5837 "answer": {
5838 "data": {
5839 "id": "595fddea28c5041b84466bbe",
5840 "type": "health_profile_answer"
5841 },
5842 "links": {
5843 "related": "/pub/health_profile_question/59d435931d078505ba744e88/answer"
5844 }
5845 },
5846 "profile": {
5847 "links": {
5848 "related": "/pub/health_profile_question/59d435931d078505ba744e88/profile"
5849 }
5850 },
5851 "question_definition": {
5852 "data": {
5853 "id": "4",
5854 "type": "health_question_definition"
5855 },
5856 "links": {
5857 "related": "/pub/health_profile_question/59d435931d078505ba744e88/question_definition"
5858 }
5859 }
5860 },
5861 "links": {
5862 "self": "/pub/health_profile_question/59d435931d078505ba744e88"
5863 }
5864 }
5865 },
5866 "FetchHealthProfileQuestionResponse": {
5867 "type": "object",
5868 "required": [
5869 "data"
5870 ],
5871 "properties": {
5872 "meta": {
5873 "$ref": "#/definitions/FetchMetaResponse"
5874 },
5875 "data": {
5876 "$ref": "#/definitions/HealthProfileQuestionResource"
5877 },
5878 "included": {
5879 "description": "Related resources which are included in the response based on the `include` param.\nAttributes of each resource will vary depending on the type.\nSee [question_definition](#operation/fetchHealthQuestionDefinition), [answer](#operation/fetchHealthProfileAnswer)\n",
5880 "type": "array",
5881 "items": {
5882 "$ref": "#/definitions/Resource"
5883 }
5884 }
5885 }
5886 },
5887 "HealthProfileAnswerResource": {
5888 "type": "object",
5889 "required": [
5890 "type",
5891 "id"
5892 ],
5893 "properties": {
5894 "type": {
5895 "type": "string"
5896 },
5897 "id": {
5898 "type": "string"
5899 },
5900 "attributes": {
5901 "type": "object",
5902 "properties": {
5903 "history": {
5904 "type": "array",
5905 "description": "List of details of previous answers for a health profile question",
5906 "items": {
5907 "type": "object",
5908 "description": "The details of a previous answer for a health profile question",
5909 "properties": {
5910 "answered_at": {
5911 "type": "string",
5912 "format": "dateTime",
5913 "description": "The date when the health profile question is answered"
5914 },
5915 "value": {
5916 "type": "string",
5917 "description": "The value of the answer entered for the health profile question"
5918 },
5919 "_created_by": {
5920 "type": "string",
5921 "description": "The id of the patient or coach who answered the health profile question"
5922 }
5923 }
5924 }
5925 },
5926 "latest": {
5927 "type": "object",
5928 "description": "The details of the latest answer for a health profile question",
5929 "properties": {
5930 "answered_at": {
5931 "type": "string",
5932 "format": "dateTime",
5933 "description": "The date when the health profile question is answered"
5934 },
5935 "value": {
5936 "type": "string",
5937 "description": "The value of the answer entered for the health profile question"
5938 },
5939 "_created_by": {
5940 "type": "string",
5941 "description": "The id of the patient or coach who answered the health profile question"
5942 }
5943 }
5944 },
5945 "question_id": {
5946 "type": "string"
5947 }
5948 }
5949 },
5950 "links": {
5951 "type": "object",
5952 "readOnly": true,
5953 "required": [
5954 "self"
5955 ],
5956 "properties": {
5957 "self": {
5958 "type": "string",
5959 "pattern": "/health_profile_answer/[0-9a-z]+",
5960 "example": "/health_profile_answer/59d441ac21741161bbe266b5"
5961 }
5962 }
5963 },
5964 "relationships": {
5965 "type": "object",
5966 "properties": {
5967 "patient": {
5968 "type": "object",
5969 "readOnly": true,
5970 "properties": {
5971 "data": {
5972 "type": "object",
5973 "properties": {
5974 "type": {
5975 "type": "string"
5976 },
5977 "id": {
5978 "type": "string"
5979 }
5980 }
5981 },
5982 "links": {
5983 "type": "object",
5984 "readOnly": true,
5985 "properties": {
5986 "related": {
5987 "type": "string",
5988 "pattern": "/pub/health_profile_answer/[0-9a-z]+",
5989 "example": "/pub/health_profile_answer/59d441ac21741161bbe266b5/patient"
5990 }
5991 }
5992 }
5993 }
5994 }
5995 }
5996 }
5997 },
5998 "example": {
5999 "type": "health_profile_answer",
6000 "id": "59d441ac21741161bbe266b5",
6001 "attributes": {
6002 "created_at": "2017-07-07T19:15:56.229Z",
6003 "history": [
6004 {
6005 "answered_at": "2017-10-03T12:45:16.720Z",
6006 "value": "2",
6007 "_created_by": "59d4d7dcd843ee01be71fcf8",
6008 "_id": "59d4d7dcd843ee01be71fcfb"
6009 }
6010 ],
6011 "latest": {
6012 "answered_at": "2017-10-04T12:45:16.720Z",
6013 "value": "1",
6014 "_created_by": "59d4d7dcd843ee01be71fcf8"
6015 },
6016 "question_id": "4",
6017 "updated_at": "2017-07-07T19:15:56.229Z"
6018 },
6019 "relationships": {
6020 "patient": {
6021 "data": {
6022 "id": "595fddea28c5041b84466bbe",
6023 "type": "patient"
6024 },
6025 "links": {
6026 "related": "/pub/health_profile_answer/59d441ac21741161bbe266b5/patient"
6027 }
6028 }
6029 },
6030 "links": {
6031 "self": "/pub/health_profile_answer/59d441ac21741161bbe266b5"
6032 }
6033 }
6034 },
6035 "FetchHealthProfileAnswerResponse": {
6036 "type": "object",
6037 "required": [
6038 "data"
6039 ],
6040 "properties": {
6041 "meta": {
6042 "$ref": "#/definitions/FetchMetaResponse"
6043 },
6044 "data": {
6045 "$ref": "#/definitions/HealthProfileAnswerResource"
6046 },
6047 "included": {
6048 "description": "Related resources which are included in the response based on the `include` param.\nAttributes of each resource will vary depending on the type.\nSee [patient](#operation/fetchPatient)\n",
6049 "type": "array",
6050 "items": {
6051 "$ref": "#/definitions/Resource"
6052 }
6053 }
6054 }
6055 },
6056 "FetchHealthProfileAnswersResponse": {
6057 "type": "object",
6058 "required": [
6059 "data"
6060 ],
6061 "properties": {
6062 "meta": {
6063 "$ref": "#/definitions/FetchMetaResponse"
6064 },
6065 "links": {
6066 "$ref": "#/definitions/CollectionResponseLinks"
6067 },
6068 "data": {
6069 "type": "array",
6070 "items": {
6071 "$ref": "#/definitions/HealthProfileAnswerResource"
6072 }
6073 },
6074 "included": {
6075 "description": "Related resources which are included in the response based on the `include` param.\nAttributes of each resource will vary depending on the type.\nSee [patient](#operation/fetchPatient)\n",
6076 "type": "array",
6077 "items": {
6078 "$ref": "#/definitions/Resource"
6079 }
6080 }
6081 }
6082 },
6083 "HealthQuestionDefinitionResource": {
6084 "type": "object",
6085 "required": [
6086 "type",
6087 "id"
6088 ],
6089 "properties": {
6090 "type": {
6091 "type": "string"
6092 },
6093 "id": {
6094 "type": "string"
6095 },
6096 "attributes": {
6097 "type": "object",
6098 "properties": {
6099 "category": {
6100 "type": "string",
6101 "enum": [
6102 "lifestyle_behaviors",
6103 "mental_wellbeing",
6104 "preventative_care"
6105 ],
6106 "description": "The category for the health profile definition"
6107 },
6108 "format": {
6109 "type": "object",
6110 "description": "The list of formats for the health profile definition",
6111 "properties": {
6112 "data": {
6113 "type": "array",
6114 "items": {
6115 "type": "object",
6116 "description": "The label, value and icon for the answer choices for the question",
6117 "properties": {
6118 "label": {
6119 "type": "string"
6120 },
6121 "value": {
6122 "type": "string"
6123 },
6124 "icon": {
6125 "type": "string"
6126 }
6127 }
6128 }
6129 },
6130 "type": {
6131 "type": "string"
6132 }
6133 }
6134 },
6135 "requirements": {
6136 "type": "array",
6137 "description": "The lsit of age and gender requirements for the question to be included",
6138 "items": {
6139 "type": "object",
6140 "description": "The age and gender requirement for the question to be included",
6141 "properties": {
6142 "property": {
6143 "type": "string"
6144 },
6145 "shouldBeEqual": {
6146 "type": "boolean",
6147 "description": "Specifies if the value in property should be equal to the one in value"
6148 },
6149 "shouldBeGreaterThan": {
6150 "type": "number",
6151 "description": "Specifies if the value in property should be greater than the one in value"
6152 },
6153 "shouldBeLessThan": {
6154 "type": "number",
6155 "description": "Specifies if the value in property should be less than the one in value"
6156 },
6157 "value": {
6158 "type": "string",
6159 "description": "The value to be compared with the one in property, based on shouldBeEqual, shouldBeGreaterThan, or shouldBeLessThan"
6160 }
6161 }
6162 }
6163 },
6164 "text": {
6165 "type": "string",
6166 "description": "The question text which corresponds to the answer choices"
6167 }
6168 }
6169 },
6170 "links": {
6171 "type": "object",
6172 "readOnly": true,
6173 "required": [
6174 "self"
6175 ],
6176 "properties": {
6177 "self": {
6178 "type": "string",
6179 "pattern": "/health_question_definition/[0-9]+",
6180 "example": "/health_question_definition/4"
6181 }
6182 }
6183 },
6184 "relationships": {
6185 "type": "object"
6186 }
6187 },
6188 "example": {
6189 "type": "health_question_definition",
6190 "id": "21",
6191 "attributes": {
6192 "category": "preventative_care",
6193 "format": {
6194 "data": [
6195 {
6196 "label": "I Don't know",
6197 "value": "0"
6198 },
6199 {
6200 "label": "I've never had a colonoscopy",
6201 "value": "1"
6202 }
6203 ],
6204 "type": "last_occurrence"
6205 },
6206 "requirements": [
6207 {
6208 "property": "age",
6209 "shouldBeGreaterThan": 49,
6210 "shouldBeLessThan": 76
6211 }
6212 ],
6213 "text": "When was your last colonoscopy?"
6214 },
6215 "links": {
6216 "self": "/pub/health_question_definition/21"
6217 }
6218 }
6219 },
6220 "FetchHealthQuestionDefinitionResponse": {
6221 "type": "object",
6222 "required": [
6223 "data"
6224 ],
6225 "properties": {
6226 "meta": {
6227 "$ref": "#/definitions/FetchMetaResponse"
6228 },
6229 "data": {
6230 "$ref": "#/definitions/HealthQuestionDefinitionResource"
6231 }
6232 }
6233 },
6234 "FetchHealthQuestionDefinitionsResponse": {
6235 "type": "object",
6236 "required": [
6237 "data"
6238 ],
6239 "properties": {
6240 "meta": {
6241 "$ref": "#/definitions/FetchMetaResponse"
6242 },
6243 "links": {
6244 "$ref": "#/definitions/CollectionResponseLinks"
6245 },
6246 "data": {
6247 "type": "array",
6248 "items": {
6249 "$ref": "#/definitions/HealthQuestionDefinitionResource"
6250 }
6251 }
6252 }
6253 },
6254 "PatientHealthMetricResource": {
6255 "type": "object",
6256 "required": [
6257 "type",
6258 "id"
6259 ],
6260 "properties": {
6261 "type": {
6262 "type": "string"
6263 },
6264 "id": {
6265 "type": "string"
6266 },
6267 "attributes": {
6268 "type": "object",
6269 "properties": {
6270 "type": {
6271 "type": "string",
6272 "enum": [
6273 "blood_pressure_systolic",
6274 "blood_pressure_diastolic",
6275 "hemoglobin_a1c",
6276 "hdl_cholesterol",
6277 "ldl_cholesterol",
6278 "total_cholesterol",
6279 "triglycerides",
6280 "blood_urea_nitrogen",
6281 "creatinine",
6282 "hemoglobin",
6283 "hematocrit",
6284 "total_serum_iron",
6285 "thyroid_stimulating_hormone",
6286 "free_thyroxine",
6287 "free_triiodothyronine",
6288 "total_triiodothyronine",
6289 "cd4_cell_count",
6290 "hiv_viral_load",
6291 "inr",
6292 "free_testosterone",
6293 "total_testosterone",
6294 "c_reactive_protein",
6295 "prostate_specific_antigen",
6296 "cotinine",
6297 "c_peptide",
6298 "blood_pressure",
6299 "blood_glucose",
6300 "weight",
6301 "heart_rate",
6302 "body_fat_percentage",
6303 "body_mass_index",
6304 "body_temperature",
6305 "forced_expiratory_volume1",
6306 "forced_vital_capacity",
6307 "lean_body_mass",
6308 "nausea_level",
6309 "oxygen_saturation",
6310 "pain_level",
6311 "peak_expiratory_flow_rate",
6312 "peripheral_perfusion_index",
6313 "respiratory_rate",
6314 "inhaler_usage"
6315 ]
6316 },
6317 "code": {
6318 "type": "object",
6319 "required": [
6320 "system",
6321 "value"
6322 ],
6323 "properties": {
6324 "system": {
6325 "type": "string"
6326 },
6327 "value": {
6328 "type": "string"
6329 }
6330 }
6331 },
6332 "value": {
6333 "description": "Can be any value (number, boolean, string, object) depending on the metric type. Most values are of type number."
6334 },
6335 "systolic": {
6336 "type": "number"
6337 },
6338 "diastolic": {
6339 "type": "number"
6340 },
6341 "unit": {
6342 "type": "string"
6343 },
6344 "occurred_at": {
6345 "type": "string",
6346 "format": "dateTime"
6347 }
6348 }
6349 },
6350 "relationships": {
6351 "type": "object",
6352 "properties": {
6353 "patient": {
6354 "type": "object",
6355 "properties": {
6356 "data": {
6357 "type": "object",
6358 "properties": {
6359 "type": {
6360 "type": "string"
6361 },
6362 "id": {
6363 "type": "string",
6364 "description": "Required if the `meta.query` is not defined.",
6365 "example": "5817ead56f5316c0d05ba8bf"
6366 },
6367 "meta": {
6368 "type": "object",
6369 "description": "Allows the specification of a query for a patient rather than providing a patient id directly",
6370 "required": [
6371 "query"
6372 ],
6373 "properties": {
6374 "query": {
6375 "type": "object",
6376 "description": "The query must return one and only one patient.",
6377 "required": [
6378 "identifier"
6379 ],
6380 "properties": {
6381 "groups": {
6382 "type": "array",
6383 "items": {
6384 "type": "string"
6385 }
6386 },
6387 "organization": {
6388 "type": "string"
6389 },
6390 "identifier": {
6391 "type": "object",
6392 "required": [
6393 "system",
6394 "value"
6395 ],
6396 "properties": {
6397 "system": {
6398 "type": "string"
6399 },
6400 "value": {
6401 "type": "string"
6402 }
6403 }
6404 }
6405 }
6406 }
6407 }
6408 }
6409 }
6410 },
6411 "links": {
6412 "type": "object"
6413 }
6414 }
6415 }
6416 }
6417 }
6418 },
6419 "example": {
6420 "data": {
6421 "type": "patient_health_metric",
6422 "attributes": {
6423 "code": {
6424 "system": "LOINC",
6425 "value": "13457-7"
6426 },
6427 "type": "ldl_cholesterol",
6428 "occurred_at": "2017-03-14T11:00:57.000Z",
6429 "value": 121,
6430 "unit": "mg/dl"
6431 },
6432 "relationships": {
6433 "patient": {
6434 "data": {
6435 "type": "patient",
6436 "id": ""
6437 }
6438 }
6439 }
6440 }
6441 }
6442 },
6443 "PatientHealthMetricCreateResource": {
6444 "type": "object",
6445 "allOf": [
6446 {
6447 "$ref": "#/definitions/PatientHealthMetricResource"
6448 },
6449 {
6450 "description": "Note that `data` can either be a single object or an array of objects matching the schema specified here\n(bulk create).\n"
6451 }
6452 ]
6453 },
6454 "CreatePatientHealthMetricRequest": {
6455 "type": "object",
6456 "required": [
6457 "data"
6458 ],
6459 "properties": {
6460 "meta": {
6461 "type": "object",
6462 "properties": {
6463 "ignore_duplicates": {
6464 "type": "boolean",
6465 "description": "If `true`, the patient health metric will be ignored if there is an existing patient health metric for\nthe same patient, with the same `type` and same `occurred_at`.\n"
6466 }
6467 }
6468 },
6469 "data": {
6470 "$ref": "#/definitions/PatientHealthMetricCreateResource"
6471 }
6472 }
6473 },
6474 "CreatePatientHealthMetricResponse": {
6475 "type": "object",
6476 "required": [
6477 "data"
6478 ],
6479 "properties": {
6480 "meta": {
6481 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
6482 },
6483 "data": {
6484 "$ref": "#/definitions/PatientHealthMetricResource"
6485 }
6486 }
6487 },
6488 "FetchPatientHealthMetricResponse": {
6489 "type": "object",
6490 "required": [
6491 "data"
6492 ],
6493 "properties": {
6494 "meta": {
6495 "$ref": "#/definitions/FetchMetaResponse"
6496 },
6497 "links": {
6498 "$ref": "#/definitions/CollectionResponseLinks"
6499 },
6500 "data": {
6501 "type": "array",
6502 "items": {
6503 "$ref": "#/definitions/PatientHealthMetricResource"
6504 }
6505 }
6506 }
6507 },
6508 "PhoneNumber": {
6509 "type": "object",
6510 "required": [
6511 "type",
6512 "value",
6513 "primary"
6514 ],
6515 "properties": {
6516 "type": {
6517 "type": "string",
6518 "enum": [
6519 "home",
6520 "work",
6521 "mobile",
6522 "home-fax",
6523 "work-fax",
6524 "other"
6525 ],
6526 "example": "mobile"
6527 },
6528 "value": {
6529 "type": "string",
6530 "example": "555-555-1234"
6531 },
6532 "primary": {
6533 "type": "boolean",
6534 "example": true
6535 }
6536 }
6537 },
6538 "Address": {
6539 "type": "object",
6540 "properties": {
6541 "city": {
6542 "type": "string",
6543 "example": "Cambridge"
6544 },
6545 "state": {
6546 "type": "string",
6547 "example": "MA"
6548 },
6549 "postal_code": {
6550 "type": "string",
6551 "example": "02138"
6552 },
6553 "lines": {
6554 "type": "array",
6555 "example": [
6556 "1234 Any St."
6557 ],
6558 "items": {
6559 "type": "string"
6560 }
6561 },
6562 "use": {
6563 "type": "string"
6564 },
6565 "type": {
6566 "type": "string"
6567 },
6568 "text": {
6569 "type": "string"
6570 },
6571 "district": {
6572 "type": "string"
6573 },
6574 "country": {
6575 "type": "string"
6576 }
6577 }
6578 },
6579 "PatientIdentifier": {
6580 "type": "object",
6581 "required": [
6582 "system",
6583 "value"
6584 ],
6585 "properties": {
6586 "label": {
6587 "type": "string"
6588 },
6589 "system": {
6590 "type": "string"
6591 },
6592 "value": {
6593 "type": "string"
6594 },
6595 "unique": {
6596 "description": "If `true`, the combination of system and value must be global unique among all patients and coaches in Fitbit Plus.",
6597 "type": "boolean",
6598 "default": true
6599 }
6600 }
6601 },
6602 "ArchiveHistory": {
6603 "type": "object",
6604 "properties": {
6605 "archived": {
6606 "type": "boolean",
6607 "example": true
6608 },
6609 "modified_at": {
6610 "type": "string",
6611 "format": "dateTime",
6612 "example": "2016-06-03T13:15:22.000Z"
6613 },
6614 "reason": {
6615 "type": "string",
6616 "example": "Opted out of coaching"
6617 },
6618 "notes": {
6619 "type": "string",
6620 "example": "Patient called requesting opt out of coaching"
6621 }
6622 }
6623 },
6624 "PatientResource": {
6625 "type": "object",
6626 "required": [
6627 "type",
6628 "attributes"
6629 ],
6630 "properties": {
6631 "id": {
6632 "type": "string",
6633 "example": "57b36ef304ad8c2224f2af3a"
6634 },
6635 "type": {
6636 "type": "string",
6637 "enum": [
6638 "patient"
6639 ],
6640 "example": "patient"
6641 },
6642 "attributes": {
6643 "type": "object",
6644 "properties": {
6645 "first_name": {
6646 "type": "string",
6647 "example": "Fiona"
6648 },
6649 "last_name": {
6650 "type": "string",
6651 "example": "Reeves"
6652 },
6653 "email_address": {
6654 "type": "string",
6655 "example": "fiona@example.com"
6656 },
6657 "phone_numbers": {
6658 "type": "array",
6659 "items": {
6660 "$ref": "#/definitions/PhoneNumber"
6661 }
6662 },
6663 "addresses": {
6664 "type": "array",
6665 "items": {
6666 "$ref": "#/definitions/Address"
6667 }
6668 },
6669 "identifiers": {
6670 "type": "array",
6671 "items": {
6672 "$ref": "#/definitions/PatientIdentifier"
6673 }
6674 },
6675 "birth_date": {
6676 "type": "string",
6677 "format": "date",
6678 "example": "1944-03-06"
6679 },
6680 "gender": {
6681 "type": "string",
6682 "enum": [
6683 "male",
6684 "female",
6685 "other"
6686 ],
6687 "example": "female"
6688 },
6689 "note": {
6690 "type": "string",
6691 "example": "Relies on daughter to get around",
6692 "description": "Coach's note about the patient. Not visible to the patient."
6693 },
6694 "updated_at": {
6695 "type": "string",
6696 "format": "dateTime",
6697 "example": "2016-07-11T17:13:57.027Z",
6698 "readOnly": true
6699 },
6700 "first_access_at": {
6701 "type": "string",
6702 "format": "dateTime",
6703 "example": "2016-06-03T13:15:22.000Z",
6704 "readOnly": true
6705 },
6706 "invited_at": {
6707 "type": "string",
6708 "format": "dateTime",
6709 "example": "2016-06-01T16:20:16.000Z",
6710 "readOnly": true
6711 },
6712 "enrolled_at": {
6713 "type": "string",
6714 "format": "dateTime",
6715 "example": "2016-05-26T15:25:54.000Z",
6716 "readOnly": true
6717 },
6718 "last_access_at": {
6719 "type": "string",
6720 "format": "dateTime",
6721 "example": "2016-07-11T17:50:49.400Z",
6722 "readOnly": true
6723 },
6724 "archived": {
6725 "type": "boolean",
6726 "example": true,
6727 "readOnly": true
6728 },
6729 "archive_history": {
6730 "type": "array",
6731 "items": {
6732 "$ref": "#/definitions/ArchiveHistory"
6733 }
6734 }
6735 }
6736 },
6737 "links": {
6738 "type": "object",
6739 "readOnly": true,
6740 "properties": {
6741 "self": {
6742 "type": "string",
6743 "pattern": "/patient/[0-9a-z]+",
6744 "example": "/patient/57b36ef304ad8c2224f2af3a"
6745 },
6746 "twine_web_app": {
6747 "type": "string",
6748 "example": "https://app.plus.fitbit.com/#/coach/patient/5367c6300b7bb6e94188c02c/overview",
6749 "description": "A link to the patient record in the Fitbit Plus web application."
6750 }
6751 }
6752 },
6753 "relationships": {
6754 "type": "object",
6755 "required": [
6756 "groups"
6757 ],
6758 "properties": {
6759 "groups": {
6760 "required": [
6761 "data"
6762 ],
6763 "properties": {
6764 "data": {
6765 "type": "array",
6766 "items": {
6767 "type": "object",
6768 "required": [
6769 "type"
6770 ],
6771 "properties": {
6772 "type": {
6773 "type": "string",
6774 "enum": [
6775 "group"
6776 ],
6777 "example": "group"
6778 },
6779 "id": {
6780 "type": "string",
6781 "example": "57b3708b04ad8c2224f2af3b"
6782 }
6783 }
6784 }
6785 }
6786 }
6787 },
6788 "coaches": {
6789 "required": [
6790 "data"
6791 ],
6792 "properties": {
6793 "data": {
6794 "type": "array",
6795 "items": {
6796 "type": "object",
6797 "required": [
6798 "type",
6799 "id"
6800 ],
6801 "properties": {
6802 "type": {
6803 "type": "string",
6804 "enum": [
6805 "coach"
6806 ],
6807 "example": "coach"
6808 },
6809 "id": {
6810 "type": "string",
6811 "example": "57fee2a66b49113551658505"
6812 },
6813 "meta": {
6814 "type": "object",
6815 "properties": {
6816 "primary": {
6817 "type": "boolean"
6818 }
6819 }
6820 }
6821 }
6822 }
6823 },
6824 "links": {
6825 "readOnly": true,
6826 "properties": {
6827 "related": {
6828 "type": "string",
6829 "pattern": "/patient/[0-9a-z]+/groups",
6830 "example": "/patient/57b36ef304ad8c2224f2af3a/groups"
6831 }
6832 }
6833 }
6834 }
6835 }
6836 }
6837 }
6838 }
6839 },
6840 "PatientCreateResource": {
6841 "type": "object",
6842 "allOf": [
6843 {
6844 "$ref": "#/definitions/PatientResource"
6845 },
6846 {
6847 "description": "Note that `data` can either be a single object or an array of objects matching the schema specified here\n(bulk create).\n"
6848 },
6849 {
6850 "properties": {
6851 "relationships": {
6852 "type": "object",
6853 "required": [
6854 "groups"
6855 ],
6856 "properties": {
6857 "groups": {
6858 "type": "object",
6859 "required": [
6860 "data"
6861 ],
6862 "properties": {
6863 "data": {
6864 "type": "array",
6865 "items": {
6866 "type": "object",
6867 "required": [
6868 "type"
6869 ],
6870 "properties": {
6871 "type": {
6872 "type": "string",
6873 "enum": [
6874 "group"
6875 ],
6876 "example": "group"
6877 },
6878 "id": {
6879 "type": "string",
6880 "description": "Required if the `meta.query` is not defined.",
6881 "example": "57b3708b04ad8c2224f2af3b"
6882 },
6883 "meta": {
6884 "type": "object",
6885 "description": "Allows the specification of a query for a group rather than providing a group id directly",
6886 "required": [
6887 "query"
6888 ],
6889 "properties": {
6890 "query": {
6891 "type": "object",
6892 "description": "1. If the query does not return any groups, a group with the specified name will be created and related to the patient.\n2. If the query returns one group, that group will be related to the patient.\n3. If the query returns more than one group, the creation of the patient will fail.\n",
6893 "required": [
6894 "organization",
6895 "name"
6896 ],
6897 "properties": {
6898 "organization": {
6899 "type": "string"
6900 },
6901 "name": {
6902 "type": "string"
6903 }
6904 }
6905 }
6906 }
6907 }
6908 }
6909 }
6910 }
6911 }
6912 },
6913 "coaches": {
6914 "type": "object",
6915 "required": [
6916 "data"
6917 ],
6918 "properties": {
6919 "data": {
6920 "type": "array",
6921 "items": {
6922 "type": "object",
6923 "required": [
6924 "type",
6925 "id"
6926 ],
6927 "properties": {
6928 "type": {
6929 "type": "string",
6930 "enum": [
6931 "coach"
6932 ],
6933 "example": "coach"
6934 },
6935 "id": {
6936 "type": "string",
6937 "example": "57fee2a66b49113551658505"
6938 },
6939 "meta": {
6940 "type": "object",
6941 "properties": {
6942 "primary": {
6943 "type": "boolean"
6944 }
6945 }
6946 }
6947 }
6948 }
6949 },
6950 "links": {
6951 "readOnly": true,
6952 "properties": {
6953 "related": {
6954 "type": "string",
6955 "pattern": "/patient/[0-9a-z]+/coaches",
6956 "example": "/patient/57b36ef304ad8c2224f2af3a/coaches"
6957 }
6958 }
6959 }
6960 }
6961 }
6962 }
6963 }
6964 }
6965 }
6966 ]
6967 },
6968 "FetchPatientsResponse": {
6969 "type": "object",
6970 "required": [
6971 "data"
6972 ],
6973 "properties": {
6974 "meta": {
6975 "$ref": "#/definitions/FetchMetaResponse"
6976 },
6977 "links": {
6978 "$ref": "#/definitions/CollectionResponseLinks"
6979 },
6980 "data": {
6981 "type": "array",
6982 "items": {
6983 "$ref": "#/definitions/PatientResource"
6984 }
6985 }
6986 },
6987 "example": {
6988 "meta": {
6989 "req_id": "155c690b-50b2-4ff2-8abe-b809a8a51e53",
6990 "count": 263
6991 },
6992 "links": {
6993 "self": "/pub/patient?filter[groups]=5755db2a3db4179179999acf&page[number]=1&page[size]=3",
6994 "next": "/pub/patient?filter[groups]=5755db2a3db4179179999acf&page[number]=2&page[size]=3",
6995 "last": "/pub/patient?filter[groups]=5755db2a3db4179179999acf&page[number]=88&page[size]=3"
6996 },
6997 "data": [
6998 {
6999 "type": "patient",
7000 "id": "58163112237d84a94035f78b",
7001 "attributes": {
7002 "first_name": "Lucy",
7003 "last_name": "Bernhard",
7004 "updated_at": "2016-03-16T13:32:57.000Z",
7005 "birth_date": "1938-10-04",
7006 "addresses": [],
7007 "phone_numbers": [
7008 {
7009 "primary": true,
7010 "value": "880-136-7979 x6183"
7011 },
7012 {
7013 "primary": false,
7014 "value": "919.814.3552 x40123"
7015 }
7016 ],
7017 "identifiers": [
7018 {
7019 "label": "Fitbit Plus Sample Data Filler Patient",
7020 "system": "twine-filler-patient",
7021 "value": "filler-92"
7022 }
7023 ],
7024 "archived": false,
7025 "archive_history": []
7026 },
7027 "links": {
7028 "twine_web_app": "http://10.0.1.55:9000/#/coach/admin/coaches/58163112237d84a94035f78b/profile",
7029 "self": "/pub/patient/58163112237d84a94035f78b"
7030 },
7031 "relationships": {
7032 "groups": {
7033 "data": [
7034 {
7035 "type": "group",
7036 "id": "5755db2a3db4179179999acf"
7037 }
7038 ],
7039 "links": {
7040 "related": "/pub/patient/58163112237d84a94035f78b/groups"
7041 }
7042 },
7043 "coaches": {
7044 "data": [
7045 {
7046 "type": "coach",
7047 "id": "581630c3237d84a9403533c6",
7048 "meta": {
7049 "primary": true
7050 }
7051 }
7052 ],
7053 "links": {
7054 "related": "/pub/patient/58163112237d84a94035f78b/coaches"
7055 }
7056 }
7057 }
7058 },
7059 {
7060 "type": "patient",
7061 "id": "58163103237d84a94035f0b3",
7062 "attributes": {
7063 "first_name": "Annette",
7064 "last_name": "Parisian",
7065 "updated_at": "2016-02-04T12:55:03.000Z",
7066 "email_address": "annette.parisian@example.com",
7067 "birth_date": "1983-03-16",
7068 "addresses": [],
7069 "phone_numbers": [
7070 {
7071 "primary": true,
7072 "value": "044.758.5704 x1965"
7073 }
7074 ],
7075 "identifiers": [
7076 {
7077 "label": "Fitbit Plus Sample Data Filler Patient",
7078 "system": "twine-filler-patient",
7079 "value": "filler-5"
7080 }
7081 ]
7082 },
7083 "links": {
7084 "twine_web_app": "http://10.0.1.55:9000/#/coach/admin/coaches/58163103237d84a94035f0b3/profile",
7085 "self": "/pub/patient/58163103237d84a94035f0b3"
7086 },
7087 "relationships": {
7088 "groups": {
7089 "data": [
7090 {
7091 "type": "group",
7092 "id": "5755db2a3db4179179999acf"
7093 }
7094 ],
7095 "links": {
7096 "related": "/pub/patient/58163103237d84a94035f0b3/groups"
7097 }
7098 },
7099 "coaches": {
7100 "data": [
7101 {
7102 "type": "coach",
7103 "id": "581630c3237d84a9403533c6",
7104 "meta": {
7105 "primary": true
7106 }
7107 }
7108 ],
7109 "links": {
7110 "related": "/pub/patient/58163103237d84a94035f0b3/coaches"
7111 }
7112 }
7113 }
7114 },
7115 {
7116 "type": "patient",
7117 "id": "58163103237d84a94035f043",
7118 "attributes": {
7119 "first_name": "Lexi",
7120 "last_name": "Thompson",
7121 "updated_at": "2016-01-23T16:12:07.000Z",
7122 "email_address": "lexi.thompson@example.com",
7123 "birth_date": "1932-04-06",
7124 "addresses": [],
7125 "phone_numbers": [
7126 {
7127 "primary": true,
7128 "value": "1-977-830-6179 x26334"
7129 }
7130 ],
7131 "identifiers": [
7132 {
7133 "label": "Fitbit Plus Sample Data Filler Patient",
7134 "system": "twine-filler-patient",
7135 "value": "filler-3"
7136 }
7137 ]
7138 },
7139 "links": {
7140 "twine_web_app": "http://10.0.1.55:9000/#/coach/admin/coaches/58163103237d84a94035f043/profile",
7141 "self": "/pub/patient/58163103237d84a94035f043"
7142 },
7143 "relationships": {
7144 "groups": {
7145 "data": [
7146 {
7147 "type": "group",
7148 "id": "5755db2a3db4179179999acf"
7149 }
7150 ],
7151 "links": {
7152 "related": "/pub/patient/58163103237d84a94035f043/groups"
7153 }
7154 },
7155 "coaches": {
7156 "data": [
7157 {
7158 "type": "coach",
7159 "id": "581630c3237d84a9403533c6",
7160 "meta": {
7161 "primary": true
7162 }
7163 }
7164 ],
7165 "links": {
7166 "related": "/pub/patient/58163103237d84a94035f043/coaches"
7167 }
7168 }
7169 }
7170 }
7171 ]
7172 }
7173 },
7174 "FetchPatientResponse": {
7175 "type": "object",
7176 "required": [
7177 "data"
7178 ],
7179 "properties": {
7180 "meta": {
7181 "$ref": "#/definitions/FetchMetaResponse"
7182 },
7183 "data": {
7184 "$ref": "#/definitions/PatientResource"
7185 }
7186 },
7187 "example": {
7188 "meta": {
7189 "req_id": "23001d51-669b-4948-b9fa-11dbffdf8ced"
7190 },
7191 "data": {
7192 "type": "patient",
7193 "id": "58163112237d84a94035f78b",
7194 "attributes": {
7195 "first_name": "Lucy",
7196 "last_name": "Bernhard",
7197 "updated_at": "2016-03-16T13:32:57.000Z",
7198 "birth_date": "1938-10-04",
7199 "addresses": [],
7200 "phone_numbers": [
7201 {
7202 "primary": true,
7203 "value": "880-136-7979 x6183"
7204 },
7205 {
7206 "primary": false,
7207 "value": "919.814.3552 x40123"
7208 }
7209 ],
7210 "identifiers": [
7211 {
7212 "label": "Fitbit Plus Sample Data Filler Patient",
7213 "system": "twine-filler-patient",
7214 "value": "filler-92"
7215 }
7216 ],
7217 "archived": false,
7218 "archive_history": []
7219 },
7220 "links": {
7221 "twine_web_app": "http://10.0.1.55:9000/#/coach/admin/coaches/58163112237d84a94035f78b/profile",
7222 "self": "/pub/patient/58163112237d84a94035f78b"
7223 },
7224 "relationships": {
7225 "groups": {
7226 "data": [
7227 {
7228 "type": "group",
7229 "id": "5755db2a3db4179179999acf"
7230 }
7231 ],
7232 "links": {
7233 "related": "/pub/patient/58163112237d84a94035f78b/groups"
7234 }
7235 },
7236 "coaches": {
7237 "data": [
7238 {
7239 "type": "coach",
7240 "id": "581630c3237d84a9403533c6",
7241 "meta": {
7242 "primary": true
7243 }
7244 }
7245 ],
7246 "links": {
7247 "related": "/pub/patient/58163112237d84a94035f78b/coaches"
7248 }
7249 }
7250 }
7251 },
7252 "included": []
7253 }
7254 },
7255 "CreatePatientRequest": {
7256 "type": "object",
7257 "required": [
7258 "data"
7259 ],
7260 "properties": {
7261 "meta": {
7262 "type": "object",
7263 "properties": {
7264 "ignore_duplicates": {
7265 "description": "If `true`, patients with any conflicting identifiers (same `system` and `value`) will be ignored.\nUseful for gracefully skipping duplicates after errors occur during bulk create.\n",
7266 "type": "boolean",
7267 "default": false
7268 }
7269 }
7270 },
7271 "data": {
7272 "$ref": "#/definitions/PatientCreateResource"
7273 }
7274 },
7275 "example": {
7276 "data": {
7277 "type": "patient",
7278 "attributes": {
7279 "first_name": "Jack",
7280 "last_name": "Frost"
7281 },
7282 "relationships": {
7283 "groups": {
7284 "data": [
7285 {
7286 "type": "group",
7287 "id": "5755db2a3db4179179999acf"
7288 }
7289 ]
7290 }
7291 }
7292 }
7293 }
7294 },
7295 "CreatePatientResponse": {
7296 "type": "object",
7297 "required": [
7298 "data"
7299 ],
7300 "properties": {
7301 "meta": {
7302 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
7303 },
7304 "data": {
7305 "$ref": "#/definitions/PatientResource"
7306 }
7307 },
7308 "example": {
7309 "meta": {
7310 "req_id": "5b813ad3-cabc-418f-add4-1e53bc69f7cb"
7311 },
7312 "data": {
7313 "type": "patient",
7314 "id": "5817ead56f5316c0d05ba8bf",
7315 "attributes": {
7316 "first_name": "Jack",
7317 "last_name": "Frost",
7318 "updated_at": "2016-11-01T01:07:33.121Z",
7319 "addresses": [],
7320 "phone_numbers": [],
7321 "identifiers": [],
7322 "archived": false,
7323 "archive_history": []
7324 },
7325 "links": {
7326 "twine_web_app": "http://10.0.1.55:9000/#/coach/patient/5817ead56f5316c0d05ba8bf",
7327 "self": "/pub/patient/5817ead56f5316c0d05ba8bf"
7328 },
7329 "relationships": {
7330 "groups": {
7331 "data": [
7332 {
7333 "type": "group",
7334 "id": "5755db2a3db4179179999acf"
7335 }
7336 ],
7337 "links": {
7338 "related": "/pub/patient/5817ead56f5316c0d05ba8bf/groups"
7339 }
7340 },
7341 "coaches": {
7342 "data": [],
7343 "links": {
7344 "related": "/pub/patient/5817ead56f5316c0d05ba8bf/coaches"
7345 }
7346 }
7347 }
7348 },
7349 "included": []
7350 }
7351 },
7352 "UpdatePatientRequest": {
7353 "type": "object",
7354 "required": [
7355 "data"
7356 ],
7357 "properties": {
7358 "data": {
7359 "$ref": "#/definitions/PatientResource"
7360 }
7361 },
7362 "example": {
7363 "data": {
7364 "id": "5817ead56f5316c0d05ba8bf",
7365 "type": "patient",
7366 "attributes": {
7367 "first_name": "Jonathon"
7368 }
7369 }
7370 }
7371 },
7372 "UpdatePatientResponse": {
7373 "type": "object",
7374 "required": [
7375 "data"
7376 ],
7377 "properties": {
7378 "meta": {
7379 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
7380 },
7381 "data": {
7382 "$ref": "#/definitions/PatientResource"
7383 }
7384 },
7385 "example": {
7386 "meta": {
7387 "req_id": "5b813ad3-cabc-418f-add4-1e53bc69f7cb"
7388 },
7389 "data": {
7390 "type": "patient",
7391 "id": "5817ead56f5316c0d05ba8bf",
7392 "attributes": {
7393 "first_name": "Jack",
7394 "last_name": "Frost",
7395 "updated_at": "2016-11-01T01:07:33.121Z",
7396 "addresses": [],
7397 "phone_numbers": [],
7398 "identifiers": [],
7399 "archived": false,
7400 "archive_history": []
7401 },
7402 "links": {
7403 "twine_web_app": "http://10.0.1.55:9000/#/coach/patient/5817ead56f5316c0d05ba8bf",
7404 "self": "/pub/patient/5817ead56f5316c0d05ba8bf"
7405 },
7406 "relationships": {
7407 "groups": {
7408 "data": [
7409 {
7410 "type": "group",
7411 "id": "5755db2a3db4179179999acf"
7412 }
7413 ],
7414 "links": {
7415 "related": "/pub/patient/5817ead56f5316c0d05ba8bf/groups"
7416 }
7417 },
7418 "coaches": {
7419 "data": [],
7420 "links": {
7421 "related": "/pub/patient/5817ead56f5316c0d05ba8bf/coaches"
7422 }
7423 }
7424 }
7425 },
7426 "included": []
7427 }
7428 },
7429 "UpsertPatientRequest": {
7430 "type": "object",
7431 "required": [
7432 "meta",
7433 "data"
7434 ],
7435 "properties": {
7436 "meta": {
7437 "type": "object",
7438 "required": [
7439 "query"
7440 ],
7441 "properties": {
7442 "query": {
7443 "type": "object",
7444 "required": [
7445 "identifier",
7446 "groups"
7447 ],
7448 "properties": {
7449 "identifier": {
7450 "description": "Identifier to match patient",
7451 "type": "object",
7452 "properties": {
7453 "system": {
7454 "type": "string",
7455 "description": "Name of system"
7456 },
7457 "value": {
7458 "type": "string",
7459 "description": "Value in system"
7460 }
7461 }
7462 },
7463 "groups": {
7464 "description": "Group to create/update patient in.",
7465 "type": "array",
7466 "items": {
7467 "type": "string",
7468 "description": "ID of group"
7469 }
7470 }
7471 }
7472 }
7473 }
7474 },
7475 "data": {
7476 "$ref": "#/definitions/PatientResource"
7477 }
7478 },
7479 "example": {
7480 "meta": {
7481 "query": {
7482 "identifier": {
7483 "system": "OtherPlace",
7484 "value": "123456"
7485 },
7486 "groups": [
7487 "5755db2a3db4179179999acf"
7488 ]
7489 }
7490 },
7491 "data": {
7492 "type": "patient",
7493 "attributes": {
7494 "first_name": "Jack",
7495 "last_name": "Frost"
7496 },
7497 "relationships": {
7498 "groups": {
7499 "data": [
7500 {
7501 "type": "group",
7502 "id": "5755db2a3db4179179999acf"
7503 }
7504 ]
7505 }
7506 }
7507 }
7508 }
7509 },
7510 "PatientPlanSummaryResource": {
7511 "type": "object",
7512 "required": [
7513 "id",
7514 "type"
7515 ],
7516 "properties": {
7517 "id": {
7518 "type": "string",
7519 "example": "57b36e3c04ad8c2224f2af38"
7520 },
7521 "type": {
7522 "type": "string",
7523 "enum": [
7524 "patient_plan_summary"
7525 ],
7526 "example": "patient_plan_summary"
7527 },
7528 "attributes": {
7529 "type": "object",
7530 "properties": {
7531 "adherence": {
7532 "readOnly": true,
7533 "type": "object"
7534 },
7535 "critical": {
7536 "type": "object",
7537 "additionalProperties": true
7538 },
7539 "time_zone": {
7540 "type": "string"
7541 },
7542 "window_order": {
7543 "type": "array",
7544 "items": {
7545 "type": "object",
7546 "properties": {
7547 "type": {
7548 "type": "string"
7549 },
7550 "_actions": {
7551 "type": "array",
7552 "items": {
7553 "type": "string"
7554 }
7555 }
7556 }
7557 }
7558 },
7559 "effective_from": {
7560 "readOnly": true,
7561 "type": "string",
7562 "format": "dateTime"
7563 },
7564 "window_notification_times": {
7565 "readOnly": true,
7566 "type": "object",
7567 "properties": {
7568 "morning": {
7569 "type": "integer"
7570 },
7571 "afternoon": {
7572 "type": "integer"
7573 },
7574 "evening": {
7575 "type": "integer"
7576 },
7577 "night": {
7578 "type": "integer"
7579 }
7580 }
7581 }
7582 }
7583 },
7584 "relationships": {
7585 "type": "object",
7586 "required": [
7587 "actions",
7588 "bundles",
7589 "patient"
7590 ],
7591 "properties": {
7592 "actions": {
7593 "type": "object",
7594 "properties": {
7595 "data": {
7596 "type": "array",
7597 "items": {
7598 "type": "object",
7599 "required": [
7600 "type",
7601 "id"
7602 ],
7603 "properties": {
7604 "type": {
7605 "type": "string"
7606 },
7607 "id": {
7608 "type": "string"
7609 }
7610 }
7611 }
7612 },
7613 "links": {
7614 "type": "object",
7615 "properties": {
7616 "related": {
7617 "type": "string"
7618 }
7619 }
7620 }
7621 }
7622 },
7623 "bundles": {
7624 "type": "object",
7625 "properties": {
7626 "data": {
7627 "type": "array",
7628 "items": {
7629 "type": "object",
7630 "required": [
7631 "type",
7632 "id"
7633 ],
7634 "properties": {
7635 "type": {
7636 "type": "string"
7637 },
7638 "id": {
7639 "type": "string"
7640 }
7641 }
7642 }
7643 },
7644 "links": {
7645 "type": "object",
7646 "properties": {
7647 "related": {
7648 "type": "string"
7649 }
7650 }
7651 }
7652 }
7653 },
7654 "patient": {
7655 "type": "object",
7656 "properties": {
7657 "data": {
7658 "type": "object",
7659 "properties": {
7660 "type": {
7661 "type": "string"
7662 },
7663 "id": {
7664 "type": "string"
7665 }
7666 }
7667 },
7668 "links": {
7669 "type": "object",
7670 "properties": {
7671 "related": {
7672 "type": "string"
7673 }
7674 }
7675 }
7676 }
7677 },
7678 "current_results": {
7679 "type": "object",
7680 "properties": {
7681 "data": {
7682 "type": "array",
7683 "items": {
7684 "type": "object",
7685 "required": [
7686 "type",
7687 "id"
7688 ],
7689 "properties": {
7690 "type": {
7691 "type": "string"
7692 },
7693 "id": {
7694 "type": "string"
7695 }
7696 }
7697 }
7698 },
7699 "links": {
7700 "type": "object",
7701 "properties": {
7702 "related": {
7703 "type": "string"
7704 }
7705 }
7706 }
7707 }
7708 }
7709 }
7710 },
7711 "links": {
7712 "type": "object",
7713 "readOnly": true,
7714 "required": [
7715 "self"
7716 ],
7717 "properties": {
7718 "self": {
7719 "type": "string",
7720 "pattern": "/patient_plan_summary/[0-9a-z]+",
7721 "example": "/patient_plan_summary/57b36e3c04ad8c2224f2af38"
7722 }
7723 }
7724 }
7725 }
7726 },
7727 "FetchPatientPlanSummaryResponse": {
7728 "type": "object",
7729 "required": [
7730 "data"
7731 ],
7732 "properties": {
7733 "meta": {
7734 "$ref": "#/definitions/FetchMetaResponse"
7735 },
7736 "data": {
7737 "$ref": "#/definitions/PatientPlanSummaryResource"
7738 },
7739 "included": {
7740 "description": "Related resources which are included in the response based on the `include` param.\nAttributes of each resource will vary depending on the type.\nSee [action](#operation/fetchAction), [bundle](#operation/fetchBundle) and [patient](#operation/fetchPatient)\n",
7741 "type": "array",
7742 "items": {
7743 "$ref": "#/definitions/Resource"
7744 }
7745 }
7746 },
7747 "example": {
7748 "data": {
7749 "type": "patient_plan_summary",
7750 "id": "5964f831f65725bf25558b50",
7751 "attributes": {
7752 "adherence": {
7753 "due": 0,
7754 "complete": 0,
7755 "streak": {
7756 "count": 0
7757 }
7758 },
7759 "critical": {
7760 "blood_glucose": {
7761 "data": {
7762 "maximum": {
7763 "unit": "mg/dL",
7764 "value": 300
7765 },
7766 "minimum": {
7767 "unit": "mg/dL",
7768 "value": 70
7769 }
7770 }
7771 },
7772 "effective_from": "2017-07-01T04:00:00.000Z"
7773 },
7774 "window_order": [],
7775 "effective_from": "2017-07-01T04:00:00.000Z",
7776 "window_notification_times": {
7777 "morning": 25200,
7778 "afternoon": 43200,
7779 "evening": 64800,
7780 "night": 75600
7781 }
7782 },
7783 "links": {
7784 "self": "/patient_plan_summary/5964f831f65725bf25558b50"
7785 },
7786 "relationships": {
7787 "bundles": {
7788 "links": {
7789 "related": "/patient_plan_summary/5964f831f65725bf25558b50/bundles"
7790 },
7791 "data": []
7792 },
7793 "actions": {
7794 "links": {
7795 "related": "/patient_plan_summary/5964f831f65725bf25558b50/actions"
7796 },
7797 "data": [
7798 {
7799 "id": "5964f831f65725bf25558b4b",
7800 "type": "action"
7801 }
7802 ]
7803 },
7804 "patient": {
7805 "links": {
7806 "related": "/patient_plan_summary/5964f831f65725bf25558b50/patient"
7807 },
7808 "data": {
7809 "type": "patient",
7810 "id": "5964f831f65725bf25558b4f"
7811 }
7812 },
7813 "current_results": {
7814 "links": {
7815 "related": "/patient_plan_summary/5964f831f65725bf25558b50/current_results"
7816 },
7817 "data": []
7818 }
7819 }
7820 },
7821 "included": [
7822 {
7823 "type": "action",
7824 "id": "5964f831f65725bf25558b4b",
7825 "attributes": {
7826 "_thread": "blood_pressure",
7827 "adherence": {
7828 "due": 0,
7829 "complete": 0,
7830 "streak": {
7831 "count": 0
7832 }
7833 },
7834 "effective_from": "2017-07-01T04:00:00.000Z",
7835 "frequency_goal": {
7836 "weeks": {
7837 "days": [
7838 0,
7839 1,
7840 2,
7841 3,
7842 4,
7843 5,
7844 6
7845 ]
7846 }
7847 },
7848 "frequency_goal_prorated": 0,
7849 "identifiers": [],
7850 "metric_required": false,
7851 "metrics": [
7852 {
7853 "metric_type": "blood_pressure",
7854 "unit": "mmHg",
7855 "goal": {
7856 "data": {
7857 "systolic": {
7858 "value": 150,
7859 "unit": "mmHg"
7860 },
7861 "diastolic": {
7862 "value": 95,
7863 "unit": "mmHg"
7864 }
7865 }
7866 },
7867 "_id": "5964f831f65725bf25558b51",
7868 "accepted_values": []
7869 }
7870 ],
7871 "title": "Record Blood Pressure",
7872 "tracking": true,
7873 "windows": [],
7874 "type": "blood_pressure",
7875 "options": []
7876 },
7877 "links": {
7878 "self": "/action/5964f831f65725bf25558b4b"
7879 },
7880 "relationships": {
7881 "plan": {
7882 "links": {
7883 "related": "/action/5964f831f65725bf25558b4b/plan"
7884 }
7885 },
7886 "bundles": {
7887 "links": {
7888 "related": "/action/5964f831f65725bf25558b4b/bundles"
7889 },
7890 "data": []
7891 }
7892 }
7893 }
7894 ],
7895 "meta": {
7896 "req_id": "e0e78ef5-c0fd-415b-9b9f-a1b5c77c1198"
7897 }
7898 }
7899 },
7900 "FetchPatientPlanSummariesResponse": {
7901 "type": "object",
7902 "required": [
7903 "data"
7904 ],
7905 "properties": {
7906 "meta": {
7907 "$ref": "#/definitions/FetchMetaResponse"
7908 },
7909 "data": {
7910 "type": "array",
7911 "items": {
7912 "$ref": "#/definitions/PatientPlanSummaryResource"
7913 }
7914 },
7915 "included": {
7916 "description": "Related resources which are included in the response based on the `include` param.\nAttributes of each resource will vary depending on the type.\nSee [action](#operation/fetchAction), [bundle](#operation/fetchBundle) and [patient](#operation/fetchPatient)\n",
7917 "type": "array",
7918 "items": {
7919 "$ref": "#/definitions/Resource"
7920 }
7921 }
7922 }
7923 },
7924 "UpdatePatientPlanSummaryRequest": {
7925 "type": "object",
7926 "required": [
7927 "data"
7928 ],
7929 "properties": {
7930 "data": {
7931 "$ref": "#/definitions/PatientPlanSummaryResource"
7932 }
7933 }
7934 },
7935 "UpdatePatientPlanSummaryResponse": {
7936 "type": "object",
7937 "required": [
7938 "data"
7939 ],
7940 "properties": {
7941 "meta": {
7942 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
7943 },
7944 "data": {
7945 "$ref": "#/definitions/PatientPlanSummaryResource"
7946 }
7947 }
7948 },
7949 "RewardProgramActivationResource": {
7950 "type": "object",
7951 "required": [
7952 "type"
7953 ],
7954 "properties": {
7955 "type": {
7956 "type": "string"
7957 },
7958 "id": {
7959 "type": "string"
7960 },
7961 "attributes": {
7962 "type": "object",
7963 "required": [
7964 "activated_at"
7965 ],
7966 "properties": {
7967 "active": {
7968 "description": "If true, the reward program is currently active.",
7969 "type": "boolean",
7970 "default": true
7971 },
7972 "activated_at": {
7973 "description": "Date at which the reward program was activated for the patient. (Must be between the start_at and end_at dates for the reward program)",
7974 "type": "string",
7975 "format": "dateTime"
7976 },
7977 "deactivated_at": {
7978 "description": "Date at which the reward program was deactivated. (Must be after the activated_at date)",
7979 "type": "string",
7980 "format": "dateTime"
7981 },
7982 "expires_at": {
7983 "description": "Date at which the reward program activation expires. (Read-only property set by adding the days_active from the reward program to the activated_at date)",
7984 "type": "string",
7985 "format": "dateTime",
7986 "readOnly": true
7987 },
7988 "fulfill_as_earned": {
7989 "description": "If true, the rewards created for a patient for the program can be fulfulled as they are earned. If false, the rewards should only be fulfilled when the program is deactivated. (Read-only property denormalized from the reward program)",
7990 "type": "boolean",
7991 "readOnly": true
7992 },
7993 "allocated_count": {
7994 "description": "Number of rewards allocated. (Read-only property)",
7995 "type": "number",
7996 "readOnly": true
7997 },
7998 "total_allocated_value": {
7999 "description": "Total value of reward allocated. (Read-only property)",
8000 "type": "number",
8001 "readOnly": true
8002 },
8003 "earned_count": {
8004 "description": "Number of reward earnings. (Read-only property)",
8005 "type": "number",
8006 "readOnly": true
8007 },
8008 "total_earned_value": {
8009 "description": "Total value of reward earnings. (Read-only property)",
8010 "type": "number",
8011 "readOnly": true
8012 },
8013 "budget_unit": {
8014 "description": "Unit of the reward program budget. (Read-only property)",
8015 "type": "string",
8016 "readOnly": true
8017 }
8018 }
8019 },
8020 "relationships": {
8021 "type": "object",
8022 "required": [
8023 "patient",
8024 "reward_program"
8025 ],
8026 "properties": {
8027 "patient": {
8028 "type": "object",
8029 "properties": {
8030 "data": {
8031 "type": "object",
8032 "properties": {
8033 "type": {
8034 "type": "string"
8035 },
8036 "id": {
8037 "type": "string"
8038 }
8039 }
8040 }
8041 }
8042 },
8043 "reward_program": {
8044 "type": "object",
8045 "properties": {
8046 "data": {
8047 "type": "object",
8048 "properties": {
8049 "type": {
8050 "type": "string"
8051 },
8052 "id": {
8053 "type": "string"
8054 }
8055 }
8056 }
8057 }
8058 }
8059 }
8060 }
8061 }
8062 },
8063 "FetchRewardProgramActivationResponse": {
8064 "type": "object",
8065 "required": [
8066 "data"
8067 ],
8068 "properties": {
8069 "meta": {
8070 "$ref": "#/definitions/FetchMetaResponse"
8071 },
8072 "data": {
8073 "$ref": "#/definitions/RewardProgramActivationResource"
8074 }
8075 }
8076 },
8077 "FetchRewardProgramActivationsResponse": {
8078 "type": "object",
8079 "required": [
8080 "data"
8081 ],
8082 "properties": {
8083 "meta": {
8084 "$ref": "#/definitions/FetchMetaResponse"
8085 },
8086 "data": {
8087 "type": "array",
8088 "items": {
8089 "$ref": "#/definitions/RewardProgramActivationResource"
8090 }
8091 }
8092 }
8093 },
8094 "CreateRewardProgramActivationRequest": {
8095 "type": "object",
8096 "required": [
8097 "data"
8098 ],
8099 "properties": {
8100 "data": {
8101 "$ref": "#/definitions/RewardProgramActivationResource"
8102 }
8103 }
8104 },
8105 "CreateRewardProgramActivationResponse": {
8106 "type": "object",
8107 "required": [
8108 "data"
8109 ],
8110 "properties": {
8111 "meta": {
8112 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
8113 },
8114 "data": {
8115 "$ref": "#/definitions/RewardProgramActivationResource"
8116 }
8117 }
8118 },
8119 "RewardResource": {
8120 "type": "object",
8121 "required": [
8122 "type"
8123 ],
8124 "properties": {
8125 "type": {
8126 "type": "string"
8127 },
8128 "id": {
8129 "type": "string"
8130 },
8131 "attributes": {
8132 "type": "object",
8133 "required": [
8134 "description",
8135 "allocated_value",
8136 "allocated_at"
8137 ],
8138 "properties": {
8139 "_thread": {
8140 "description": "Unique string identifying the health action with which the reward is associated.",
8141 "type": "string"
8142 },
8143 "description": {
8144 "description": "Description of the reward.",
8145 "type": "string"
8146 },
8147 "allocated_value": {
8148 "description": "Value of the reward program budget allocated for the reward. (Must not exceed the remaining budget for the reward program activation)",
8149 "type": "number"
8150 },
8151 "allocated_unit": {
8152 "description": "Unit of the reward program. (Read-only property)",
8153 "type": "string",
8154 "readOnly": true
8155 },
8156 "allocated_at": {
8157 "description": "Date at which the reward was allocated. (Must be after the reward program is activated and before it is deactivated or expires)",
8158 "type": "string",
8159 "format": "dateTime"
8160 },
8161 "target_at": {
8162 "description": "Date at which the patient aspires to achieve the reward. (Must be the same or after the allocated_at date)",
8163 "type": "string",
8164 "format": "dateTime"
8165 },
8166 "earned_value": {
8167 "description": "Value of the reward that has been earned. (Read-only property)",
8168 "type": "number",
8169 "readOnly": true
8170 },
8171 "earned_at": {
8172 "description": "Date at which the reward was earned. (Read-only property)",
8173 "type": "string",
8174 "format": "dateTime",
8175 "readOnly": true
8176 },
8177 "fulfilled_value": {
8178 "description": "Value of the earned reward that has been fulfilled. (Read-only property)",
8179 "type": "number",
8180 "readOnly": true
8181 },
8182 "fulfilled_at": {
8183 "description": "Date at which the reward earning was fulfilled. (Read-only property)",
8184 "type": "string",
8185 "format": "dateTime",
8186 "readOnly": true
8187 }
8188 }
8189 },
8190 "relationships": {
8191 "type": "object",
8192 "required": [
8193 "reward_program_activation"
8194 ],
8195 "properties": {
8196 "patient": {
8197 "type": "object",
8198 "readOnly": true,
8199 "properties": {
8200 "data": {
8201 "type": "object",
8202 "properties": {
8203 "type": {
8204 "type": "string"
8205 },
8206 "id": {
8207 "type": "string"
8208 }
8209 }
8210 }
8211 }
8212 },
8213 "reward_program_activation": {
8214 "type": "object",
8215 "properties": {
8216 "data": {
8217 "type": "object",
8218 "properties": {
8219 "type": {
8220 "type": "string"
8221 },
8222 "id": {
8223 "type": "string"
8224 }
8225 }
8226 }
8227 }
8228 }
8229 }
8230 }
8231 }
8232 },
8233 "FetchRewardResponse": {
8234 "type": "object",
8235 "required": [
8236 "data"
8237 ],
8238 "properties": {
8239 "meta": {
8240 "$ref": "#/definitions/FetchMetaResponse"
8241 },
8242 "data": {
8243 "$ref": "#/definitions/RewardResource"
8244 }
8245 }
8246 },
8247 "FetchRewardsResponse": {
8248 "type": "object",
8249 "required": [
8250 "data"
8251 ],
8252 "properties": {
8253 "meta": {
8254 "$ref": "#/definitions/FetchMetaResponse"
8255 },
8256 "data": {
8257 "type": "array",
8258 "items": {
8259 "$ref": "#/definitions/RewardResource"
8260 }
8261 }
8262 }
8263 },
8264 "CreateRewardRequest": {
8265 "type": "object",
8266 "required": [
8267 "data"
8268 ],
8269 "properties": {
8270 "data": {
8271 "$ref": "#/definitions/RewardResource"
8272 }
8273 }
8274 },
8275 "CreateRewardResponse": {
8276 "type": "object",
8277 "required": [
8278 "data"
8279 ],
8280 "properties": {
8281 "meta": {
8282 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
8283 },
8284 "data": {
8285 "$ref": "#/definitions/RewardResource"
8286 }
8287 }
8288 },
8289 "RewardEarningResource": {
8290 "type": "object",
8291 "required": [
8292 "type"
8293 ],
8294 "properties": {
8295 "type": {
8296 "type": "string"
8297 },
8298 "id": {
8299 "type": "string"
8300 },
8301 "attributes": {
8302 "type": "object",
8303 "required": [
8304 "earned_value",
8305 "earned_at"
8306 ],
8307 "properties": {
8308 "earned_value": {
8309 "description": "Value of the reward that has been earned. (Must not exceed the allocated value for the reward)",
8310 "type": "number"
8311 },
8312 "earned_unit": {
8313 "description": "Unit of the reward that has been earned. (Read-only property)",
8314 "type": "string",
8315 "readOnly": true
8316 },
8317 "earned_at": {
8318 "description": "Date at which the reward was earned. (Must be after the reward was allocated and before the reward program activation was deactivated or expired)",
8319 "type": "string",
8320 "format": "dateTime"
8321 },
8322 "ready_for_fulfillment": {
8323 "description": "If true, the reward earning is ready to be fulfilled, either because the reward program activation was fulfill_as_earned or because the reward program activation has been deactivated. (Read-only property)",
8324 "type": "boolean",
8325 "readOnly": true
8326 },
8327 "fulfilled_value": {
8328 "description": "Value of the earned reward that has been fulfilled. (Read-only property)",
8329 "type": "number",
8330 "readOnly": true
8331 },
8332 "fulfilled_at": {
8333 "description": "Date at which the reward earning was fulfilled. (Read-only property)",
8334 "type": "string",
8335 "format": "dateTime",
8336 "readOnly": true
8337 }
8338 }
8339 },
8340 "relationships": {
8341 "type": "object",
8342 "required": [
8343 "reward"
8344 ],
8345 "properties": {
8346 "group": {
8347 "type": "object",
8348 "readOnly": true,
8349 "properties": {
8350 "data": {
8351 "type": "object",
8352 "properties": {
8353 "type": {
8354 "type": "string"
8355 },
8356 "id": {
8357 "type": "string"
8358 }
8359 }
8360 }
8361 }
8362 },
8363 "patient": {
8364 "type": "object",
8365 "readOnly": true,
8366 "properties": {
8367 "data": {
8368 "type": "object",
8369 "properties": {
8370 "type": {
8371 "type": "string"
8372 },
8373 "id": {
8374 "type": "string"
8375 }
8376 }
8377 }
8378 }
8379 },
8380 "reward_program_activation": {
8381 "type": "object",
8382 "readOnly": true,
8383 "properties": {
8384 "data": {
8385 "type": "object",
8386 "properties": {
8387 "type": {
8388 "type": "string"
8389 },
8390 "id": {
8391 "type": "string"
8392 }
8393 }
8394 }
8395 }
8396 },
8397 "reward": {
8398 "type": "object",
8399 "properties": {
8400 "data": {
8401 "type": "object",
8402 "properties": {
8403 "type": {
8404 "type": "string"
8405 },
8406 "id": {
8407 "type": "string"
8408 }
8409 }
8410 }
8411 }
8412 }
8413 }
8414 }
8415 }
8416 },
8417 "FetchRewardEarningResponse": {
8418 "type": "object",
8419 "required": [
8420 "data"
8421 ],
8422 "properties": {
8423 "meta": {
8424 "$ref": "#/definitions/FetchMetaResponse"
8425 },
8426 "data": {
8427 "$ref": "#/definitions/RewardEarningResource"
8428 }
8429 }
8430 },
8431 "FetchRewardEarningsResponse": {
8432 "type": "object",
8433 "required": [
8434 "data"
8435 ],
8436 "properties": {
8437 "meta": {
8438 "$ref": "#/definitions/FetchMetaResponse"
8439 },
8440 "data": {
8441 "type": "array",
8442 "items": {
8443 "$ref": "#/definitions/RewardEarningResource"
8444 }
8445 }
8446 }
8447 },
8448 "CreateRewardEarningRequest": {
8449 "type": "object",
8450 "required": [
8451 "data"
8452 ],
8453 "properties": {
8454 "data": {
8455 "$ref": "#/definitions/RewardEarningResource"
8456 }
8457 }
8458 },
8459 "CreateRewardEarningResponse": {
8460 "type": "object",
8461 "required": [
8462 "data"
8463 ],
8464 "properties": {
8465 "meta": {
8466 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
8467 },
8468 "data": {
8469 "$ref": "#/definitions/RewardEarningResource"
8470 }
8471 }
8472 },
8473 "RewardEarningFulfillmentResource": {
8474 "type": "object",
8475 "required": [
8476 "type"
8477 ],
8478 "properties": {
8479 "type": {
8480 "type": "string"
8481 },
8482 "id": {
8483 "type": "string"
8484 },
8485 "attributes": {
8486 "type": "object",
8487 "required": [
8488 "fulfilled_value",
8489 "fulfilled_at"
8490 ],
8491 "properties": {
8492 "fulfilled_value": {
8493 "description": "Value of the earned reward that has been fulfilled. (Must be greater than or equal to 0)",
8494 "type": "number"
8495 },
8496 "fulfilled_unit": {
8497 "description": "Unit of the earned reward that has been fulfilled. (Read-only property)",
8498 "type": "string",
8499 "readOnly": true
8500 },
8501 "fulfilled_at": {
8502 "description": "Date at which the reward earning was fulfilled. (Must be at the same time or after the reward was earned)",
8503 "type": "string",
8504 "format": "dateTime"
8505 }
8506 }
8507 },
8508 "relationships": {
8509 "type": "object",
8510 "required": [
8511 "reward_earning"
8512 ],
8513 "properties": {
8514 "patient": {
8515 "type": "object",
8516 "readOnly": true,
8517 "properties": {
8518 "data": {
8519 "type": "object",
8520 "properties": {
8521 "type": {
8522 "type": "string"
8523 },
8524 "id": {
8525 "type": "string"
8526 }
8527 }
8528 }
8529 }
8530 },
8531 "reward_earning": {
8532 "type": "object",
8533 "properties": {
8534 "data": {
8535 "type": "object",
8536 "properties": {
8537 "type": {
8538 "type": "string"
8539 },
8540 "id": {
8541 "type": "string"
8542 }
8543 }
8544 }
8545 }
8546 }
8547 }
8548 }
8549 }
8550 },
8551 "FetchRewardEarningFulfillmentResponse": {
8552 "type": "object",
8553 "required": [
8554 "data"
8555 ],
8556 "properties": {
8557 "meta": {
8558 "$ref": "#/definitions/FetchMetaResponse"
8559 },
8560 "data": {
8561 "$ref": "#/definitions/RewardEarningFulfillmentResource"
8562 }
8563 }
8564 },
8565 "FetchRewardEarningFulfillmentsResponse": {
8566 "type": "object",
8567 "required": [
8568 "data"
8569 ],
8570 "properties": {
8571 "meta": {
8572 "$ref": "#/definitions/FetchMetaResponse"
8573 },
8574 "data": {
8575 "type": "array",
8576 "items": {
8577 "$ref": "#/definitions/RewardEarningFulfillmentResource"
8578 }
8579 }
8580 }
8581 },
8582 "CreateRewardEarningFulfillmentRequest": {
8583 "type": "object",
8584 "required": [
8585 "data"
8586 ],
8587 "properties": {
8588 "data": {
8589 "$ref": "#/definitions/RewardEarningFulfillmentResource"
8590 }
8591 }
8592 },
8593 "CreateRewardEarningFulfillmentResponse": {
8594 "type": "object",
8595 "required": [
8596 "data"
8597 ],
8598 "properties": {
8599 "meta": {
8600 "$ref": "#/definitions/CreateOrUpdateMetaResponse"
8601 },
8602 "data": {
8603 "$ref": "#/definitions/RewardEarningFulfillmentResource"
8604 }
8605 }
8606 }
8607 }
8608}