Skip to content

Display human-readable labels in buildHumanReadableData for onoff and select inputs#38

Merged
kcrt merged 3 commits into
masterfrom
copilot/update-inputs-to-labels
Feb 7, 2026
Merged

Display human-readable labels in buildHumanReadableData for onoff and select inputs#38
kcrt merged 3 commits into
masterfrom
copilot/update-inputs-to-labels

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 7, 2026

buildHumanReadableData was outputting raw numeric values (1/0 for onoff controls, numeric indices/values for select inputs) instead of human-readable labels, reducing readability in QR codes and copy-to-clipboard functionality.

Changes

  • onoff inputs: Convert 1/0 → "Yes"/"No"
  • sex inputs: Convert 1/0 → "Male"/"Female"
  • select inputs: Map stored values to option labels from schema
  • numeric inputs: Pass through unchanged (height, weight, etc.)

Implementation

Added type-based display value mapping in the input iteration loop:

switch (inputDef.type) {
  case "onoff":
    displayValue = value === 1 ? "Yes" : "No";
    break;
  case "sex":
    displayValue = value === 1 ? "Male" : "Female";
    break;
  case "select":
    const selectedOption = inputDef.options?.find(opt => opt.value === value);
    if (selectedOption) displayValue = selectedOption.label;
    break;
}

Example Output

Before:

Hypertension: 1
Sex: 0
Killip Class: 15

After:

Hypertension: Yes
Sex: Female
Killip Class: II - Rales/JVD
Original prompt

buildHumanReadableData constructs text from formula related data. However, it constructs inputs as numbers. It's better to express as labels. Also, use Yes and No for onoff control.


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

Copilot AI and others added 2 commits February 7, 2026 09:58
…uildHumanReadableData

Co-authored-by: kcrt <505011+kcrt@users.noreply.github.com>
Co-authored-by: kcrt <505011+kcrt@users.noreply.github.com>
Copilot AI changed the title [WIP] Update input representation to use labels instead of numbers Display human-readable labels in buildHumanReadableData for onoff and select inputs Feb 7, 2026
Copilot AI requested a review from kcrt February 7, 2026 10:01
@kcrt kcrt marked this pull request as ready for review February 7, 2026 11:46
@kcrt kcrt merged commit df3586e into master Feb 7, 2026
1 of 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.

2 participants