Skip to content

PedCardio study definition#165

Merged
lukaskollmer merged 11 commits into
mainfrom
lukas/studies-for-florence
May 7, 2026
Merged

PedCardio study definition#165
lukaskollmer merged 11 commits into
mainfrom
lukas/studies-for-florence

Conversation

@lukaskollmer
Copy link
Copy Markdown
Member

PedCardio study definition

♻️ Current situation & Problem

this PR adds the definition of the PedCardio study into the app

⚙️ Release Notes

  • added PedCardio study definition

📚 Documentation

n/a

✅ Testing

n/a

Code of Conduct & Contributing Guidelines

By creating and submitting this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@lukaskollmer lukaskollmer self-assigned this Apr 17, 2026
@lukaskollmer lukaskollmer added the enhancement New feature or request label Apr 17, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c1ce6107-f236-4c53-b22e-f56aad103362

📥 Commits

Reviewing files that changed from the base of the PR and between 0c0c416 and 1d9da4d.

📒 Files selected for processing (2)
  • LLMonFHIR.xcodeproj/xcshareddata/xcschemes/LLMonFHIR.xcscheme
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift
✅ Files skipped from review due to trivial changes (1)
  • LLMonFHIR.xcodeproj/xcshareddata/xcschemes/LLMonFHIR.xcscheme
🚧 Files skipped from review as they are similar to previous changes (1)
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift

📝 Walkthrough

Walkthrough

Adds a new pediatric cardiology study (pedCardioStudy) with system prompt and tasks, registers it, supplies three synthetic FHIR patient bundles, updates app launch/config to reference the study, adds/uses a SwiftPM Algorithms dependency, adjusts localization and small UI copy, increases a bottom-sheet size offset, and replaces two OSLog warnings with print.

Changes

Ped Cardio Study & Data

Layer / File(s) Summary
Study Definition (data & API)
LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift
Adds public static var pedCardioStudy: Study with tasks t1–t6, finalTaskQuestions, postInterventionQuestions, and FHIRPrompt.pedCardioStudySystemPrompt.
Register Study
LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/AllStudies.swift
Adds .pedCardioStudy to Study.allStudies.
Synthetic FHIR Data
LLMonFHIRShared/.../PedCardio/Patient1_HarryPotter.json, .../Patient2_MateoRodriguez.json, .../Patient3_ChloeChen.json
Adds three new FHIR Bundle JSON files containing synthetic pediatric cardiology patient records and linked resources.

Dependency & Package Wiring

Layer / File(s) Summary
Package manifest
LLMonFHIRShared/Package.swift
Adds dependency https://github.com/apple/swift-algorithms.git (from: "1.2.1") and adds .product(name: "Algorithms", package: "swift-algorithms") to LLMonFHIRShared target.
Resolved pins
LLMonFHIR.xcodeproj/xcshareddata/swiftpm/Package.resolved
Adds/updates a pin entry for swift-async-algorithms (remote source control revision/version).

App Config, Launch Wiring & Localization / UI Copy

Layer / File(s) Summary
App config
LLMonFHIR/Supporting Files/UserStudyConfig.plist
Adds studyConfigs.edu.stanford.LLMonFHIR.pedCardioStudy with openAIEndpoint: "firebase-function:chat" and empty API/report fields.
Scheme launch arg
LLMonFHIR.xcodeproj/xcshareddata/xcschemes/LLMonFHIR.xcscheme
Updates --mode study:... argument value from spineAI to pedCardioStudy (argument remains disabled).
Localization updates
LLMonFHIR/Resources/Localizable.xcstrings
Removes key Do you want to continue?, adds Do you want to leave the chat?, and adjusts nearby key/value structure.
Toolbar dialog copy
LLMonFHIR/FHIRInterpretation/UserStudy/UserStudyChatToolbar.swift
Changes dismissal confirmation dialog message text to “Do you want to leave the chat?”.
Prompt / question text normalization
LLMonFHIR/FHIRInterpretation/UserStudy/QuestionnaireResponses+Summary.swift, LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/GynStudy.swift, LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/UsabilityStudy.swift
Minor punctuation and formatting normalization (e.g., e.g., insertion, 0–10 en dash).

Small UX / Logging

Layer / File(s) Summary
Bottom sheet sizing
LLMonFHIR/Helper/BottomSheet.swift
In onHeightChange, increases added offset from +50 to +100 when computing sheet height.
Bundle lookup diagnostics
LLMonFHIRShared/Sources/LLMonFHIRShared/ResourceBundle.swift
Replaces two OSLog warning calls with print statements for JSON decode failure and duplicate patient-name bundle warnings.

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant App as App
  participant StudyMgr as StudyManager
  participant FHIR as FHIRStore
  participant Backend as FirebaseFunction
  participant OpenAI as OpenAI

  User->>App: start pedCardioStudy
  App->>StudyMgr: request study definition & system prompt
  StudyMgr->>FHIR: get_resources(filter: pedCardioStudy)
  FHIR-->>StudyMgr: return FHIR resources
  StudyMgr->>Backend: send prompt + resources (firebase-function:chat)
  Backend->>OpenAI: forward prompt
  OpenAI-->>Backend: assistant response
  Backend-->>App: assistant response
  App-->>User: display concise, parent‑friendly summary
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • image annotating #156: Modifies QuestionnaireResponses+Summary.swift and related questionnaire/image-annotation summarization logic.
  • update SpineAI intake survey #160: Edits QuestionnaireResponses+Summary.swift (response/task-kind extraction/refactor), overlapping the same area of code.

Suggested reviewers

  • PSchmiedmayer
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'PedCardio study definition' directly and clearly describes the main change - adding a new pediatric cardiology study definition to the codebase.
Description check ✅ Passed The description is related to the changeset, identifying the PedCardio study definition as the primary addition and providing context about the current situation and release notes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lukas/studies-for-florence

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.35%. Comparing base (b1de795) to head (1d9da4d).

Files with missing lines Patch % Lines
.../Sources/LLMonFHIRStudyDefinitions/PedCardio.swift 0.00% 3 Missing ⚠️
...hared/Sources/LLMonFHIRShared/ResourceBundle.swift 0.00% 1 Missing ⚠️
...ed/Study/Task/TaskQuestionType+AnswerOptions.swift 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #165      +/-   ##
==========================================
- Coverage   18.40%   18.35%   -0.05%     
==========================================
  Files          97       98       +1     
  Lines        1011     1014       +3     
==========================================
  Hits          186      186              
- Misses        825      828       +3     
Files with missing lines Coverage Δ
...ion/UserStudy/QuestionnaireResponses+Summary.swift 0.00% <ø> (ø)
...nterpretation/UserStudy/UserStudyChatToolbar.swift 0.00% <ø> (ø)
LLMonFHIR/Helper/BottomSheet.swift 0.00% <ø> (ø)
...Sources/LLMonFHIRStudyDefinitions/AllStudies.swift 0.00% <ø> (ø)
...d/Sources/LLMonFHIRStudyDefinitions/GynStudy.swift 0.00% <ø> (ø)
...ces/LLMonFHIRStudyDefinitions/UsabilityStudy.swift 0.00% <ø> (ø)
...hared/Sources/LLMonFHIRShared/ResourceBundle.swift 0.00% <0.00%> (ø)
...ed/Study/Task/TaskQuestionType+AnswerOptions.swift 0.00% <0.00%> (ø)
.../Sources/LLMonFHIRStudyDefinitions/PedCardio.swift 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1de795...1d9da4d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
LLMonFHIRShared/Sources/LLMonFHIRShared/ResourceBundle.swift (1)

79-82: ⚠️ Potential issue | 🟡 Minor

Pre-existing bug nearby: break aborts the entire bundle scan on the first duplicate patient name.

Not introduced in this PR, but worth flagging now that a new set of synthetic patients is being added under Synthetic Patients/PedCardio/: if any two bundles share a patient's fullName, the break on line 81 exits the outer for url in enumerator loop, so every subsequent bundle (including unrelated ones by path) is never indexed into bundlesByPath or bundlesByPatientName. This silently hides bundles from both named(_:) and forPatient(named:). Likely meant to be continue.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@LLMonFHIRShared/Sources/LLMonFHIRShared/ResourceBundle.swift` around lines 79
- 82, The loop currently uses break inside the enumerator loop which aborts
scanning all bundles when a duplicate patientName is found; in the
method/initializer that populates bundlesByPatientName and bundlesByPath (look
for the for url in enumerator loop in ResourceBundle.swift and the guard that
checks allBundlesByPatientName.keys.contains(patientName)), change the control
flow so a duplicate patientName only skips the current bundle (use continue
instead of break) and ensure bundlesByPatientName[patientName] is set to nil to
mark ambiguity without stopping the outer iteration, so subsequent bundles are
still indexed into bundlesByPath and evaluated.
🧹 Nitpick comments (4)
LLMonFHIR/Supporting Files/UserStudyConfig.plist (1)

