Live : https://dpcfrontend.vercel.app/ This repository contains the backend services for a Digital Patient Card system. It is designed to provide robust APIs for managing various aspects of patient healthcare data, including patient, doctor, and administrator information. A key feature is the ability to generate digital patient cards in PDF format. The backend is built to serve a dedicated frontend application.
- User Role Management: Distinct functionalities and data management for Administrators, Doctors, and Patients.
- Patient Data Management: APIs for creating, retrieving, updating, and deleting patient records, including disease information.
- Doctor Data Management: APIs for managing doctor profiles and associated medical referrals.
- Administrator Management: APIs for administrative tasks and managing other users.
- Disease Tracking: Functionality to record and manage patient disease details.
- Referral System: Management of patient referral information.
- Digital Patient Card PDF Generation: Services to dynamically generate and retrieve patient cards in PDF format.
- RESTful API: Exposes a set of well-defined RESTful endpoints for integration with client applications.
- CORS Configuration: Pre-configured Cross-Origin Resource Sharing to allow secure communication with a frontend application.
- Database Persistence: Utilizes an Object-Relational Mapping (ORM) framework for efficient data storage and retrieval.
- Language: Java
- Framework: Spring Boot
- Database: PostgreSQL
- ORM: Hibernate / JPA
- Build Tool: Apache Maven
- Containerization: Docker
- CI/CD: GitHub Actions, Google Cloud Build
- API Standard: RESTful
- Frontend (Implied): ReactJS (as indicated by repository topics and homepage)
The project follows a standard Maven and Spring Boot structure:
.
├── .github/ # GitHub Actions workflows
│ └── workflows/
│ └── deploy.yml # CI/CD deployment workflow
├── .mvn/ # Maven Wrapper files
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/DPC/DigitalPatientCardBackend/
│ │ │ ├── admin/ # Admin entity
│ │ │ ├── admincontroller/ # Admin REST controller
│ │ │ ├── doctor/ # Doctor & Referral entities
│ │ │ ├── doctorcontroller/ # Doctor REST controller
│ │ │ ├── patient/ # Patient & Disease entities
│ │ │ ├── patientcontroller/ # Patient REST controller
│ │ │ ├── repository/ # Spring Data JPA repositories
│ │ │ ├── user/ # User entity
│ │ │ ├── PDF/ # PDF generation logic
│ │ │ ├── PDFcontroller/ # PDF generation REST controller
│ │ │ ├── CorsConfig.java # CORS configuration
│ │ │ ├── DigitalPatientCardBackendApplication.java # Spring Boot entry point
│ │ │ └── IndexController.java # Basic index controller
│ │ └── resources/
│ │ └── application.properties # Application configuration
│ └── test/ # Unit and integration tests
├── Dockerfile # Docker containerization definition
├── Documentation.md # Detailed project documentation
├── cloudbuild.yaml # Google Cloud Build configuration
├── mvnw # Maven Wrapper script (Linux/macOS)
├── mvnw.cmd # Maven Wrapper script (Windows)
└── pom.xml # Maven Project Object Model (POM)
Before you begin, ensure you have the following installed:
- Java Development Kit (JDK) 17 or newer
- Apache Maven 3.x
- PostgreSQL database server
- Docker (optional, for running in a container)
-
Clone the Repository:
git clone https://github.com/AlvinGeorge-AG/DigitalPatientCardBackend.git cd DigitalPatientCardBackend -
Database Setup:
- Create a new PostgreSQL database, for example:
digitalpatientcard_db. - Ensure your PostgreSQL user has appropriate permissions.
- Create a new PostgreSQL database, for example:
-
Configure Application Properties:
- Open
src/main/resources/application.properties. - Update the database connection details (URL, username, password) to match your PostgreSQL setup. Example:
spring.datasource.url=jdbc:postgresql://localhost:5432/digitalpatientcard_db spring.datasource.username=your_db_username spring.datasource.password=your_db_password spring.jpa.hibernate.ddl-auto=update # Or 'create' for first run
- Open
-
Build the Project:
mvn clean install
This command compiles the source code, runs tests, and packages the application into an executable JAR file.
The Digital Patient Card Backend provides RESTful API endpoints for managing patient, doctor, and administrative data, as well as generating patient card PDFs. Once the application is running, you can interact with it using tools like Postman, curl, or through a connected frontend application.
Example API endpoints (inferred):
/api/patients/api/doctors/api/admins/api/pdf/generate/{patientId}
Refer to Documentation.md for a comprehensive list of API endpoints and their usage.
The application's application.properties file typically references environment variables for sensitive configurations, especially in production environments. For local development, you might set these directly in application.properties.
Common environment variables would include:
SPRING_DATASOURCE_URL: PostgreSQL database connection URL.SPRING_DATASOURCE_USERNAME: Username for database access.SPRING_DATASOURCE_PASSWORD: Password for database access.
These are typically configured in deployment environments (e.g., GitHub Actions, Google Cloud Build, Docker Compose) rather than hardcoded.
After completing the installation steps and building the project:
mvn spring-boot:runThe application will start on http://localhost:8080 by default.
-
Build the Docker Image:
docker build -t digitalpatientcard-backend . -
Run the Docker Container: Make sure your PostgreSQL database is accessible from the Docker container (e.g., running on
host.docker.internalfor Docker Desktop or a network alias).docker run -p 8080:8080 --name dpc-backend \ -e SPRING_DATASOURCE_URL="jdbc:postgresql://<your-db-host>:5432/digitalpatientcard_db" \ -e SPRING_DATASOURCE_USERNAME="your_db_username" \ -e SPRING_DATASOURCE_PASSWORD="your_db_password" \ digitalpatientcard-backend
Replace
<your-db-host>,your_db_username, andyour_db_passwordwith your actual database details.
The Dockerfile provides instructions to build a Docker image for the application, enabling containerized deployment.
The repository includes a .github/workflows/deploy.yml file, indicating a Continuous Integration/Continuous Deployment (CI/CD) pipeline using GitHub Actions. This workflow automates building, testing, and potentially deploying the application upon code pushes or other triggers.
The cloudbuild.yaml file suggests that the project can be built and deployed using Google Cloud Build, an automation service for building, testing, and deploying applications on Google Cloud Platform. This typically handles Docker image builds and deployments to services like Google App Engine or Kubernetes Engine.
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and ensure they adhere to the project's coding standards.
- Write appropriate tests for your changes.
- Commit your changes with clear, descriptive commit messages.
- Push your branch and open a pull request.
No explicit license information found in the repository data.
- This repository serves as the backend for the Digital Patient Card system. A separate frontend application (e.g., Digital Patient Card Frontend) is expected to interact with these services.
- For detailed internal workings, API documentation, and specific implementation details, please refer to the
Documentation.mdfile in this repository.