Logo

Calc-o-mycin

About Calc-o-mycin

Learn more about the project and get in touch.

Contact Us

Have questions or feedback? Fill out the form below to send us a message.

Changelog

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 /subscriptions page 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 frontend NaturalLanguageInput component 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.tsx now dynamically changes based on the selected scenario, and the simulation.ts engine 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.tsx and DosingForm.tsx by ensuring that all numeric input fields have a defined value ('') instead of undefined, 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 /development page. 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 SidebarMenu component in SidebarNav.tsx so that it correctly appears within the slide-out menu on mobile devices.
  • Stabilized Simulation Chart Colors & Persistence: Corrected the logic in the Simulator.tsx and SimulationChart.tsx components. 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.ts and the UI in DosingForm.tsx to 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.tsx to ensure the TDM-calibrated model persists for resimulations.
  • Adjusted Default Dose: Set a more clinically realistic default dose in DosingForm.tsx to 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 institutions collection. 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/next Plugin: Corrected the import statement for the @genkit-ai/next plugin in src/ai/genkit.ts to 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/firebase plugin from the Genkit configuration (src/ai/genkit.ts) and package.json to 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_PARAMS object 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 genkit dependencies to version 1.16.0 to ensure compatibility and use the latest API syntax.
  • Updated Genkit Configuration: Refactored src/ai/genkit.ts to use the correct genkit() initialization syntax for Genkit v1.x, removing the deprecated configureGenkit.
  • Corrected User Role Assignment: Modified the signUp and useAuth functions in src/lib/firebase/auth.ts to correctly assign the professional role to new users, aligning with the project's defined user roles.
  • Added use server Directive: Added the required 'use server'; directive to institution-flow.ts and formulation-flow.ts to ensure they function correctly as server actions.

Removed

  • Removed the @genkit-ai/firebase telemetry 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-package dependency and its associated postinstall script, 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-pro 404 Not Found error by updating to a current Genkit model (gemini-1.5-flash-preview-0514).
  • Corrected Landing Page Icon: Replaced a non-existent ListDashes icon with List in src/components/landing/LandingPage.tsx to fix a build error.
  • Fixed Missing Component Import: Added the missing import for CardDescription in src/components/landing/LandingPage.tsx to 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 install failure by removing a faulty patch-package script and its associated patch file, which was causing conflicts.
  • TDM Warning Instead of Error: Modified the simulation engine in src/lib/simulation.ts to treat inconsistent TDM data as a non-fatal warning, allowing the simulation to proceed with population-based parameters. Updated Simulator.tsx to display this warning.
  • Pediatric Renal Calculation: Corrected the Schwartz formula in src/lib/simulation.ts to 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.tsx where 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 RadioGroup for age and weight units with larger, more legible Tabs in src/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 alpha and beta rate constants.
  • Decoupled Default Parameters from Institutions: Refactored the application to store and manage default PK/PD parameters in a dedicated defaults collection in Firestore, instead of an institutions/default document. This resolves logical confusion and fixes persistent admin permission errors.
  • Default Antibiotic Parameter Consolidation: The default, hardcoded antibiotic parameter list in src/lib/constants.ts has 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.md file with frequently asked questions.
  • Implemented a feedback form page at /feedback.
  • Added a section to the admin dashboard to view submitted feedback.
  • Created firebaselastrules.md to store the latest Firestore security rules.
  • Implemented user authentication (Login and Register pages) using Firebase Auth.
  • Created a /join-institution page for users to join or create an institution after registration.
  • Added a /scanner page with camera access for scanning drug formulations.
  • Created future-development.md to 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.