This project is a MERN (MongoDB, Express, React, Node.js) stack application designed to manage and manipulate IPS (International Patient Summary) records. It includes features to convert between MongoDB, BEER, and IPS JSON formats, and supports various CRUD operations on IPS data. It also offers raw binary data encryption (using IV + MAC + compressed ciphertext) for secure and efficient data handling.
- Overview
- Features
- Setup
- API Documentation
- Gzip Support
- AES-256 Support
- Client-Side Pages
- Technologies Used
- Contributing
- License
This application allows healthcare providers to create, update, delete, and convert patient records stored in MongoDB. The records can be transformed into different formats, including BEER (Basic Emergency Exchange Record) and IPS JSON, to facilitate data sharing and interoperability. Additionally, the application supports both JSON-based and raw binary encryption flows, giving users the flexibility to optimize performance and security.
- CRUD Operations: Create, Read, Update, and Delete IPS records.
- Format Conversion: Convert IPS records between MongoDB, BEER, and IPS JSON formats.
- API Endpoints: Comprehensive set of endpoints to manage IPS records.
- Responsive Frontend: User-friendly interface for managing and converting records.
- Search and Filter: Find records by various attributes.
- Advanced Encryption Options:
- JSON-based AES-256 encryption with HMAC verification.
- Raw Binary support using a 16-byte IV, 32-byte HMAC, and gzipped ciphertext for optimal security and space efficiency.
- Clone the repository:
git clone https://github.com/yourusername/ips-mern-project.git cd ips-mern-project - Install server dependencies:
cd server
npm install- Install client dependencies:
cd ../client
npm install- Set up environment variables:
Create a .env file in the server directory with the following content:
DB_CONN=mongodb://localhost:27017/ipsDB
- Start the development server:
cd ../server
npm run dev- Start the React development server:
cd ../client
npm start| Endpoint | Description | Request Body | Response |
|---|---|---|---|
/ips |
Add a new IPS record. | MongoDb IPS Record | The created IPS record. |
/ipsmany |
Add multiple IPS records. | Multiple MongoDb IPS Records | Array of created IPS records. |
/ipsbundle |
Add IPS records from a bundle. | IPS JSON Bundle | The created IPS record. |
/pushipsora |
Push IPS records to an ORA system. | IPS JSON Bundle | Response from the ORA system. |
/pushipsnld |
Push IPS records to an ORA system. | IPS JSON Bundle | Response from the NLD system. |
/ipsfrombeer |
Add IPS records from BEER format. | BEER as Plain Text | The created IPS record. |
/ipsfromcda |
Add IPS records from CDA XML format. | CDA as XML | The created IPS record. |
/ipsfromhl72x |
Add IPS records from HL7 2.x format. | HL7 2.x as Plain Text | The created IPS record. |
/convertmongo2beer |
Convert a MongoDB IPS record to BEER format. | Mongo IPS Record | The BEER formatted data. |
/convertmongo2hl7 |
Convert a MongoDB IPS record to HL7 2.3 format. | Mongo IPS Record | The HL7 2.3 formatted data. |
/convertbeer2mongo |
Convert a BEER IPS record to MongoDB format. | BEER as Plain Text | MongoDB formatted data. |
/convertbeer2ips |
Convert a BEER IPS record to IPS JSON format. | BEER as Plain Text | IPS JSON formatted data. |
/convertips2beer |
Convert an IPS JSON record to BEER format. | IPS JSON Bundle | BEER formatted data. |
/convertcdatoips |
Convert CDA XML format to IPS JSON Bundle. | CDA XML Bundle | IPS JSON formatted data. |
/convertcdatobeer |
Convert CDA XML format to BEER format. | CDA XML Bundle | BEER formatted data. |
/convertcdatomongo |
Convert CDA XML format to MongoDb format. | CDA XML Bundle | MongoDb - JSON |
/converthl72xtomongo |
Convert HL7 2.x format to MongoDB format. | HL7 2.x - Plain Text | MongoDB - JSON |
/converthl72xtoips |
Convert HL7 2.x format to IPS JSON format. | HL7 2.x - Plain Text | IPS Bundle - JSON |
/convertxml |
Generic convert XML format to JSON format. | XML | JSON |
/convertfhirxml |
Convert FHiR XML format to FHiR JSON format. | FHiR XML | FHiR JSON |
| Endpoint | Description | Response |
|---|---|---|
/ips/all |
Retrieve all IPS records. | Array of MongoDb IPS records. |
/ipsraw/:id |
Retrieve IPS record in default MongoDb format by ID. | Default MongoDb IPS data. |
/ipsmongo/:id |
Retrieve IPS record in presentation format by ID. | Presentation formatted IPS data. |
/ips/:id |
Retrieve Expanded IPS JSON Bundle by its ID. | The Expanded IPS JSON Bundle format. |
/ipsbasic/:id |
Retrieve basic IPS Bundle by ID. | Basic IPS data. |
/ipsbeer/:id/:delim? |
Retrieve IPS Bundle in BEER format by ID. | BEER formatted IPS data. |
/ipshl72x/:id |
Retrieve IPS Bundle in HL7 2.3 format by ID. | HL7 2.3 formatted IPS data. |
/ipsxml/:id |
Retrieve IPS Bundle in Expanded XML format by ID. | Expanded XML formatted IPS data. |
/ipslegacy/:id |
Retrieve IPS Bundle in legacy format by ID. | Legacy JSON formatted IPS data. |
/ipsunified/:id |
Retrieve IPS Bundle in compact unified format by ID. | Compact unified JSON formatted IPS data. |
/ipsbyname/:name/:given |
Retrieve Expanded IPS Bundle by patient's name and given name. | The Expanded IPS JSON Bundle. |
/ips/search/:name |
Search for IPS records by patient's name. | Array of IPS records. |
/fetchipsora/:name/:givenName |
Fetch IPS record from ORA by patient's name and given name. | The IPS JSON Bundle. |
| Endpoint | Description | Request Body | Response |
|---|---|---|---|
/ips/:id |
Update an existing IPS record by its ID. | MongoDb IPS Record - complete or partial | The updated IPS record. |
/ipsuuid/:uuid |
Update an existing IPS record by its UUID. | MongoDb IPS Record - complete or partial | The updated IPS record. |
| Endpoint | Description | Response |
|---|---|---|
/ips/:id |
Delete an IPS record by its ID. | Status message. |
This API supports gzip compression to optimize data transfer.
- Incoming Requests: When sending gzip-encoded data, set the
Content-Encoding: gzipheader. - Outgoing Responses: To receive gzip-encoded responses, set the
Accept-Encoding: gzipheader.
- Compress your payload using gzip.
- Include the header
Content-Encoding: gzip. - Send the compressed payload.
- Set the header
Accept-Encoding: gzip. - The API will return the response in gzip format if supported.
Request Headers for Gzip
Content-Type: application/json
Content-Encoding: gzipResponse Headers for Gzip
Content-Type: application/json
Content-Encoding: gzipThis API supports AES-256 encryption for secure data transfer.
- Incoming Requests: To send encrypted data, include the
x-encrypted: trueheader and provide an encrypted payload. - Outgoing Responses: To receive encrypted responses, include the
Accept-Encryption: aes256header in your request.
To facilitate compatibility and efficient data transfer, the API supports returning encrypted data encoded in Base64 format.
- Incoming Requests: To send in base64 format, include the header
Content-Encoding: base64with the encrypted payload. Make sure both the data and the iv are in base64 not hex. - Outgoing Responses: Use the header
Accept-Encoding: base64The encrypted payload and IV will be returned as Base64-encoded strings.
- Encrypt your payload using AES-256 encryption with the provided key and IV.
- Include the
x-encrypted: trueheader. - Send the encrypted payload in the request body as a JSON with the elements: encryptedData and iv.
- Default format is hex strings for both elements. If you wish to send as base64 strings then use the
Content-Encoding: base64.
- Include the
Accept-Encryption: aes256header in your request. - Optionally, include the
Accept-Encoding: base64header to receive the encrypted data and iv encoded in Base64. - The response will be a JSON with two elements: encryptedData and iv.
his API also supports sending and receiving raw binary data via application/octet-stream. This is useful when you want a single binary payload that includes:
- A 16-byte IV (initialization vector).
- A 16-byte MAC (HMAC-SHA256 for integrity).
- The encrypted + gzipped data. + +### Incoming Requests (Raw Binary)
- Set the header:
Content-Type: application/octet-stream - The first 16 bytes of your binary payload must be the IV, the next 16 bytes must be the MAC, and the remainder is the AES-256-CBC-encrypted, gzip-compressed data.
- The server will:
- Verify the MAC to check integrity.
- Decrypt the payload using AES-256-CBC.
- Decompress the result from gzip.
- Send a request with:
Accept: application/octet-stream - The server will:
- Take the plaintext response body.
- Compress it with gzip.
- Encrypt it using AES-256-CBC.
- Compute the MAC for integrity.
- Return a binary payload consisting of [16-byte IV] + [32-byte MAC] + [Encrypted Gzipped Data]
- The response will have:
- Content-Type:
application/octet-stream - X-Encrypted: true
| Page | Description |
|---|---|
| Default Page | Add, edit, and search for current records. You can also search for records from the navigation bar. |
| API Page | View the various API GET endpoints, see their output, and download the output. |
| QR Page | Produce various forms of QR codes and download them. Formats include IPS JSON, BEER, and others. |
| DMICP Page | Bulk upload IPS records produced in the SmartDoc format. |
| External API Pages | GET and POST between the External IPS WebApps and the IPS MERN WebApp. |
| About Pages | Information about IPS, the WebApp, the ChangeLog, and the API Documentation page. |
-
Default Page
- Purpose: Central page for managing IPS records. Users can add new records, edit existing records, and perform searches.
- Features:
- Search for records directly from the page.
- Perform CRUD operations on IPS records.
-
API Page
- Purpose: Provides an interface for interacting with API GET endpoints.
- Features:
- View available API endpoints.
- Execute API calls and display the response.
- Download the response data.
- Includes the ability to encrypt and compress the response - base64
-
QR Page
- Purpose: Generate and download QR codes for IPS records.
- Features:
- Create QR codes in various formats including IPS JSON and BEER.
- Download the generated QR codes.
- Includes the ability to encrypt and compress the response - base64
-
DMICP Page
- Purpose: Facilitates the bulk upload of IPS records in the SmartDoc format.
- Features:
- Upload multiple IPS records simultaneously.
- Supports the SmartDoc format for bulk data entry.
-
External API Pages
- Purpose: Manage interactions with external IPS webApps/servers.
- Features:
- GET and POST IPS records between pre-defined endpoints (or manually entered) and the IPS MERN WebApp.
-
About Pages
- Purpose: Provide detailed information about the IPS system and the WebApp.
- Features:
- Overview of IPS.
- Information about the WebApp.
- View the ChangeLog for recent updates.
- Access the API Documentation page.
Each page in the application is designed to provide specific functionalities for managing and interacting with IPS records, ensuring a comprehensive and user-friendly experience.
Frontend: React, React Bootstrap Backend: Node.js, Express Database: MongoDB Other: Axios for HTTP requests, Mongoose for MongoDB interaction
Contributions are welcome! Please read our contributing guidelines before you submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.