openapi: 3.0.0 info: version: 1.0.19-oas3 title: AlayaCare Accounting Accounts Goals API description: '**AlayaCare IDs:** The following terms are used to reference IDs that identify resources in AlayaCare: - id - visit_id - premium_id - visit_premium_id - employee_id - cost_centre_id - client_id **External IDs** The following terms are used to reference IDs that identify resources systems external to AlayaCare: - employee_external_id - client_external_id External IDs are required to be unique. No other assumptions are made regarding their format they are treated as strings. ' servers: - url: https://example.alayacare.com/ext/api/v2/accounting security: - basic_auth: [] tags: - name: Goals paths: /careplans/goal_types: get: tags: - Goals summary: Get a list of available goal types responses: '200': description: A list of goal types. schema: $ref: '#/definitions/GoalTypeList' '401': $ref: '#/responses/AuthChallenge' '403': $ref: '#/responses/ErrorInsufficientAccess' '404': $ref: '#/responses/ErrorResponseGoalTypeNotFound' /careplans/{plan_id}/goals: parameters: - description: Send request using the Alayacare care plan ID name: plan_id in: path required: true type: integer get: tags: - Goals summary: Get the list of goals within a care plan using the care plan ID description: '- Goals must be enabled in the UI at the tenant System Setting level. ' responses: '200': description: A list of goals schema: $ref: '#/definitions/CarePlanGoalList' '401': $ref: '#/responses/AuthChallenge' '403': $ref: '#/responses/ErrorInsufficientAccess' '404': $ref: '#/responses/ErrorResponseCarePlanNotFound' post: tags: - Goals summary: Create a goal in a care plan using the care plan ID description: 'Create goal attached to a careplan - Goals must be enabled in the UI at the tenant System Setting level - `rank` will automatically be set to next available rank - Only services assigned to the client can be linked to the goal - `service_id` and `external_service_id` are mutually exclusive, specifying both is an invalid request. - Will be applied to all services defined on the client if none is selected - All departments will be applied if `department_id` is set to `null` ' parameters: - description: Create a goal name: body in: body required: true schema: $ref: '#/definitions/CreateCarePlanGoal' responses: '201': description: Careplan goal created schema: $ref: '#/definitions/CarePlanGoal' '400': $ref: '#/responses/ErrorResponseInvalidRequest' '401': $ref: '#/responses/AuthChallenge' '403': $ref: '#/responses/ErrorInsufficientAccess' '404': $ref: '#/responses/ErrorResponseCarePlanNotFound' /careplans/goals/{goal_id}: parameters: - description: ID of goal name: goal_id in: path required: true type: integer get: tags: - Goals summary: Get a specific goal by goal ID responses: '200': description: The goal defined by goal ID schema: $ref: '#/definitions/CarePlanGoal' '400': $ref: '#/responses/ErrorResponseInvalidRequest' '401': $ref: '#/responses/AuthChallenge' '403': $ref: '#/responses/ErrorInsufficientAccess' '404': $ref: '#/responses/ErrorResponseGoalNotFound' put: tags: - Goals summary: Update a specific goal using the goal ID description: 'Update a goal attached to a careplan - Only services assigned to the client can be linked to the goal. - `service_id` and `external_service_id` are mutually exclusive, specifying both is an invalid request. ' parameters: - description: update the goal (goal_id) name: body in: body required: true schema: $ref: '#/definitions/UpdateCarePlanGoal' responses: '204': description: Goal succesfully updated '400': $ref: '#/responses/ErrorResponseInvalidRequest' '401': $ref: '#/responses/AuthChallenge' '403': $ref: '#/responses/ErrorInsufficientAccess' '404': $ref: '#/responses/ErrorResponseGoalNotFound' delete: tags: - Goals summary: Delete a specific goal using the goal ID description: '- Only goals in `draft` status can be deleted ' responses: '204': description: Goal successfully deleted '400': $ref: '#/responses/ErrorResponseInvalidUpdateForRootItemType' '401': $ref: '#/responses/AuthChallenge' '403': $ref: '#/responses/ErrorInsufficientAccess' '404': $ref: '#/responses/ErrorResponseGoalNotFound' /careplans/goals/{goal_id}/status/archived: parameters: - description: ID of goal with changed status name: goal_id in: path required: true type: integer put: tags: - Goals summary: Change the status of a specific goal to archived description: '- A goal can only be archived if the care plan is in active status. ' responses: '204': description: Successfully changed status of goal to archived '400': $ref: '#/responses/ErrorResponseInvalidArchivalForRootItemType' '401': $ref: '#/responses/AuthChallenge' '403': $ref: '#/responses/ErrorInsufficientAccess' '404': $ref: '#/responses/ErrorResponseGoalNotFound' /careplans/goals/{goal_id}/status/completed: parameters: - description: ID of goal with changed status name: goal_id in: path required: true type: integer - description: object to be sent at completion name: body in: body required: true schema: type: object required: - end_date - completion_notes properties: end_date: type: string example: '2020-02-01' completion_note: type: string example: We did it! High five! put: tags: - Goals summary: Change the status of a specific goal to completed description: '- A goal can only be completed if the care plan is in active status. ' responses: '204': description: Successfully changed status of goal to archived '400': $ref: '#/responses/ErrorResponseInvalidRequest' '401': $ref: '#/responses/AuthChallenge' '403': $ref: '#/responses/ErrorInsufficientAccess' '404': $ref: '#/responses/ErrorResponseGoalNotFound' components: securitySchemes: basic_auth: type: http description: Basic HTTP auth over https scheme: basic definitions: CareplanItemStatus: type: string enum: - active - completed - archived GoalProgress: description: Goal progress information properties: comment: type: string percentage: type: integer completed: type: boolean example: comment: That was hard completed: false CarePlanGoalList: description: The list of goals type: object properties: items: type: array items: $ref: '#/definitions/CarePlanGoal' ServiceList: type: array items: $ref: '#/definitions/ServiceDetails' CreateCarePlanGoal: description: JSON schema for creating care plan goal type: object required: - name - start_date - type - progress_type - department_id - is_primary properties: name: description: Title of the care plan goal type: string example: Example goal start_date: description: Start date of the goal type: string example: '2018-01-10' end_date: description: End date of the goal type: string example: '2018-01-10' description: description: Description of the care plan goal type: string example: Description of goal is_primary: description: Define that this goal is primary type: boolean example: true type: type: string description: Goal Type example: Desires/Motivations progress_type: $ref: '#/definitions/GoalMethod' department_id: description: The ID of selected department type: integer example: 1 x-nullable: true service_ids: description: The list of service ID's that is linked to created diagnosis.Only services assigned to the client can be linked to the diagnosis. type: array items: type: integer example: - 1 - 4 - 6 external_service_ids: description: The list of service external ID's that is linked to a diagnosis. Only services assigned to the client can be linked to the diagnosis. type: array items: type: string example: - sor_service_id_1 - sor_service_id_2 - sor_service_id_3 tag_ids: description: The list of tag ID's that is linked to created diagnosis type: array items: type: integer example: - 2 - 4 - 8 diagnosis_ids: description: The list of diagnosis ID that is linked to created goal. Only giagnoses available in the careplan can be assigned to the goal. type: array items: type: integer example: - 2 - 4 - 8 EntitySummaryList: type: array items: $ref: '#/definitions/EntitySummary' EntitySummary: type: object required: - id - name properties: id: type: integer description: AlayaCare entity ID example: 1001 name: type: string description: Alayacare entity name example: entity name UpdateCarePlanGoal: description: JSON schema for creating care plan diagnosis type: object properties: name: description: A title of care plan goal type: string example: Example goal start_date: description: A start date of goal type: string example: '2018-01-10' end_date: description: A end date of goal type: string example: '2018-01-10' description: description: A description of care plan goal type: string example: Description of goal is_primary: description: Define that this goal is primary type: boolean example: true rank: description: Used for ordering of goals in list. The smaller, the higher. Can be the number of place in the list of goals in care plan type: integer example: 0 type: $ref: '#/definitions/GoalType' progress_type: $ref: '#/definitions/GoalMethod' department_id: description: The ID of selected department type: integer example: 1 x-nullable: true service_ids: description: The list of service ID's that is linked to created diagnosis.Only services assigned to the client can be linked to the diagnosis. type: array items: type: integer example: - 1 - 4 - 6 tag_ids: description: The list of tag ID's that is linked to created diagnosis type: array items: type: integer example: - 2 - 4 - 8 diagnosis_ids: description: 'The list of diagnosis IDs that is linked to created goal. ' type: array items: type: integer example: - 2 - 4 - 8 ErrorResponse: description: Error response type: object properties: status_code: type: integer description: Response code message: type: string description: Detailed error message required: - code - message GoalTypeList: description: List of goal types type: object properties: items: type: array items: $ref: '#/definitions/GoalType' CarePlanGoal: description: Care plan goal type: object properties: id: description: Care Plan Goal ID type: integer example: 100 plan_id: description: Care Plan ID type: integer example: 345 plan_name: description: Care plan name type: string example: 'Episode #4' name: description: A title of care plan goal type: string example: Title example start_date: description: A start date of goal type: string example: '2018-01-10' target_end_date: description: A end date of goal type: string example: '2018-01-10' description: description: A description of care plan goal type: string example: Description of goal is_primary: description: Define that this goal is primary type: boolean example: true rank: description: Used for ordering of goals in the list. The smaller, the higher ranked will the diagnosis be returned. type: integer example: 0 department: $ref: '#/definitions/EntitySummary' type: type: string description: Goal Type example: Desires/Motivations progress_type: $ref: '#/definitions/GoalMethod' last_updated_progress: $ref: '#/definitions/GoalProgress' status: $ref: '#/definitions/CareplanItemStatus' services: description: The list of services that are linked to the goal $ref: '#/definitions/ServiceList' tags: description: The list of tags that are linked to the goal $ref: '#/definitions/EntitySummaryList' diagnoses: description: The list of diagnoses that are linked to the goal $ref: '#/definitions/EntitySummaryList' updated_at: description: Datetime for the last update for this goal type: string example: '2018-01-23T23:56:13+00:00' updated_by: $ref: '#/definitions/User' created_at: description: Datetime for the creation of this goal type: string example: '2017-12-20T23:56:13+00:00' created_by: $ref: '#/definitions/User' completed_at: description: Datetime when the goal was completed type: string example: '2017-12-20T23:56:13+00:00' x-nullable: true completed_by: $ref: '#/definitions/User' x-nullable: true completion_note: description: Completion note of the goal type: string x-nullable: true User: description: User id, first and last names type: object properties: id: description: The id of user type: integer example: 5 external_id: description: The id of user type: string example: sor_external_id_1 GoalType: description: List of goal types type: object example: - Nursing - Physiotherapy - Occupational Therapy - Speech Therapy - Personal Care GoalMethod: description: Progress tracking method of goal type: string enum: - none - per_visits - percentage example: percentage ServiceDetails: description: Service details type: object x-nullable: true properties: id: type: integer description: AlayaCare service ID example: 1001 external_id: type: string description: External service ID example: sor_service_id_1 x-nullable: true responses: ErrorResponseGoalTypeNotFound: description: Field 'goal_type' is invalid schema: $ref: '#/definitions/ErrorResponse' examples: application/json: status_code: 404 message: Field 'goal_type' is invalid ErrorResponseGoalNotFound: description: Goal not found schema: $ref: '#/definitions/ErrorResponse' examples: application/json: status_code: 404 message: Goal not found ErrorInsufficientAccess: description: You do not have the required permissions to perform this action schema: $ref: '#/definitions/ErrorResponse' examples: application/json: status_code: 403 message: Access required ErrorResponseInvalidArchivalForRootItemType: description: The root item type cannot be archived once it has been completed schema: $ref: '#/definitions/ErrorResponse' examples: application/json: status_code: 400 message: The root item type cannot be archived once it has been completed ErrorResponseCarePlanNotFound: description: Care plan not found schema: $ref: '#/definitions/ErrorResponse' examples: application/json: status_code: 404 message: Care plan not found AuthChallenge: description: Authentication required. schema: $ref: '#/definitions/ErrorResponse' examples: application/json: status_code: 401 message: Please verify your access level for this url. ErrorResponseInvalidRequest: description: Invalid data submitted for item creation. schema: $ref: '#/definitions/ErrorResponse' examples: application/json: status_code: 400 message: The field 'start_date' is required. ErrorResponseInvalidUpdateForRootItemType: description: The root item type cannot be deleted once it has been completed schema: $ref: '#/definitions/ErrorResponse' examples: application/json: status_code: 400 message: The root item type cannot be deleted in current status