Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unresolved]
Added
- Natural Language Input (Phase 1): Introduced a new UI component on the simulator page allowing users to describe patient and dosing information via a text area. Created the initial Genkit flow (
processNaturalLanguageDose) to handle parsing this text into structured data. - Subscriptions Page: Created a new
/subscriptionspage outlining the features and benefits of the Pro and Institutional subscription tiers. Added a link to this page in the main sidebar navigation.
Changed
- Enhanced Natural Language Parsing: The Genkit flow for parsing natural language dose descriptions (
processNaturalLanguageDose) has been significantly improved. It can now identify when essential information for a simulation is missing and generate specific, conversational feedback to guide the user on what to provide next. The frontendNaturalLanguageInputcomponent now uses this feedback to interact with the user, creating a more robust parsing experience. - Refactored Dosing Form and Simulation Engine: Overhauled the core simulation logic to be based on three distinct clinical scenarios: 'Loading Dose + Maintenance', 'Maintenance Only', and 'From a Known Level'. This provides a more intuitive and clinically accurate workflow. The UI in
DosingForm.tsxnow dynamically changes based on the selected scenario, and thesimulation.tsengine has been rewritten to support this new model. - Updated Landing Page: Modified the "Core Features" and "Calculation Engine" sections of the landing page to accurately describe the new scenario-based simulation logic.
- Default Parameter Schema Update: Refactored the application's data types, default constants, and simulation components to align with an updated PK/PD parameter schema from Firestore. This resolves data inconsistencies and ensures the app uses the latest model data.
Fixed
- Resolved "Uncontrolled Input" Error: Fixed a recurring React error in
PkPdManagement.tsxandDosingForm.tsxby ensuring that all numeric input fields have a defined value ('') instead ofundefined, preventing the component from changing from an uncontrolled to a controlled state. - Corrected Server-Side Module Import: Resolved a Next.js build error by restructuring the
/developmentpage. The file was split into a server component (page.tsx) for data fetching (fs) and a client component (DevelopmentClientPage.tsx) for rendering, ensuring server-only modules are not imported on the client. - Fixed Missing Login Button on Mobile: Moved the user authentication/profile section into the main
SidebarMenucomponent inSidebarNav.tsxso that it correctly appears within the slide-out menu on mobile devices. - Stabilized Simulation Chart Colors & Persistence: Corrected the logic in the
Simulator.tsxandSimulationChart.tsxcomponents. The "Previous Simulation" curve now correctly persists on the graph and is consistently colored blue, while the "Current Simulation" is colored purple. - Corrected Continuous Infusion Logic: Modified the simulation engine in
src/lib/simulation.tsand the UI inDosingForm.tsxto properly handle continuous infusions. The UI now prompts for an infusion rate (mg/hr) instead of intermittent doses, and the simulation models a constant infusion rather than repeated boluses. - Fixed TDM Recalculation Bug: Resolved a critical issue where patient-specific parameters calculated from a TDM level were not being used in subsequent "what-if" simulations. Corrected the state management in
Simulator.tsxto ensure the TDM-calibrated model persists for resimulations. - Adjusted Default Dose: Set a more clinically realistic default dose in
DosingForm.tsxto prevent TDM calculation errors caused by illogical initial values. - Admin Permissions for Institution Data: Updated Firestore security rules to grant global administrators write access to all documents in the
institutionscollection. This resolves a "Missing or insufficient permissions" error that prevented admins from saving changes to the default PK/PD parameters on the admin dashboard. - Resolved Build Error with
@genkit-ai/nextPlugin: Corrected the import statement for the@genkit-ai/nextplugin insrc/ai/genkit.tsto use the default export, resolving a build failure caused by recent package updates. - Resolved Build Error by Removing Genkit Firebase Plugin: Removed the
@genkit-ai/firebaseplugin from the Genkit configuration (src/ai/genkit.ts) andpackage.jsonto fix a critical build failure caused by a missing export in the plugin. Core Firebase functionality (Auth, Firestore) is unaffected as it's initialized separately. - Robust Antibiotic Parameter Handling: Made the
DEFAULT_ANTIBIOTIC_PARAMSobject the single source of truth for the list of available antibiotics. This prevents runtime crashes caused by selecting a drug that does not have its parameters defined. The UI components (DosingForm, ChatInterface, FormulationManagement) now dynamically populate their antibiotic lists from this single source, ensuring data consistency and preventing crashes.
Changed
- Updated Genkit to v1.x: Upgraded all
genkitdependencies to version1.16.0to ensure compatibility and use the latest API syntax. - Updated Genkit Configuration: Refactored
src/ai/genkit.tsto use the correctgenkit()initialization syntax for Genkit v1.x, removing the deprecatedconfigureGenkit. - Corrected User Role Assignment: Modified the
signUpanduseAuthfunctions insrc/lib/firebase/auth.tsto correctly assign theprofessionalrole to new users, aligning with the project's defined user roles. - Added
use serverDirective: Added the required'use server';directive toinstitution-flow.tsandformulation-flow.tsto ensure they function correctly as server actions.
Removed
- Removed the
@genkit-ai/firebasetelemetry plugin to resolve a persistent build error related to its OpenTelemetry sub-dependencies. This does not affect core Firebase features like Auth or Firestore. - Removed OpenTelemetry dependencies (
@opentelemetry/api,@opentelemetry/exporter-jaeger,@opentelemetry/sdk-node,@opentelemetry/winston-transport) to simplify the project's dependency tree, as they were not essential for core functionality. - Removed the
patch-packagedependency and its associatedpostinstallscript, as it was part of a failed attempt to resolve build issues.
Fixed
- Resolved a critical and persistent build error related to Genkit plugin imports.
- Fixed a runtime crash on the admin page for mobile devices caused by a missing form context.
- Fixed a
gemini-pro404 Not Found error by updating to a current Genkit model (gemini-1.5-flash-preview-0514). - Corrected Landing Page Icon: Replaced a non-existent
ListDashesicon withListinsrc/components/landing/LandingPage.tsxto fix a build error. - Fixed Missing Component Import: Added the missing import for
CardDescriptioninsrc/components/landing/LandingPage.tsxto resolve a reference error. - Corrected the simulation logic for continuous vancomycin infusion to accurately model a loading dose followed by a constant infusion rate, rather than intermittent boluses.
- Fixed an issue where the simulator's "Run Simulation" button was not enabled on initial load, requiring a user to change the drug selection first. Also replaced 'gemini-1.5' with 'gemini-2.0-flash' in AI model references.
- Resolved an
npm installfailure by removing a faultypatch-packagescript and its associated patch file, which was causing conflicts. - TDM Warning Instead of Error: Modified the simulation engine in
src/lib/simulation.tsto treat inconsistent TDM data as a non-fatal warning, allowing the simulation to proceed with population-based parameters. UpdatedSimulator.tsxto display this warning. - Pediatric Renal Calculation: Corrected the Schwartz formula in
src/lib/simulation.tsto use the actual high creatinine value for pediatric patients, ensuring accurate calculation of renal impairment. - Age Display in Form: Fixed a bug in
src/components/simulator/PatientForm.tsxwhere the age input field would not correctly display the typed value.
Changed
- Improved the mobile responsiveness of the chatbot page interface for better usability on small screens.
- Enhanced PK/PD models with more accurate calculations and parameters based on a clinical audit.
- Redesigned the dosing regimen selector for better usability.
- Improved the admin dashboard with collapsible sections.
- Updated the UI to a glassmorphism and cyberpunk style with a 45-degree gradient on buttons.
- Applied a radial gradient to the application background.
- Updated the landing page to reflect the new, more accurate calculation models.
- Improved Unit Selector Visibility: Replaced the small
RadioGroupfor age and weight units with larger, more legibleTabsinsrc/components/simulator/PatientForm.tsx. - Cleaner Landing Page: Removed unnecessary descriptive text from the "Available Antibiotics" section on the landing page.
Added
- Two-Compartment Model Integration: Enhanced the simulation engine to support two-compartment pharmacokinetic models for drugs like Vancomycin and Colistin, providing more accurate concentration predictions. The admin dashboard now allows for selecting the compartment model and setting
alphaandbetarate constants. - Decoupled Default Parameters from Institutions: Refactored the application to store and manage default PK/PD parameters in a dedicated
defaultscollection in Firestore, instead of aninstitutions/defaultdocument. This resolves logical confusion and fixes persistent admin permission errors. - Default Antibiotic Parameter Consolidation: The default, hardcoded antibiotic parameter list in
src/lib/constants.tshas been cleaned up to remove duplicate entries for Vancomycin and Colistin. This ensures the application has a clean, correct fallback data source when Firestore is unavailable and prevents inconsistent UI states. - Implemented the Schwartz formula for estimating renal function in pediatric patients, replacing the less-accurate Cockcroft-Gault formula for this population.
- Added a "Simulation Details" card to the simulator page, providing transparent feedback on which calculation formulas (e.g., Schwartz, Cockcroft-Gault) and PK/PD parameters are being used.
- Enhanced the AI analysis to provide patient-specific dose adjustment suggestions when a measured drug concentration (TDM) is provided.
- Added therapeutic range (min/max) inputs to the simulator, allowing users to customize the target window for simulations.
- Initial project setup with Next.js and Firebase.
- Created a to-do list in
to-do.md. - Implemented context files for the chatbot.
- Developed an admin control panel for managing context and PK/PD parameters.
- Created this changelog file.
- Created a
faq.mdfile with frequently asked questions. - Implemented a feedback form page at
/feedback. - Added a section to the admin dashboard to view submitted feedback.
- Created
firebaselastrules.mdto store the latest Firestore security rules. - Implemented user authentication (Login and Register pages) using Firebase Auth.
- Created a
/join-institutionpage for users to join or create an institution after registration. - Added a
/scannerpage with camera access for scanning drug formulations. - Created
future-development.mdto outline the project roadmap. - Added a to-do item to correctly model continuous infusion pharmacokinetics.
- Logout Functionality: Added a dropdown menu with a "Logout" button to the sidebar for authenticated users.
- Drug Formulation Management: Implemented a system for adding and managing specific drug formulations (vial sizes, brands) in the Drug Library.
- Dynamic Antibiotic List: Added a section to the landing page that automatically updates with the list of available antibiotics from
src/lib/constants.ts. - New Chatbot Context: Created and integrated context files for antibiotic spectrums/pharmacodynamics and infection site penetration to enhance chatbot knowledge.
- Firestore-backed Default Parameters: Migrated the application's default PK/PD parameters from a hardcoded constant to a manageable document in Firestore.
- Admin Dashboard PK/PD Management: The admin dashboard now directly edits the default parameters stored in Firestore.
- AI Dosing Analysis & Suggestions: Re-implemented the AI analysis feature. The AI now provides scenario-specific advice, offering precise dose/interval changes when TDM data is available, and general guidance when using population data. The UI now includes an "Apply Suggestion" button to automatically re-run the simulation with the AI's recommendation.