PatientPortal is an Electronic Medical Records (EMR) portal built with ASP.NET Core 8.0. It provides a fast, navigable interface for both patients and healthcare providers to store and manage medical history, health issues, visits, care teams, and messaging.
- ASP.NET Core 8.0
- Entity Framework Core 8.0
- Pomelo.EntityFrameworkCore.MySql
- Bogus (for test data generation)
- MySQL 8.0
- Docker and Docker Compose
- Bootstrap for front-end styling
This project can be run locally or with Docker. The application runs on http://localhost:5000 by default.
First clone the repository:
git clone <repository-url>
cd PatientPortalTo run the project, you must make an .env file with the required environment variables whether running locally, or with Docker.
Logging__LogLevel__Default=Information
Logging__LogLevel__Microsoft=Warning
Logging__LogLevel__Microsoft.Hosting.Lifetime=Information
AllowedHosts=*
DBInfo__ConnectionString=server=<server>;userid=<user_id>;password=<user_password>;port=<port>;database=<db_name>;SslMode=NoneThe allowedHosts variable can be set to * for local development, and changed as needed for production.
The DBInfo__ConnectionString variable must be set to your MySQL database connection string.
server: The MySQL server address (e.g.,localhostfor local MySQL server, andmysql_dbfor the MySQL container in Docker).user_id: The MySQL user ID.user_password: The password for the MySQL user.db_name: The name of the MySQL database.port: The port number for the MySQL server (default is3306).
- .NET 8 SDK
- MySQL Server 8.0
Put your .env file in the root directory of the project, /src/PatientPortal/.
Note: The following commands assume you are in the root directory of the repo, but you can also navigate to the
src/PatientPortal/directory to run them without specifying the project file every line.
dotnet restore src/PatientPortal/PatientPortal.csproj
dotnet build src/PatientPortal/PatientPortal.csprojdotnet ef database update --project src/PatientPortal/PatientPortal.csprojdotnet run --project src/PatientPortal/PatientPortal.csprojThe app will be available at http://localhost:5000.
Using Docker Compose, you can run both the ASP.NET Core app and MySQL database in containers.
First save the former .env file in src/PatientPortal/ as .env.docker.dev. This location and name can be changed in the compose file.
Make sure the MySql server uses the service name mysql_db as the server in your connection string. This too can be changed in the compose file if desired.
Your MySQL user ID cannot be root when using Docker, so choose a different user ID.
Next, create the env file for your MySQL container in src/PatientPortal/ as mysql.env.
MYSQL_ROOT_PASSWORD=<root_password>
MYSQL_USER=<user_id>
MYSQL_PASSWORD=<user_password>
MYSQL_DATABASE=<db_name>Make sure to use the same MySQL info in both files:
If you want to initialize the database with data the first time, you must create an initialization script and mount it into the MySQL container. See the MySQL Docker image for details.
If you have the SDK installed, you can create a migration script from your current migrations with:
dotnet ef migrations script -o init.sqlOnce done, you can create an en env file at the root of the Docker directory, src/PatientPortal/Docker/.env, that sets DB_INIT_PATH to the path of your script, so that compose can mount it into the MySQL container.
DB_INIT_PATH="<path-to-your-script>/init.sql"From the Docker directory:
docker-compose up -dThis will build the ASP.NET Core image, start the MySQL container, and initialize the database using the migration script specified in DB_INIT_PATH.
The app will be available at http://localhost:5000.
Unit tests for the PatientPortal service and logic components are located in the tests/PatientPortal.Tests.Unit directory.
More information can be found in the PatientPortal Unit Tests README.md.