React and NodeJS for Hospital Attendance
Overview
The Franco-USAese hospital wanted to create a web app that allowed hospital administrators to track the attendance of doctors and identify any patterns of absenteeism. They decided to use Angular for the frontend of the app and Python for the backend.
Requirements
- Administrators should be able to view the attendance record of
each doctor. - Administrators should be able to mark the attendance of doctors
as present or absent - The app should generate reports on the attendance of doctors,
including the number of days present and absent, and the
percentage of attendance. - The app should have secure authentication and authorization
features.
Solution
The development team decided to use Angular for the frontend of the app because of its powerful templates and reactive forms. They also decided to use Python for the backend because of its simplicity and the availability of numerous libraries for data analysis and machine learning.
For the attendance tracking feature, the team implemented an Angular component that displayed a table of the attendance records of the doctors. The table included columns for the date, attendance status, and notes. The component was connected to the backend using an API that stored the attendance data in a database.
The attendance marking feature was implemented using reactive forms in Angular. Administrators could select a doctor and a date and mark their attendance as present or absent. The form was connected to the backend using an API that updated the attendance data in the database.
The reporting feature was implemented using Python on the backend. The backend included an API that generated reports on the attendance of doctors based on the data in the database. The reports included the number of days present and absent, and the percentage of attendance. The API returned the report data to the frontend, which displayed it using charts and tables.
For secure authentication and authorization, the team implemented JSON Web Tokens (JWTs) on the backend. When an administrator logs in, the backend generates a JWT and sends it to the frontend, which stores it and includes it in the header of subsequent requests to the backend. The backend verifies the JWT before processing the request.
Result
The doctors attendance management app was successfully launched and received positive feedback from hospital administrators. They appreciated being able to track the attendance of doctors and generate reports on their attendance. The attendance marking feature was also well-received and made it easier for administrators to track the attendance of doctors. The use of JWTs for secure authentication and authorization helped to give administrators confidence in the app's security
Code Example
Here is a sample code snippet demonstrating the use of reactive forms in Angular for the attendance marking feature:
For the doctors attendance management app, the development team chose to use MySQL as the database. They stored the attendance data in a table in the database, with columns for the doctor's id, the date, the attendance status, and notes. They also implemented appropriate indexing to allow for fast querying of the data. They implemented security measures to protect the confidentiality of the data.
Here is an example of the schema for the attendance data table:
Copy code
CREATE TABLE attendance (
id INT(11) NOT NULL AUTO_INCREMENT,
doctor_id INT(11) NOT NULL,
date DATE NOT NULL,
status ENUM(‘present’, ‘absent’) NOT NULL,
notes VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (id),
FOREIGN KEY (doctor_id) REFERENCES doctors(id)
);
CREATE TABLE attendance (
id INT(11) NOT NULL AUTO_INCREMENT,
doctor_id INT(11) NOT NULL,
date DATE NOT NULL,
status ENUM(‘present’, ‘absent’) NOT NULL,
notes VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (id),
FOREIGN KEY (doctor_id) REFERENCES doctors(id)
);
This table includes columns for the id of the attendance record, the doctor_id of the doctor, the date, the status of attendance (either present or absent), and optional notes. It also includes a foreign key constraint on the doctor_id column to ensure that it references a valid doctor in the doctors table.
Industry - : Healthcare
Technology Leveraged
- React
- Node
- MongoDB
- Google Cloud Platform(GCP)