Skip to content

Add chapter 08 — Conditional & Coalescing Sources (Case / Coalesce) - #3

Merged
matthewhorridge merged 1 commit into
mainfrom
feat/case-coalesce-example
Jun 30, 2026
Merged

Add chapter 08 — Conditional & Coalescing Sources (Case / Coalesce)#3
matthewhorridge merged 1 commit into
mainfrom
feat/case-coalesce-example

Conversation

@matthewhorridge

Copy link
Copy Markdown
Contributor

Adds a new example chapter demonstrating the Case and Coalesce combinator primitives (harmonization-framework PR bmir-radx/harmonization-framework#113).

What's new

Chapter 08 — Conditional & Coalescing Sources (examples/08-conditional-and-coalesce/):

  • Case on a unit flagweight_units (1=kg, 2=lbs) selects a per-branch conversion: lbs as-is, or kg→lbs.
  • Case with multi-operand branches — height as feet+inches OR meters+cm, each branch summing two converted operands via combine: sum.
  • Coalesce — age reported in years OR months (no flag); first populated source wins, months→years rounded.

Built to the chapter convention: build_rules.py is the source of truth; rules.json + rules.yaml; run_python.py / run_yaml.py / run_cli.sh; expected_output.csv golden master. All three interfaces pass and agree.

Reordering

The Clinical Intake Showcase moves from chapter 08 to 09, so the realistic blend-of-everything chapter stays last. Catalog table and chapter headers renumbered accordingly (git mv preserves the showcase's history).

Dependency

Requires the Case/Coalesce primitives, which are in bmir-radx/harmonization-framework#113 — merge that first.

🤖 Generated with Claude Code

New example chapter demonstrating the Case and Coalesce combinator primitives:
- Case on a unit flag (kg vs lbs) selecting a per-branch conversion
- Case with multi-operand branches (feet+inches / meters+cm summed via combine)
- Coalesce picking the first populated source (age in years OR months)

Built to the chapter convention (build_rules.py source of truth; rules.json
+ rules.yaml; run_python/run_yaml/run_cli; expected_output.csv golden master).
All three interfaces pass and agree.

The Clinical Intake Showcase moves from 08 to 09 so the realistic blend-of-all
chapter stays last. Catalog and chapter headers renumbered accordingly.

Requires the Case/Coalesce primitives (harmonization-framework PR #113).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant