Skip to content

Instantly share code, notes, and snippets.

@genee19
Last active February 20, 2025 12:37
Show Gist options
  • Save genee19/b42c82ff58f39b1b3591d4a515199b4d to your computer and use it in GitHub Desktop.
Save genee19/b42c82ff58f39b1b3591d4a515199b4d to your computer and use it in GitHub Desktop.
openapi: 3.0.0
info:
title: Patients API
version: 1.0.0
paths:
/patients/available:
get:
summary: Get a list of patients that could be assigned to the current doctor
tags:
- Patients
responses:
'200':
description: A list of available patients
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/AvailablePatient'
/patients/own:
get:
summary: Get a list of patients assigned to the current doctor
tags:
- Patients
parameters:
- in: query
name: sort
schema:
type: string
enum: [name, appointment]
description: Sort the list by patient name or by the closest appointment
responses:
'200':
description: A list of assigned patients
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OwnPatient'
post:
summary: Assign a patient to the current doctor
tags:
- Patients
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
patient_id:
type: integer
description: ID of the patient
indication_id:
type: integer
description: ID of the indication
responses:
'201':
description: Patient successfully assigned
'422':
description: Unprocessable Entity
content:
application/json:
schema:
type: object
properties:
error:
type: string
components:
schemas:
AvailablePatient:
type: object
properties:
id:
type: integer
first_name:
type: string
last_name:
type: string
insurance_number:
type: string
created_at:
type: string
format: date-time
OwnPatient:
type: object
properties:
id:
type: integer
first_name:
type: string
last_name:
type: string
insurance_number:
type: string
next_appointment:
type: string
format: date-time
created_at:
type: string
format: date-time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment