Coder Social home page Coder Social logo

hospital_accounts's Introduction

Hospital API

This is a Django-based API for managing hospital operations, including doctors, patients, departments, and patient records.

Table of Contents

Features

  • User authentication (login, signup, logout) for both doctors and patients
  • CRUD operations for doctors, patients, departments, and patient records
  • Role-based access control (staff vs non-staff users)
  • Department-wise listing of doctors and patients

Installation

Using Docker

  1. Pull the Docker image:

    docker pull arjunksoni/hospital_account:dev
    
  2. Run the Docker container:

    docker run -p 10000:10000 arjunksoni/hospital_account:dev
    

Manual Installation

  1. Clone the repository:

    git clone https://github.com/ArjunKSoni/Hospital_Accounts.git
    cd Hospital_Accounts
    cd hospital
    
  2. Create a virtual environment and activate it:

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    
  3. Install the required packages:

    pip install -r requirements.txt
    
  4. Apply migrations:

    python manage.py migrate
    
  5. Create a superuser (admin):

    python manage.py createsuperuser
    
  6. Run the development server:

    python manage.py runserver 10000
    

Usage

After starting the server, you can access the API at http://localhost:10000/.

API Endpoints

Authentication

  • Login: POST /
  • Signup (Patient): POST /signup_patient/
  • Signup (Doctor): POST /signup_doctor/
  • Logout: GET /logout

Doctors

  • List all doctors: GET /api/v1/accounts/doctors/
  • Create a doctor: POST /api/v1/accounts/doctors/
  • Get, update, or delete a specific doctor: GET/PUT/DELETE /api/v1/accounts/doctors/<id>/

Patients

  • List all patients: GET /api/v1/accounts/patients/
  • Create a patient: POST /api/v1/accounts/patients/
  • Get, update, or delete a specific patient: GET/PUT/DELETE /api/v1/accounts/patients/<id>/

Patient Records

  • List all patient records: GET /api/v1/accounts/patient_records/
  • Create a patient record: POST /api/v1/accounts/patient_records/
  • Get, update, or delete a specific patient record: GET/PUT/DELETE /api/v1/accounts/patient_records/<id>/

Departments

  • List all departments: GET /api/v1/accounts/departments/
  • Create a department: POST /api/v1/accounts/departments/
  • Get doctors in a department: GET /api/v1/accounts/department/<did>/doctors/
  • Get patients in a department: GET /api/v1/accounts/department/<did>/patients/

Authentication

This API uses session-based authentication. Users must log in to access protected endpoints. Different views have different access levels based on whether the user is staff (doctor) or non-staff (patient).

  • Patients can only view their own records.
  • Doctors (staff) can view and manage all data.

Make sure to include proper authentication headers when making requests to protected endpoints.

hospital_accounts's People

Contributors

arjunksoni avatar

Watchers

 avatar

Forkers

arjunksoni0520

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.