Skip to content

Daniel-Ricardo-Simao-Projects/CMU-pharmacist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PharmacIST

PharmacIST is an Android mobile application designed to simplify medication management for both you and your local pharmacies. Developed as part of the Mobile and Ubiquitous Computation course at IST (2023-2024)

Stack

  • Database: MySQL
  • Backend: Go
  • Frontend: Flutter

Install and Setup Database

  1. We use MySQL (version 8.0.35) as our database. Install the community edition from the official website.

  2. Run the following command to enable the MySQL service:

    sudo systemctl enable mysqld
  3. Run the following command to start the MySQL service:

    sudo service mysqld start
  4. Run the following command to configure the MySQL service:

    sudo mysql_secure_installation
  5. Run the following commands to confirm the installation and login to the MySQL shell:

    mysql --version
    mysql -u root -p

If the version is displayed and you are able to login to the MySQL shell, the installation was successful.

Then you have to change the database configuration in the backend to match your MySQL configuration. The configuration file is located at go_backend/config/db_management.go. It uses an .env file that must be located in the project root directory. Create it with the following variables. Change the password line to match your MySQL password. If you created another user, change the user line as well. The default configuration is as follows:

    DB_DRIVER="mysql"
    DB_USER="root"
    DB_PASS=<YOUR_PASSWORD>
    DB_NAME="pharmacist_app"
    const (
        dbName   = "pharmacist_app"
    )

Where <YOUR_PASSWORD> is the password you set during the MySQL installation.

Run the backend

Install Go

To run the backend, you need to have Go installed. You can follow the instructions on the official website.

Run the backend

With the database configuration set, you can now run the backend with the following command (assuming you are in the main directory):

    cd go_backend
    make run

Besides that, if you want, before running the backend, you can populate or clean the database with the following commands:

    make seed // populate the database
    make drop // clean the database
    make addMed // adds Paracetamol to Pharmacy with id 1 ("Farmácia Alegro Montijo"). Helps debugging the notification feature.

To turn the connection secure between the backend and the flutter app, use cloudflare tunnel

    cloudflared tunnel --url http://localhost:5000

Or use your machine ip or router port forwarding ip, etc.

Copy the generated url to the flutter app explained below.

Run flutter app

Install Flutter

To run the flutter app, you need to have flutter installed. You can follow the instructions on the official website.

Firebase Configuration

Before running the app, you need to configure Firebase. You can follow the instructions down below or follow the instructions on the official website.

  1. Run the following command to install the Firebase CLI:

    curl -sL https://firebase.tools/ | bash
  2. Run the following command to login to Firebase:

    firebase login
  3. Export the service account key file to environment variables:

    export GOOGLE_APPLICATION_CREDENTIALS="path/to/your/serviceAccountKey.json"

Note: For this to work, you need to either have your account connected to our project or create a new project and connect your account to it. If you are using our project, you can ask for the service account key file and to be added to the project.

Run the app

After the backend is running, you can run the flutter app with the following command (assuming you are in the main directory):

    cd flutter_frontend
    flutter run

You can also define a different backend url with the command in case you are running the backend in a different machine or port.

    flutter run --dart-define=URL=<BACKEND_URL>:5000

The default URL is localhost:5000.

If you want to run the app in a real phone instead of an emulator, run this code:

    adb reverse tcp:5000 tcp:5000

Insert google maps API key

You need to place the API key in the flutter app for the map to run.

In AndroidManifest.xml, add the API key here:

    <meta-data 
        android:name="com.google.android.geo.API_KEY"
        android:value="ADD-API-KEY-HERE"
    />

In constants.dart, add here:

    const String apiKey = "API_KEY";

Mandatory Features

  • Allow users to create a username in the application/system.
  • Show a map with pharmacy locations:
    • The map can be dragged or centered on current location;
    • Search for pharmacy given the address
    • Favorite pharmacies have a different marker;
      • The map is not refreshed when a marker is set (and/or in another cases)*
    • Tapping a marker goes to a pharmacy information panel;
  • There should be an option to add a new pharmacy with:
    • Name;
    • Pick location
      • on map,
      • use address, or
      • current location;
    • Take picture;
  • Find medicines (including at least a sub-string search), providing the closest pharmacy with the searched medicine;
    • Search with a sub-string;
    • Closest pharmacy is implemented;
  • Pharmacy Information Panel:
    • Show name
    • Show location. Button to navigate there;
    • Show picture
    • List available medicines;
    • Button to add medicine stock (scan barcode)or create medicine if code unknown:
      • Scan barcode;
      • Name;
      • Box photo (from camera or file);
      • Quantity;
      • Purpose/Preferred Use;
    • Button to purchase/reduce stock (scan barcode);
    • Button to add/remove from favorites;
    • Tapping medicines opens medicine information panel;
  • Medicine Information Panel:
    • Show name and picture;
    • Button to get notification when available in favorite pharmacy;
    • List pharmacies where available, sorted by distance.
      • List pharmacies where available.
      • Sorted by distance.
  • Do map directions

Optional Features

  • Securing Communication;
  • User Ratings;
  • User Accounts;
  • UI Adaptability: Rotation;
  • UI Adaptability: Light/Dark Theme;

About

Pharmacy App with Go and Flutter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •