Skip to content

troylee24/doctor-appointment-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Doctor Appointment System

A REST API built with Python, Django, Django Rest Framework (DRF).

This project provides an appointment service where registered doctors and patients can schedule appointments. It provides endpoints for basic CRUD operations on each entity (i.e. Doctor, Patient, Appointment) and some filtering options based on query parameters.


Project Files Description

/myproj/myapi/

  • models.py - Defines the models.
  • validators.py - Defines custom validators for models.
  • serializers.py - Serializes the models.
  • views.py - Defines the HTTP methods and behaviors for a request.
  • urls.py - Maps endpoint URLs to approriate views.

/myproj/myproj/

  • urls.py - Includes all endpoints defined in /myproj/myapi/urls.py.
  • settings.py - Defines the settings for the project (i.e. enables myapi and rest_framework).

Install Dependencies

$ pip install django
$ pip install djangorestframework
$ pip install django-filter

Getting Started

$ cd myproj
$ python3 manage.py runserver

Model Migration

$ python3 manage.py makemigrations
$ python3 manage.py migrate

Models

Doctor

  • id: int (primary key)
  • first_name: string
  • last_name: string

Patient

  • id: int (primary key)
  • first_name: string
  • last_name: string

Appointment

  • id: int (primary key)
  • doctor: Doctor (foreign key)
  • patient: Patient (foreign key)
  • date: datetime.date
  • time: datetime.time
  • kind: string ('NP' - "New Patient", 'FU' - "Follow-up")

API Endpoints

API Root

  • Displays hyperlinks to main endpoints: GET ''

Doctors

Interacts with the Doctor model

  • Show all doctors: GET /doctors/
  • Add new doctor: POST /doctors/
  • Show a doctor: GET /doctors/<doctor.id>/
  • Update a doctor: PUT /doctors/<doctor.id>/
  • Delete a doctor: DELETE /doctors/<doctor.id>/

Patients

Interacts with the Patient model

  • Show all patients: GET /patients/
  • Add new patient: POST /patients/
  • Show a patient: GET /patients/<patient.id>/
  • Update a patient: PUT /patients/<patient.id>/
  • Delete a patient: DELETE /patients/<patient.id>/

Appointments

Interacts with the Appointment model

  • Show all appointments: GET /appointments/
  • Schedule a new appointment: POST /appointments/
  • Cancel an appointment: DELETE /appointments/
  • Show an appointment: GET /appointments/<appointment.id>/
  • Update an appointment: PUT /appointments/<appointment.id>/
  • Delete an appointment: DELETE /appointments/<appointment.id>/

Filtering

/appointments/

?id={}&doctor={}&patient={}&date={}&time={}&kind={}

  • params: appointment.id, doctor.id, patient.id, appointment.date, appointment.time, appointment.kind

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages