/medisight

Medisight is a quick and easy way to contact a practitioner about any medical concerns you may have.

Primary LanguageHTML

Live Demo: Link

A readme for medisight flask web application.

When we started this project, our primary focus was on simplicity and accessibility. We stripped away all the features that only contribute to complexity. As a result, our service is very easy to install and use. It also means that it's very easy to contribute new features to this project. If you are interested in contributing, please make a pull request and we will review it as soon as possible.

Table of Contents

Features

  • Login
  • Local Authentication using Email and hashed Password
  • API Examples
    • Infobip, Google Cloud, gCloud SQL, Github, OpenAI, MayoClinic, Postgresql
  • Meetings
    • Create, Edit, Delete, Join, Leave, View
  • Medical Form
    • Create, Edit, Delete, View

Prerequisites

  • PostgreSQL (local install OR hosted (like on gCloud))

    • Local Install: PostgreSQL)
    • Hosted: No need to install, see the Google Cloud SQL DB section
  • Flask 3+

  • Command Line Tools

  •  Mac OS X: Xcode (or OS X 10.9+: xcode-select --install)

  •  Windows: Visual Studio Code + Windows Subsystem for Linux - Ubuntu OR Visual Studio

  •  Ubuntu /  Linux Mint: sudo apt-get install build-essential

  •  Fedora: sudo dnf groupinstall "Development Tools"

  •  OpenSUSE: sudo zypper install --type pattern devel_basis

Note: If you are new to Flask, you may find Python Flask Tutorial: Full-Featured Web App series helpful for learning the basics of Flask and networking. Alternatively, here is another great tutorial for complete beginners - Flask Tutorial by Tech with Tim.

Getting Started

Step 1: The easiest way to get started is to clone the repository:

# Get the latest snapshot
git clone https://github.com/harishuthaya/hackwestern.git

# Change directory
cd hackwestern

# Install NPM dependencies
pip3 install -r requirements.txt

# Then simply start your app
flask run

Note: I highly recommend installing theFuck. It allows you to have a much smoother experience within the terminal. During debugging or development, on the off chance that you mess up a terminal command, simply typing fuck afterwards will correct the command and allow you to run it again.

Step 2: Obtain API Keys and change configs if needed After completing step 1 and locally installing Postgresql, you should be able to access the application through a web browser (at 127.0.0.1:5000) and use local user accounts after changing the database connection information. However, certain functions like API integrations may not function correctly until you obtain specific keys from service providers. The keys provided in the project serve as placeholders, and you can retain them for features you are not currently utilizing. To incorporate the acquired keys into the application, you have two options:

  1. Set environment variables in your console session: Alternatively, you can set the keys as environment variables directly through the command prompt. For instance, in bash, you can use the export command like this: export API_KEY=xxxxxx. This method is considered a better practice as it reduces the risk of accidentally including your secrets in a code repository.
  2. Replace the keys in the .env file: Open the .env file and update the placeholder keys with the newly acquired ones. This method has the risk of accidental checking-in of your secrets to code repos, however makes it easier to collaborate on multiple systems.

What to get and configure:

  • API keys for service providers in the API Examples if you are planning to use them.

  • PostgreSQL

    • If you are using PostgreSQL on Google Cloud SQL instead of a local db, allow connections from your local public ips on the networking tab. Otherwise your connection will be denied.

Step 3: Develop your application and customize the experience

Step 4: Optional - deploy to production

Obtaining API Keys

You will need to obtain appropriate credentials (Client ID, Client Secret, API Key) for API and service provides which you need (Infobip, OpenAI, Metered). See Step 2 in the Getting started section for more info.


Infobip API Example


  • Visit Google Cloud Console
  • Click on the Create Project button
  • Enter Project Name, then click on Create button
  • Then click on APIs & auth in the sidebar and select API tab
  • Click on Google SQL API under SQL, then click Enable API
  • Application Type: Web Application
  • Authorized Flask origins: set to your BASE_URL value (i.e. http:127.0.0.1:5000, etc)

Project Structure

Name Description
flaskr/init.py Flask webserver running on 127.0.0.1:5000
static/api.js Controller for /api route and all login api examples.
static/image1.png Medical practitioner image.
static/image2.png Computer image.
static/image3.png Web meeting graphic.
static/image4.png Medical practitioners discussing image.
templates/navbar.html Navbar html file and structure.
templates/index.html Index page html structure.
templates/layout.html Layout html & css for landing page.
templates/login.html Login webpage with login form.
templates/signup.html Sign-up webpage with sign-up form.
.env Environment variables & API keys.
app.py Test flask webserver instance for debugging.
auth.py Database and Webserver authentication.
diagnos.py AI driven medical diagnosis.
infobip.py Infobip testing and function declaration.
webRTC.py webRTC with Metered API, main functions.
README.md Repository README.md file (this file).

Note: There is no preference for how you name or structure your views. You could place all your templates in a top-level views directory without having a nested folder structure if that makes things easier for you. Just don't forget to corresponding render_template() paths in init.py.

List of Packages

Package Description
Flask Webserver library (backend)
OpenAI OpenAI SDK API (medical ai)
psycopg2 / psycopg2_binary Postgresql library
requests POST / GET requests library
rich Rich format within cli

Useful Tools and Resources

  • RealPython - Database of Python SQL Libraries
  • Awesome Python - A curated list of awesome Python frameworks, libraries, software and resources
  • git - the simple guide - just a simple guide for getting started with git. no deep shit
  • sentdex - Python Programming tutorials, going further than just the basics

Recommended Design Resources


Contributing

If something is unclear, confusing, or needs to be refactored, please let me know. Pull requests are always welcome, but due to the opinionated nature of this project, I cannot accept every pull request. Please open an issue before submitting a pull request.

License

The MIT License (MIT)

Copyright (c) 2023-2023 Medisight.co

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.