Skip to main content

Command Palette

Search for a command to run...

emr hospital

Published
4 min readView as Markdown
E

Ekemini Thompson is a Machine Learning Engineer and Data Scientist, specializing in AI solutions, predictive analytics, and healthcare innovations, with a passion for leveraging technology to solve real-world problems.


Step 1: Create a Folder on Desktop

  1. Create Folder:

    • Right-click on your Desktop and select New > Folder.

    • Name the folder MyFullStackApp (or any name you prefer).

Step 2: Clone the GitHub Repository

  1. Open Command Prompt (CMD):

    • Press Win + R, type cmd, and press Enter.
  2. Navigate to the Folder: In the Command Prompt, type the following to navigate to your folder (if your folder is on the desktop):

     cd Desktop\MyFullStackApp
    
  3. Clone the GitHub Repository: You’ll clone the repository from GitHub. Assuming you have the repository URL (https://github.com/light2023/3RH_EMR.git), type this:

     git clone https://github.com/light2023/3RH_EMR.git
    

    After running this command, you'll see output like: (if youre asked for password, go to step 6)

     Counting objects: 100% (33/33), done.
     Delta compression using up to 4 threads
     Compressing objects: 100% (17/17), done.
     Writing objects: 100% (17/17), 84.97 KiB | 14.16 MiB/s, done.
     Total 17 (delta 14), reused 0 (delta 0)
     remote: Resolving deltas: 100% (14/14), completed with 14 local objects.
     To https://github.com/light2023/3RH_EMR.git
        0f97cb2..53dbb66  master -> master
    

    This means the repository has been successfully cloned into your folder.


Step 3: Set Up PostgreSQL

  1. Create the PostgreSQL Database and User:

    • Open pgAdmin (or use the command line psql).

    • Log in as superuser postgres:

      • Open CMD and type:

          psql -U postgres
        
    • Create the database and user: Run these commands to create the database and user with the same name renewal_ridge_emr:

        CREATE DATABASE renewal_ridge_emr;
        CREATE USER renewal_ridge_emr WITH PASSWORD 'renewal_ridge_emr';
        GRANT ALL PRIVILEGES ON DATABASE renewal_ridge_emr TO renewal_ridge_emr;
      
    • Exit the PostgreSQL command line by typing:

        \q
      
  2. Confirm Database and User: You can verify the database creation and user setup by logging back in and checking:

     psql -U postgres
     \l  -- lists databases
     \du -- lists users
    

Step 4: Set Up the Backend (FastAPI)

  1. Navigate to the Backend Folder: Assuming the FastAPI backend is in a folder called backend within the cloned repository, navigate to it:

     cd 3RH_EMR/backend
    
  2. Create a Virtual Environment (Optional but Recommended): To isolate dependencies for the Python backend, it's best to create a virtual environment.

     python -m venv venv
    

    To activate the virtual environment:

    • On Windows:

        .\venv\Scripts\activate
      
  3. Install Python Dependencies: Install all the required dependencies from the requirements.txt file that came with the repository:

     pip install -r requirements.txt
    
  4. Configure Database URL in FastAPI: Open the FastAPI configuration file (usually config.py or settings.py) and update the database URL to match your PostgreSQL setup:

     SQLALCHEMY_DATABASE_URL = "postgresql://renewal_ridge_emr:your_password@localhost/renewal_ridge_emr"
    
  5. Run FastAPI Backend: Run the FastAPI app:

     uvicorn main:app --reload
    

    The backend should now be running at http://127.0.0.1:8000.


Step 5: Set Up the Frontend (React)

  1. Navigate to the Frontend Folder: Now, go to the frontend directory, which should be within the cloned repository:

     cd ../frontend
    
  2. Install React Dependencies: Before running the React app, install the required packages using npm:

     npm install
    
  1. Run React Development Server: To start the React app:

     npm start
    

    React should now be running at http://localhost:3000.


Step 6: Set Up GitHub Authentication with Personal Access Token

If you're asked to enter a GitHub password for Git operations (push, pull, etc.), you’ll need to generate a Personal Access Token from GitHub.

  1. Generate Personal Access Token:

    • Go to GitHub Developer Settings.

    • Click on Generate new token.

    • Select the necessary scopes (e.g., repo, workflow).

    • Click Generate token, and copy the token. You will not be able to see it again.

  2. Use Token for Git Authentication: When you run a git push or git pull, you’ll be prompted for a password. Paste the token instead of your GitHub password.


Step 7: Run and Test Your Full-Stack Application

  • Backend (FastAPI): Open a browser and go to http://127.0.0.1:8000 to verify that the FastAPI backend is working correctly. You should see the FastAPI documentation.

  • Frontend (React): Open a browser and go to http://localhost:3000 to check if the React app is running. It should be able to communicate with the FastAPI backend.


More from this blog

Ekemini Thompson

26 posts