61-69: Config entry looks correct; minor consistency nit.

The new pedCardioStudy block matches the existing firebase-function:chat pattern used by spineAI. Note that the spineAI entry (lines 45–51) omits openAIAPIKey entirely while the new entry includes an empty openAIAPIKey; either is fine but picking one convention avoids confusion about whether absence vs. empty has semantic meaning in the config reader.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@LLMonFHIR/Supporting` Files/UserStudyConfig.plist around lines 61 - 69, Make
the config consistent by choosing one convention for absent vs empty API key:
either remove the empty <key>openAIAPIKey</key> entry from the
edu.stanford.LLMonFHIR.pedCardioStudy dict or add an explicit empty openAIAPIKey
entry to the existing spineAI dict so both use the same pattern; locate the
<key>edu.stanford.LLMonFHIR.pedCardioStudy</key> and <key>spineAI</key> blocks
and update the presence/absence of the openAIAPIKey element to match.
LLMonFHIRShared/Sources/LLMonFHIRShared/Resources/Synthetic Patients/PedCardio/Patient2_MateoRodriguez.json (1)

53-71: Consistency: race extension is missing (only ethnicity is set).

Patient1 and Patient3 carry the us-core-race extension, while this patient only has us-core-ethnicity. Under US Core these are independent profiles — having ethnicity without race is unusual and can produce asymmetric answers if the LLM is asked about demographics across the three patients. Consider adding a us-core-race extension (or adding us-core-ethnicity to the other two bundles) so the dataset is uniformly profiled.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@LLMonFHIRShared/Sources/LLMonFHIRShared/Resources/Synthetic`
Patients/PedCardio/Patient2_MateoRodriguez.json around lines 53 - 71, This
patient JSON currently contains only the us-core-ethnicity extension under the
top-level "extension" array; add a sibling extension object with "url":
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race" and include the
same nested structure used in Patient1/Patient3 (an "extension" array containing
"ombCategory" with a valueCoding and "text" with valueString) so the bundle
includes a us-core-race entry consistent with the other patients and avoids
asymmetric demographics.
LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift (2)

9-9: Avoid swiftlint:disable all; disable only the specific rules you need.

Disabling every rule for a ~350-line file hides real defects this PR already contains (missing isOptional argument consistency, long strings, grammar/typos). Prefer targeted // swiftlint:disable <rule> directives or a narrower :next/:this scope.

♻️ Proposed fix
-// swiftlint:disable all
+// swiftlint:disable file_length line_length type_body_length
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift` at line 9,
The file PedCardio.swift currently uses a blanket directive "//
swiftlint:disable all"; replace that with targeted disables only for the
specific rules needed (for example "line_length", "identifier_name",
"string_literal_long_line", etc.) and scope them narrowly (use :next or :this
where possible) to avoid hiding other issues; then run SwiftLint on
PedCardio.swift, address reported problems (fix inconsistent isOptional usage
across initializers/properties, break up long strings, correct grammar/typos)
and only add rule-specific disables next to the offending declarations rather
than disabling all rules for the entire file.

342-348: Minor: punctuation/grammar in the required opening phrase.

The prompt instructs the model to start every conversation with "Hello caregiver of (name) I understand that …". This is an awkward run‑on — without a comma after “Hello” and a separator before “I understand,” models often reproduce it verbatim in a way that reads poorly to parents. Suggest:

♻️ Proposed fix
-        Always start the summary by saying: "Hello caregiver of (name) I understand that …".
+        Always start the summary by saying: "Hello, caregiver of (name). I understand that …".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift` around
lines 342 - 348, The opening prompt text "Hello caregiver of (name) I understand
that …" is grammatically awkward; locate the prompt constant or string in
PedCardio.swift (search for the exact phrase or in functions generating the
summary, e.g., any method that constructs the initial greeting) and change it to
a corrected form such as "Hello, caregiver of (name). I understand that …" or
"Hello caregiver of (name), I understand that …" so there is a clear separator
after the greeting; update any tests or usages that rely on the exact wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@LLMonFHIR.xcodeproj/xcshareddata/xcschemes/LLMonFHIR.xcscheme`:
- Around line 80-83: The shared scheme currently enables the CommandLineArgument
with argument="--useFirebaseEmulator"; revert it so isEnabled is "NO" in the
LLMonFHIR.xcscheme to avoid forcing the local emulator for everyone. Locate the
CommandLineArgument entry for "--useFirebaseEmulator" and set isEnabled back to
"NO", and if a developer needs this flag, advise enabling it only in their
personal/user scheme or run configuration; no changes needed to
FeatureFlags.swift or LLMonFHIRDelegate.firebaseModules(), just disable the flag
in the shared scheme.

In `@LLMonFHIR/Helper/BottomSheet.swift`:
- Line 22: The hardcoded "+100" padding in BottomSheet.swift (used when setting
height and calling presentationDetents) should be replaced with a small named
constant (e.g., PADDING) and the requested detent height should be clamped so it
never exceeds a safe maximum; compute contentHeight + PADDING and then use
min(contentHeight + PADDING, UIScreen.main.bounds.height * 0.9) (or derive max
from safeAreaInsets if available) before calling
presentationDetents([.height(...)]) so tall views like TaskInstructionView don't
get clipped and tiny sheets like uploadSheet() aren't over-inflated.

In `@LLMonFHIRShared/Sources/LLMonFHIRShared/ResourceBundle.swift`:
- Line 72: Restore structured logging by replacing the stray print calls used
when a FHIR bundle fails to decode with the module's Logger (use
Self.logger.warning or .error as appropriate) where the bundle-decoding occurs
(the same locations that currently call print for "Skipping FHIR bundle at
\(url.path) (unable to decode): \(error)"); reference the static logger declared
on the type (the Logger on the struct) and log the same message plus the error
so OSLog/Console receives level, subsystem and category metadata; if you changed
to print due to logger-init ordering, add a brief comment next to the static
logger explaining why it's safe/lazy-initialized instead of switching to print.

In `@LLMonFHIRShared/Sources/LLMonFHIRShared/Resources/Synthetic`
Patients/PedCardio/Patient1_HarryPotter.json:
- Around line 391-397: The BMI entry under the Observation with
"effectiveDateTime": "2026-02-15" has a mismatch: its valueQuantity.value is
21.34 but should be recalculated from the recorded Body weight (52.6 kg) and
Body height (158 cm) to ~21.07 kg/m2; update the BMI Observation's
valueQuantity.value to the correctly computed number (rounded consistently with
other vitals) so the Observation with "effectiveDateTime": "2026-02-15" and its
valueQuantity reflect 52.6 / 1.58^2 ≈ 21.07 and keep unit/system/code as is.

In `@LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift`:
- Around line 33-35: Task 1 and Task 4 use inconsistent caregiver-facing wording
and Task 1's instructions end with a question mark; update the instruction
strings for both tasks so they address the caregiver about "your child's health"
(not "your health") and make Task 1's instructions an imperative sentence
(remove the trailing question mark). Locate the affected string properties (the
instructions field shown in PedCardio.swift for Task 1 and the analogous
instructions block for Task 4 around lines 58-61) and replace "your health" with
"your child's health" and change the final punctuation of Task 1 from '?' to '.'
so wording is consistent and directive.
- Around line 141-158: The instructional preamble in postInterventionQuestions
(Study.Task.Question) claims responses use "Always, Often, Sometimes, Never" and
also tells users to select "N/A", but the actual response scale
(.frequencyOptions) does not include N/A; fix by making instructions and options
consistent: either remove the "If the statement does not apply to you, select
N/A." sentence from the Study.Task.Question text or add an explicit "N/A" option
to the .frequencyOptions used for these questions so the UI matches the copy.
- Around line 75-78: The question text in the PedCardio definition uses
.init(text: "What were the most and least useful features of the LLM? Do you
have any suggestions to share", type: .freeText, isOptional: true) and is
missing terminal punctuation; update the string to end with proper punctuation
(e.g., add a question mark or period) so the prompt is grammatically
complete—locate the .init(...) call in PedCardio.swift and amend the text value
accordingly.

---

Outside diff comments:
In `@LLMonFHIRShared/Sources/LLMonFHIRShared/ResourceBundle.swift`:
- Around line 79-82: The loop currently uses break inside the enumerator loop
which aborts scanning all bundles when a duplicate patientName is found; in the
method/initializer that populates bundlesByPatientName and bundlesByPath (look
for the for url in enumerator loop in ResourceBundle.swift and the guard that
checks allBundlesByPatientName.keys.contains(patientName)), change the control
flow so a duplicate patientName only skips the current bundle (use continue
instead of break) and ensure bundlesByPatientName[patientName] is set to nil to
mark ambiguity without stopping the outer iteration, so subsequent bundles are
still indexed into bundlesByPath and evaluated.

---

Nitpick comments:
In `@LLMonFHIR/Supporting` Files/UserStudyConfig.plist:
- Around line 61-69: Make the config consistent by choosing one convention for
absent vs empty API key: either remove the empty <key>openAIAPIKey</key> entry
from the edu.stanford.LLMonFHIR.pedCardioStudy dict or add an explicit empty
openAIAPIKey entry to the existing spineAI dict so both use the same pattern;
locate the <key>edu.stanford.LLMonFHIR.pedCardioStudy</key> and
<key>spineAI</key> blocks and update the presence/absence of the openAIAPIKey
element to match.

In `@LLMonFHIRShared/Sources/LLMonFHIRShared/Resources/Synthetic`
Patients/PedCardio/Patient2_MateoRodriguez.json:
- Around line 53-71: This patient JSON currently contains only the
us-core-ethnicity extension under the top-level "extension" array; add a sibling
extension object with "url":
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race" and include the
same nested structure used in Patient1/Patient3 (an "extension" array containing
"ombCategory" with a valueCoding and "text" with valueString) so the bundle
includes a us-core-race entry consistent with the other patients and avoids
asymmetric demographics.

In `@LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift`:
- Line 9: The file PedCardio.swift currently uses a blanket directive "//
swiftlint:disable all"; replace that with targeted disables only for the
specific rules needed (for example "line_length", "identifier_name",
"string_literal_long_line", etc.) and scope them narrowly (use :next or :this
where possible) to avoid hiding other issues; then run SwiftLint on
PedCardio.swift, address reported problems (fix inconsistent isOptional usage
across initializers/properties, break up long strings, correct grammar/typos)
and only add rule-specific disables next to the offending declarations rather
than disabling all rules for the entire file.
- Around line 342-348: The opening prompt text "Hello caregiver of (name) I
understand that …" is grammatically awkward; locate the prompt constant or
string in PedCardio.swift (search for the exact phrase or in functions
generating the summary, e.g., any method that constructs the initial greeting)
and change it to a corrected form such as "Hello, caregiver of (name). I
understand that …" or "Hello caregiver of (name), I understand that …" so there
is a clear separator after the greeting; update any tests or usages that rely on
the exact wording.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4915170f-56e0-4bbf-a25b-e49a357885af

📥 Commits

Reviewing files that changed from the base of the PR and between b1de795 and faae5d3.

📒 Files selected for processing (12)
  • LLMonFHIR.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • LLMonFHIR.xcodeproj/xcshareddata/xcschemes/LLMonFHIR.xcscheme
  • LLMonFHIR/FHIRInterpretation/UserStudy/UserStudyChatToolbar.swift
  • LLMonFHIR/Helper/BottomSheet.swift
  • LLMonFHIR/Resources/Localizable.xcstrings
  • LLMonFHIR/Supporting Files/UserStudyConfig.plist
  • LLMonFHIRShared/Sources/LLMonFHIRShared/ResourceBundle.swift
  • LLMonFHIRShared/Sources/LLMonFHIRShared/Resources/Synthetic Patients/PedCardio/Patient1_HarryPotter.json
  • LLMonFHIRShared/Sources/LLMonFHIRShared/Resources/Synthetic Patients/PedCardio/Patient2_MateoRodriguez.json
  • LLMonFHIRShared/Sources/LLMonFHIRShared/Resources/Synthetic Patients/PedCardio/Patient3_ChloeChen.json
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/AllStudies.swift
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift

Comment thread LLMonFHIR.xcodeproj/xcshareddata/xcschemes/LLMonFHIR.xcscheme
Comment thread LLMonFHIR/Helper/BottomSheet.swift
Comment thread LLMonFHIRShared/Sources/LLMonFHIRShared/ResourceBundle.swift
Comment thread LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift
Comment thread LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift
Comment thread LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift (2)

15-16: Doc comment is generic — doesn't identify this as the PedCardio study.

/// LLMonFHIR's usability study is reused verbatim across study definitions. A one-line callout that this is the pediatric cardiology variant (caregiver-facing, cardiology-scoped prompt) helps disambiguate at call sites.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift` around
lines 15 - 16, Update the generic doc comment above the public static var
pedCardioStudy: Study to specifically identify this as the pediatric cardiology
(PedCardio) study — e.g., note it is the caregiver-facing, cardiology-scoped
variant — so callers can disambiguate this Study from other study definitions;
modify the comment attached to pedCardioStudy accordingly.

