Skip to content

[WIP] Add recording functionality for anti-androgen medications#25

Merged
NaiveTomcat merged 5 commits into
masterfrom
copilot/add-drug-recording-functionality
Mar 11, 2026
Merged

[WIP] Add recording functionality for anti-androgen medications#25
NaiveTomcat merged 5 commits into
masterfrom
copilot/add-drug-recording-functionality

Conversation

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown
Contributor
  • Explored codebase and created implementation plan
  • Create AntiAndrogen enum (CPA, MPA, Bicalutamide, Spironolactone) with displayName extension
  • Add ANTIANDROGEN to Route enum
  • Add ANTI_ANDROGEN_TYPE to DoseEvent.ExtraKey
  • Create TablerGenderAndrogyne icon in ui/icons/TablerIcons.kt
  • Update RouteUtils to handle ANTIANDROGEN route (icon + display name)
  • Update MedicationRecordItem to use tertiaryContainer for anti-androgen events and show correct drug name
  • Update MedicationRecordBottomSheet to support anti-androgen type selection and simple dose input
  • Update MedicationPlanBottomSheet to support anti-androgen type selection with localized names
  • Update MedicationRecordsScreen quick-add to handle anti-androgen plans
  • Update HRTViewModel to filter anti-androgen events/plans from PK simulation
  • Update MedicationPlan.getDescription() for anti-androgen plans using displayName extension
  • Update WidgetUtils.routeDisplayName for ANTIANDROGEN
  • Update ParameterResolver and SimulationEngine for defensive ANTIANDROGEN handling
  • Update MahiroJsonFormat to include antiandrogen route and antiAndrogenType extra key
  • Update HRTTrackerWidgetConfigActivity to use displayName extension (removed duplicate antiAndrogenName)
  • Add strings for anti-androgen types and route to strings.xml
  • Add missing anti-androgen string translations to values-zh-rCN/strings.xml (fixes CI lint failure)
  • Add MedicationPlan.drugDisplayName() helper to WidgetUtils — returns anti-androgen type name for AA plans, ester name otherwise
  • Update HRTTrackerWidget to use plan.drugDisplayName() in all three display locations (reminder row, quick-add row, confirm row)
  • Build and lint pass successfully
Original prompt

This section details on the original issue you should resolve

<issue_title>[FEAT REQ] 增加抗雄药物用药记录与计划</issue_title>
<issue_description>[WIP]</issue_description>

Comments on the Issue (you are @copilot in this section)

@NaiveTomcat 仅在用药记录列表和用药方案/计划中实现抗雄药物的记录功能,而不进行药代动力学计算可否?即该app对于抗雄药物只作为记录和提醒功能?

目前我尚不知晓抗雄药物的药代动力学具体模型和参数,同时其血药浓度似乎没有直接参考意义?实际有参考意义的应为T和双促,对于受体拮抗剂类型而言T和双促的血清浓度甚至也不一定有临床意义?</comment_new>
<comment_new>@NaiveTomcat

仅在用药记录列表和用药方案/计划中实现抗雄药物的记录功能,而不进行药代动力学计算可否?即该app对于抗雄药物只作为记录和提醒功能?

可。

合适的改动应为:

  • 增加一类不参与药代动力学计算的用药列表项和用药方案项
  • 快速添加以及桌面小组件的逻辑同雌二醇类药物
  • 抗雄药物仅有口服,因此抗雄药物可以单独作为一个给药途径。需要一个单独的icon
  • 抗雄药物的类型单独定义一个枚举?暂定包括CPA、MPA、比卡鲁胺、螺内酯
  • 抗雄药物显示的container颜色应与雌激素不同,暂定tertiary container?

抗雄药物的icon可以使用这个?

/*
MIT License

Copyright (c) 2020-2025 Paweł Kuna

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

*/
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp

