How oorbea/qresp_backend works
Main Components
• API Server: Represented by the entry point (app.mjs) which initializes the server, routes incoming HTTP requests to appropriate handlers, and serves as the “gateway” for the external clients.
• Business Logic Modules:
– userManagement.mjs: Contains logic for creating, reading, updating, and deleting users.
– medicalManagement.mjs: Handles patient-related CRUD operations.
– testsManagement.mjs: Manages medical test creation, retrieval, and deletion.
– diagnosticAlgorithm.mjs: Contains logic to process diagnostic information (assessing emergency status and generating diagnostic messages).
– loginQR.mjs: Manages authentication flows (login/logout) and QR generation.
• Database Interface:
– dbConnection.mjs: Manages the connection to the underlying database that stores all the data for users, patients, symptoms, history, tests, etc.
• Schemas (in the “schemas” directory): These files (user.mjs, patient.mjs, history.mjs, symptoms.mjs, tests.mjs) define data models and constraints for the core entities used throughout the system.
Flow and Interactions
• Client Request: Start by showing incoming HTTP requests coming from a client (e.g., web, mobile, or a testing client).
• Database Interaction: Illustrate that each module interacts with the database through dbConnection.mjs–the central database connector that interacts with the data models defined in the schemas.
Architectural Patterns and Design Principles
• Modularity: Emphasize that each module (users, patients, tests, diagnostics, QR/login) is designed as an independent functional unit, making it easier to maintain and extend.
• Single Responsibility Principle: Each module/file performs a specific task (for example, loginQR.mjs is strictly about authentication and QR code generation).
Detailed Guidance for the Principal Software Engineer
• The entry point (app.mjs) handling all incoming requests.
• The boundary between business logic (userManagement.mjs, medicalManagement.mjs, testsManagement.mjs, diagnosticAlgorithm.mjs, loginQR.mjs) and the persistence layer (dbConnection.mjs, schemas).
• The RESTful endpoint patterns as defined in the README.
• The data flow and dependency directions.