This project is a web-based patient bedside monitor application that simulates the visualization and trending of patient signals, similar to a hospital bedside monitor. It dynamically plots real-time signals (with low latency) and visualizes historical trends over a specific time range.
Python for decrypting the incoming patient data and converting it into JSON format. TypeScript for backend services and logic. React for frontend visualization and dynamic plotting.
- Dynamic Signal Visualization: Displays real-time patient data in a dynamic graphical format that replicates the behavior of the bedside monitor.
- Trend View: Visualize historical patient data trends over a specified time period.
- Data Decryption: Securely process and decrypt patient data using Python and convert it to JSON format for ease of use.
- Node.js: Ensure that you have Node.js installed to work with this project.
- Clone the repository:
git clone "https://github.com/Codiologoist/DigitalTwins.git"
- Navigate to the project directory:
cd DigitalTwins
- Install the required dependencies:
- Install dependencies for the client:
cd client npm install
- Install dependencies for the server:
- Navigate to the
server/decryption
directory:cd ../server/decryption
- Install Python (if not installed): If Python is not installed, download and install it from the Python official website.
- Install Python dependencies - You can either install dependencies directly on your local machine or use a virtual environment. Choose one of the two options below:
- Option 1: Install on Local Machine:
pip install -r requirements.txt
- Option 2: Use a virtual environment
- Create a Python virtual environment:
python3 -m venv venv
- Activate the virtual environment:
- On macOS/Linux:
source venv/bin/activate
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
- Install dependencies within the virtual environment:
pip install -r requirements.txt
- Create a Python virtual environment:
- Option 1: Install on Local Machine:
- Install the Node.js dependencies:
npm install
- Navigate to the
- Install dependencies for the client:
- Run the application:
- Development mode - open two terminal windows (or tabs):
- Terminal 1: Run the client
cd client npm run dev
- Terminal 2: Run the server
- Navigate to the
server
directory:cd server
- If you are not using a virtual environment (local machine setup) - Simply run:
npm run dev
- If you are using a virtual environment:
- Activate the Python virtual environment:
- On macOS/Linux:
source venv/bin/activate
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
- Then, start the server
npm run dev
- (Optional) Exit the virtual environment: After stopping the server, deactivate the virtual environment by running:
deactivate
- Activate the Python virtual environment:
- Navigate to the
- Terminal 1: Run the client
- Production mode:
npm start
- Development mode - open two terminal windows (or tabs):
- Run tests (Server only):
- Before running tests, make sure you have set your
.env
file correctly according to the instructions in the.env.example
file. - To run tests on the server, use the following command:
This command runs the server tests using a local MongoDB test database (
npm run test
serverTestDB
) and thenewman-server
test suite. Ensure that your local MongoDB instance is running before executing the test.
- Before running tests, make sure you have set your
- Data Decryption: Incoming patient monitor data is decrypted and processed into JSON format using the Python service.
- Backend API: The server exposes RESTful endpoints to:
- Receive patient data.
- Retrieve real-time and trend patient signal data.
- Frontend (React): Consumes the APIs to display:
- Real-time signals: Dynamically plotted on charts.
- Trend view: Historical data visualization.
The backend of this application is built using Node.js with TypeScript and integrates Python for data decryption.
Data Decryption: Python decrypts incoming patient monitor data and converts it into JSON files. These JSON files represent patient data types (e.g., ABP, HR, ECG, etc.) and are sent to the frontend upon request. API Endpoints: Provides RESTful endpoints for: Sending real-time patient data to the frontend. Handling requests for historical trend data.
In the project directory, you can run:
Installs all the dependencies specified in the package.json file.
It ensures that the project has all the required packages to run correctly.
Run this command whenever you clone the project or update dependencies.
To start the server with Node.js: You can access the following URL in your browser: https://localhost:5000/api/v1
If configured correctly, you should see a JSON response in your browser that looks like this: { "message": "Hello from Digital Twins server!" }
This project uses React + TypeScript + Vite for the frontend, providing a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptions
property like this:
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
- Replace
tseslint.configs.recommended
totseslint.configs.recommendedTypeChecked
ortseslint.configs.strictTypeChecked
- Optionally add
...tseslint.configs.stylisticTypeChecked
- Install eslint-plugin-react and update the config:
// eslint.config.js
import react from 'eslint-plugin-react'
export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
- Omid Khodaparast
- Marko Mojsov
- Yingchao Ji
- Shiyao Xin
- Tehreem Asif
- Reducing latency for real-time signal visualization.
- Adding alert/notification systems for abnormal patient data.
The file binary_extraction.py
contains proprietary logic and is not included as part of this open-source project.
This project was developed and maintained by Codiologist.
- License: MIT License
This ReadMe will be maintained as a living document, with updates and new information added as the project evolves.