val TablerGenderAndrogyne: ImageVector
    get() {
        if (_TablerGenderAndrogyne != null) return _TablerGenderAndrogyne!!
        
        _TablerGenderAndrogyne = ImageVector.Builder(
            name = "gender-androgyne",
            defaultWidth = 24.dp,
            defaultHeight = 24.dp,
            viewportWidth = 24f,
            viewportHeight = 24f
        ).apply {
            path(
                fill = SolidColor(Color.Transparent),
                stroke = SolidColor(Color.Black),
                strokeLineWidth = 2f,
                strokeLineCap = StrokeCap.Round,
                strokeLineJoin = StrokeJoin.Round
            ) {
                moveTo(13f, 11f)
                lineToRelative(6f, -6f)
            }
            path(
                fill = SolidColor(Color.Transparent),
                stroke = SolidColor(Color.Black),
                strokeLineWidth = 2f,
                strokeLineCap = StrokeCap.Round,
                strokeLineJoin = StrokeJoin.Round
            ) {
                moveTo(9f, 15f)
                moveToRelative(-5f, 0f)
                arcToRelative(5f, 5f, 0f, true, false, 10f, 0f)
                arcToRelative(5f, 5f, 0f, true, false, -10f, 0f)
            }
            path(
                fill = SolidColor(Color.Transparent),
                stroke = SolidColor(Color.Black),
                strokeLineWidth = 2f,
                strokeLineCap = StrokeCap.Round,
                strokeLineJoin = StrokeJoin.Round
            ) {
                moveTo(19f, 9f)
                verticalLineToRelative(-4f)
                horizontalLineToRelative(-4f)
            }
            path(
                fill = SolidColor(Color.Transparent),
                stroke = SolidColor(Color.Black),
                strokeLineWidth = 2f,
                strokeLineCap = StrokeCap.Round,
                strokeLineJoin = StrokeJoin.Round
            ) {
                moveTo(16.5f, 10.5f)
                lineToRelative(-3f, -3f)
            }
        }.build()
        
        return _TablerGenderAndrogyne!!
    }

private var _TablerGenderAndrogyne: ImageVector? = null

```</body></comment_new>
</comments>

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ronolactone)

Co-authored-by: NaiveTomcat <50436951+NaiveTomcat@users.noreply.github.com>
@NaiveTomcat

Copy link
Copy Markdown
Owner

@copilot continue your work, and fix build issues

…alized names in plan bottom sheet

Co-authored-by: NaiveTomcat <50436951+NaiveTomcat@users.noreply.github.com>

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot continue your work, and fix build issues

Build is fixed and code review issues are resolved in commit 5a20d34:

  • MedicationPlan.kt: Replaced duplicated when expression with aaType.antiAndrogenDisplayName (imported as alias from pk.displayName to avoid conflict with Ester.displayName)
  • HRTTrackerWidgetConfigActivity.kt: Removed the duplicate antiAndrogenName() helper and now uses the displayName extension property directly
  • MedicationPlanBottomSheet.kt: AntiAndrogenSelectionSection now shows localized Chinese names (e.g. "醋酸环丙孕酮") via getAntiAndrogenDisplayName(aa) instead of English enum names like "CPA", "MPA"

@NaiveTomcat

Copy link
Copy Markdown
Owner

@copilot ci build failed. Please fix

…slations

Co-authored-by: NaiveTomcat <50436951+NaiveTomcat@users.noreply.github.com>

Copilot AI commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot ci build failed. Please fix

Fixed in commit 0cfa22b. The CI failure was a lint MissingTranslation error — the 7 new anti-androgen strings (route_antiandrogen, antiandrogen_cpa/mpa/bicalutamide/spironolactone, plan_sheet_antiandrogen_title, record_sheet_antiandrogen_title) were in values/strings.xml but missing from values-zh-rCN/strings.xml. Added all 7 translations there; lint now passes.

@NaiveTomcat

Copy link
Copy Markdown
Owner

@copilot widgets should display the name of antiandrogens correctly

Co-authored-by: NaiveTomcat <50436951+NaiveTomcat@users.noreply.github.com>

Copilot AI commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot widgets should display the name of antiandrogens correctly

Fixed in commit 7fca3eb. Added MedicationPlan.drugDisplayName() helper to WidgetUtils that returns the anti-androgen type name (e.g. "醋酸环丙孕酮") for AA plans and the ester name for others. Updated all three display locations in HRTTrackerWidget (reminder row, quick-add row, confirm row) to use it instead of plan.ester.displayName.

@NaiveTomcat NaiveTomcat marked this pull request as ready for review March 11, 2026 00:34
@NaiveTomcat NaiveTomcat merged commit fed1803 into master Mar 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT REQ] 增加抗雄药物用药记录与计划

2 participants