Skip to content

fix: render dosage result inline in calculator panel#19

Merged
DeepRatAI merged 1 commit intomainfrom
fix/dosage-inline-display
Feb 26, 2026
Merged

fix: render dosage result inline in calculator panel#19
DeepRatAI merged 1 commit intomainfrom
fix/dosage-inline-display

Conversation

@DeepRatAI
Copy link
Owner

Summary

Closes #16

Adds inline display of dosage calculation results directly in dosage_calculator_panel() using rx.cond(MedeXState.dosage_result). Previously, the computed dosage was only accessible through the artifact card modal ("Ver Más").

Changes

ui/medex_ui/app.py

  • Added rx.cond(MedeXState.dosage_result != "", rx.box(rx.markdown(...))) block between the error display and the artifacts grid
  • Result renders with rx.markdown() for proper formatting of the dosage fields
  • Styled with THEME.PRIMARY_50 background and border to match the panel aesthetic

Before/After

Before After
User clicks Calculate → sees generic artifact card title User clicks Calculate → result (dose, frequency, max daily, warnings) shown immediately inline
Must click "Ver Más" on artifact card to see actual values Artifact card still available for modal view, but values are visible without extra interaction

Technical Details

  • MedeXState.dosage_result (str) is already populated correctly by _format_dosage_result() in state.py
  • No state changes needed — only rendering was missing
  • The rx.cond pattern matches Error/Loading patterns already used in the panel

@DeepRatAI DeepRatAI added bug Something isn't working enhancement New feature or request labels Feb 26, 2026
@DeepRatAI DeepRatAI added this to the v0.2.0 - Features milestone Feb 26, 2026
@DeepRatAI DeepRatAI merged commit 2751e39 into main Feb 26, 2026
5 of 8 checks passed
@DeepRatAI DeepRatAI deleted the fix/dosage-inline-display branch February 26, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Dosage Calculator does not display calculation results inline

1 participant