Git Product home page Git Product logo

victor-m16 / smart-pharmacist Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 13.86 MB

An IoT e-health system built as a Final Year Project for Our Electronics and Computer Engineering Degrees at Malawi University of Business and Applied Science

Home Page: https://smart-pharmacist-production.up.railway.app/

HTML 11.20% CSS 38.15% Io 0.37% Python 9.96% JavaScript 37.45% C++ 2.86% Procfile 0.01%
django esp32 internet-of-things tailwind embedded-systems

smart-pharmacist's Introduction

Smart Pharmacist

This project repository holds architecture and website source code for the Smart Pharmacist final year engineering project being implemented at Malawi University Of Business And Applied Sciences by Victor Mjimapemba, Khumbolawo Mussa and Grace Chiwaya.

The project consists of a hardware and software element. The hardware element is an electronics project that is a rudimentary prototype of a carousel vending machine meant to dispense prescription medication. Further documentation for these componenents can be found in the firmware and concepts folders.

The software component is a built from the ground up hospital management system meant to work in tandem with the prototype. The main system is a django project named smartpharmacist

Use Case Workflow

  1. The patient completes a consultation with the doctor, who enters the prescription details into the web system, such as the patient's name, sickness and prescribed medication and instructions to take the medications.
  2. The system automatically generates a unique 4-digit "prescription.code" which it assigns to the prescription the doctor just submitted.
  3. The system sends an SMS message to the patient, containing the prescription.code, the names of the prescribed medications and the associated instructions. If the patient has no phone or their phone is off, the code is also displayed on the doctor's screen so the patient can copy it down on a paper or their physical health passport.
  4. The patient goes to the vennding machine prototype,which has already been boooted, has authenticated itself with the backend server using jwt and gone into ready-state. The patient then inputs the received "prescription.code" on the numeric keypad, using visual feedback from the 16x2 LCD module.
  5. The machine goes into code-validation-state where it sends the received code to the backend server for processing as a POST request for security.
  6. The backend server checks the code against its prescriptions database and if the code exists and corresponds to a prescription that has not been dispensed yet, then it queries the database for the medications assigned to this prescription and the vending slots where these pre-packaged medications were stored. The server responds to to the vending machine after this processing with either an error message if the code was invalid or a list of vending slots in optimised order for the vending machine to rotate to if the code was valid.
  7. If the vending machine received a list of vending slots, then it goes into dispensing-state where it rotates in order of the received slots, allowing the patient to collect all their assigned medications.
  8. The vending machine updates the prescription in the database so that itself and other vending machines know that that prescription code is no longer valid and has been dispensed.
  9. The vending machine goes back into ready-state to be ready to service the next patient and code.

Technologies

  1. Django
  2. Django-Rest-FrameWork
  3. HTML/CSS
  4. Tailwind CSS
  5. ArduinoIDE
  6. Twilio

Hardware

  1. 16x2 LCD module. Ours uses (0x27) addressing. You need to check this.
  2. ESP32
  3. 4X4 Matrix Keypad
  4. NEMA 17 Motors (17HS4023)
  5. L298N Motor Drivers

Setting Up The Project

  1. Fork and clone this repository

  2. Setup your Django development environment. More instructions here

  3. Make sure to also have node.js installed. Instructions here

  4. Create a python virtual environment in the smartpharmacist directory

  5. Install Django dependencies for the project using the requirements.txt

pip install requirements.txt
  1. Install django-tailwind dependencies by navigating to theme\static_src\ in your terminal and typing
npm install
  1. Create a local_settings.py file in the smartpharmacist directory and include the following Python code
from .base_settings import *

Here you can specify any extra configuration specification to your environment, such as database connection.

  1. Start the Tailwind Development server by running the following command in your terminal
python manage.py tailwind start
  1. Start the Django development server by running the following command in your terminal:
python manage.py runserver

Contributing To The Project

Feel free to contact the developers with any contributions you would like to make

smart-pharmacist's People

Contributors

victor-m16 avatar khumbolawo avatar

Watchers

 avatar

Forkers

khumbolawo

smart-pharmacist's Issues

Firmware

  • Add a reset button to the circuit
  • Potentially add a servo that works in tandem to control access to the machine.

Landing page required.

  • 1. Need the root url to not be the login screen but rather a landing page that describes the system. It will have a picture of the prototype, and us when completed.
  • 2. feel free to get some inspiration from various websites.
  • 3. Need some assets. The MUBAS logo and QECH logo should appear on the landing page.
  • 4. Create our own or use the MUBAS logo as the favicon. If created, it must also show up on the landing page together with the other two logos.
  • 5. The login screen on mobile view has no heading maybe its just my phone, but it seems to be unique to that page

Implement Pharmacist restock vending machine functionality

Basically a form that will allow the pharmacist to record the

  • inventory
  • medication
  • vending machine
  • vending slot

That they have just added.

The minute they press submit the system will update its records and guide patients to the correct vending machines accordingly.

The API approach we have been using should be used to keep the frontend and backend decoupled

Forms need relevant logic attached to them using new api approach

Not sure I fully understand how to do it yet but I'll try. You can takeover the issue if you'd rather do it/there's a way you'd rather do it

  • 1. New medication form (pharmacist view)
  • 2. New patient form (this one seems tricky? Since it needs the user model which has a bunch of stuff in it
  • 3. Rendering medications on pharmacist view as an inventory table or something
  • 4. Rendering prescriptions specific to the doctor view that created them

Laser cut the carousel with Custom

The carousel components will be ready in a few hours, need to test the stepper motor with load. We also need to find some threaded screws that fit on our stepper motor inorder to brace it from vibrating. Have an exciting design in mind actually. Should also explore more heat sinking possibilities to be on the safe side. After the 'landing page added' deployment we won't touch the website code again until the mechanical aspect of the prototype is done.

Here @GraceChiwaya will be crucial as she has been pushing that aspect of the project

Add a logout link to the navbar

The Logout link must submit a post request to the "logout/" url, something like:

<form id="logoutForm" method="post" action="{% url 'users-logout' %}">
    {% csrf_token %}
</form>
<li class="side-nav-item">
    <a href="javascript:void(0);" class="side-nav-link" onclick="submitLogoutForm()">
        <i class="ri-logout-box-line"></i>
        <span> Logout </span>
    </a>
</li>

And the JS in the submitLogoutForm() will look something like this:

<script>
    function submitLogoutForm() {
        // Get the form element
        var form = document.getElementById('logoutForm');

        // Submit the form
        form.submit();
    }
</script>

Alternatively, if you want to dodge the JS you can make it a button of submit type instead of a link. The choice is yours.

The tables seem a bit fluky. I don't know if its the ajax request to the API but they aren't working as expected, the bottom one (prescription medication table ) is consistent while the top one is not) need to look into this

          The tables seem a bit fluky. I don't know if its the ajax request to the API but they aren't working as expected, the bottom one (prescription medication table ) is consistent while the top one is not) need to look into this

Originally posted by @Victor-M16 in #41 (comment)

Doctor home page prescription tables

  • The tables must be scrollable, vertically
  • The table data must be sorted in order of 'updated_at' attribute
  • Optional: implement pagination (might take a while, do not prioritise over hardware). Try to do this without touching the backend API code, as this will break other features like the list dropdowns if done that way.

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.