9-9: Avoid blanket swiftlint:disable all at file scope.

Disabling all lint rules for an entire file silently hides real issues (e.g. unused code, identifier rules, force-unwraps) in a study definition that will likely grow over time. Prefer disabling only the specific rule(s) that fail here (or use // swiftlint:disable:next <rule> / file-level disable <rule> with a short rationale).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift` at line 9,
The file-level blanket suppression ("// swiftlint:disable all") in
PedCardio.swift should be removed; instead run SwiftLint to see which specific
rules are triggering, then replace the all-disable with targeted disables for
only those rules (e.g. "// swiftlint:disable identifier_name" or use "//
swiftlint:disable:next <rule>" immediately before the offending declaration) and
add a one-line rationale comment for each file-scope disable so future
contributors know why it's exempted; search for top-of-file "//
swiftlint:disable all" and update it to specific rule disables or next-line
disables around the offending functions/identifiers in PedCardio types and
methods.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift`:
- Line 86: The string literal starting with text: "On a scale of 0—10 how
likely..." uses an em‑dash; replace the em‑dash (U+2014) with an en‑dash
(U+2013) or a hyphen so the range reads "0–10" or "0-10" to match numeric range
conventions and visual weight; update the text: "On a scale of 0—10 how likely
are you to recommend..." entry in PedCardio.swift accordingly.
- Around line 92-96: The instruction text for Task with id "t5" is UI-chrome
specific; update the instructions in the Task(id: "t5") definition to use
UI-agnostic or accessibility-aware wording (for example, reference the button by
its accessible label like "Continue" or "Next", or say "Use the app's
Continue/Next control to advance") so the copy does not break if the
icon/position changes and remains clear to VoiceOver users.
- Around line 343-349: Update the greeting template string used for cardiology
summaries so it includes punctuation after the salutation and marks the
recipient placeholder clearly; change “Hello caregiver of (name) I understand
that …” to include a comma (e.g., “Hello caregiver of (name), I understand that
…”) and document that (name) is a substitute placeholder (not literal text)
wherever this template is defined (search for the template string in
PedCardio.swift or the function/method that builds the prompt). Ensure any code
that injects the patient name replaces the placeholder rather than leaving the
literal parentheses.
- Line 197: Normalize the spacing around the slash in the affected string:
locate the entry where text: "I am confident that I/ my child can follow
through..." in PedCardio.swift and change "I/ my child" to "I / my child" so it
matches the other array items; ensure any other occurrences in the same array
(the fields with key text) use the same "I / my child" spacing for consistency.

---

Nitpick comments:
In `@LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift`:
- Around line 15-16: Update the generic doc comment above the public static var
pedCardioStudy: Study to specifically identify this as the pediatric cardiology
(PedCardio) study — e.g., note it is the caregiver-facing, cardiology-scoped
variant — so callers can disambiguate this Study from other study definitions;
modify the comment attached to pedCardioStudy accordingly.
- Line 9: The file-level blanket suppression ("// swiftlint:disable all") in
PedCardio.swift should be removed; instead run SwiftLint to see which specific
rules are triggering, then replace the all-disable with targeted disables for
only those rules (e.g. "// swiftlint:disable identifier_name" or use "//
swiftlint:disable:next <rule>" immediately before the offending declaration) and
add a one-line rationale comment for each file-scope disable so future
contributors know why it's exempted; search for top-of-file "//
swiftlint:disable all" and update it to specific rule disables or next-line
disables around the offending functions/identifiers in PedCardio types and
methods.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 98782b24-09ca-462f-8a2c-e16a92559901

📥 Commits

Reviewing files that changed from the base of the PR and between faae5d3 and 5c9b8fc.

📒 Files selected for processing (2)
  • LLMonFHIRShared/Sources/LLMonFHIRShared/Resources/Synthetic Patients/PedCardio/Patient1_HarryPotter.json
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift
✅ Files skipped from review due to trivial changes (1)
  • LLMonFHIRShared/Sources/LLMonFHIRShared/Resources/Synthetic Patients/PedCardio/Patient1_HarryPotter.json

Comment thread LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift Outdated
Comment thread LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift
Comment thread LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift Outdated
Comment thread LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
LLMonFHIRShared/Sources/LLMonFHIRShared/Study/Task/TaskQuestionType+AnswerOptions.swift (1)

71-76: Consider a stdlib alternative to avoid the swift-algorithms package dependency.

chain(self, CollectionOfOne("N/A")) is the only usage of the Algorithms module in this target. The same behaviour is achievable without the package:

♻️ Proposed refactor — drop `Algorithms` import and use stdlib concatenation
-private import Algorithms
 private import Foundation
 private import SpeziFoundation
 extension Study.Task.Question.Kind.AnswerOptions {
     /// Creates a new `AnswerOptions`, by unconditionally appending a `N/A` option at the end.
     public var withNA: Self {
-        Self(chain(self, CollectionOfOne("N/A")))
+        Self(Array(self) + ["N/A"])
     }
 }

And remove the corresponding .product(name: "Algorithms", package: "swift-algorithms") entry in LLMonFHIRShared/Package.swift (line 44) and the package declaration itself if unused elsewhere.

If Algorithms is expected to be used more broadly in follow-up work, keeping the dependency is fine — but please verify there are other planned usages before merging.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@LLMonFHIRShared/Sources/LLMonFHIRShared/Study/Task/TaskQuestionType`+AnswerOptions.swift
around lines 71 - 76, The withNA computed property uses chain(self,
CollectionOfOne("N/A")) from the Algorithms package; replace that with stdlib
concatenation (e.g., create a new AnswerOptions by appending "N/A" to the
existing collection using + or by creating an array from self and adding "N/A")
inside Study.Task.Question.Kind.AnswerOptions.withNA, then remove the Algorithms
import and the Algorithms product entry from Package.swift if there are no other
uses; update references to chain/CollectionOfOne accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@LLMonFHIR.xcodeproj/xcshareddata/xcschemes/LLMonFHIR.xcscheme`:
- Around line 113-115: The shared scheme currently has the CommandLineArgument
with argument="--mode study:edu.stanford.LLMonFHIR.pedCardioStudy" set with
isEnabled="YES"; change isEnabled to "NO" (or remove the argument entirely) so
the pedCardio study mode is not enabled by default in the shared scheme and
leave this flag enabled only in a personal/local scheme when actively developing
that study.

---

Nitpick comments:
In
`@LLMonFHIRShared/Sources/LLMonFHIRShared/Study/Task/TaskQuestionType`+AnswerOptions.swift:
- Around line 71-76: The withNA computed property uses chain(self,
CollectionOfOne("N/A")) from the Algorithms package; replace that with stdlib
concatenation (e.g., create a new AnswerOptions by appending "N/A" to the
existing collection using + or by creating an array from self and adding "N/A")
inside Study.Task.Question.Kind.AnswerOptions.withNA, then remove the Algorithms
import and the Algorithms product entry from Package.swift if there are no other
uses; update references to chain/CollectionOfOne accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a8cfe01b-00cf-46bd-bbc0-75666682ef43

📥 Commits

Reviewing files that changed from the base of the PR and between 5c9b8fc and 0c0c416.

📒 Files selected for processing (7)
  • LLMonFHIR.xcodeproj/xcshareddata/xcschemes/LLMonFHIR.xcscheme
  • LLMonFHIR/FHIRInterpretation/UserStudy/QuestionnaireResponses+Summary.swift
  • LLMonFHIRShared/Package.swift
  • LLMonFHIRShared/Sources/LLMonFHIRShared/Study/Task/TaskQuestionType+AnswerOptions.swift
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/GynStudy.swift
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/UsabilityStudy.swift
✅ Files skipped from review due to trivial changes (4)
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/UsabilityStudy.swift
  • LLMonFHIR/FHIRInterpretation/UserStudy/QuestionnaireResponses+Summary.swift
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/GynStudy.swift
  • LLMonFHIRShared/Sources/LLMonFHIRStudyDefinitions/PedCardio.swift

Comment thread LLMonFHIR.xcodeproj/xcshareddata/xcschemes/LLMonFHIR.xcscheme
@lukaskollmer lukaskollmer merged commit 8bcb7eb into main May 7, 2026
9 of 11 checks passed
@lukaskollmer lukaskollmer deleted the lukas/studies-for-florence branch May 7, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants