feat(ogar-emitter): OptionFlagToOptionBool + TruncateDate FieldSource variants (medcare-rs W4)#215
Merged
Merged
Conversation
…urce variants
Two additive projection-codegen transforms, driven by the medcare-rs read-arm
W4 hand-off (docs/handoffs/W4-ogar-fieldsource-variants.md in medcare-rs). The
FieldSource vocabulary is documented to "grow deliberately when a new consumer
needs a transform not here" — these are exactly that:
- OptionFlagToOptionBool { column } -> `r.col.map(|v| v != 0)`
(`Option<iN>` flag -> `Option<bool>`; the nullable sibling of IntFlagToBool).
Unblocks the `dms` projection (6 `Option<i8>` -> `Option<bool>` fields).
- TruncateDate { column } -> `r.col.date()`
(`NaiveDateTime` -> `NaiveDate`, non-optional; the non-Option sibling of
MapNaiveDate). Unblocks the `lab_order` projection (`measured_on`).
Both reproduce a spelling already present in the hand-written medcare
projections byte-for-byte, so the value oracle replays green. No existing
variant, golden, or emitter behaviour changes. New unit test asserts both
arms render the exact hand-written RHS.
Generated by Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two additive
FieldSourcevariants inogar-emitter's projection-adapter codegen, driven by the medcare-rs read-arm W4 hand-off (docs/handoffs/W4-ogar-fieldsource-variants.mdin medcare-rs). TheFieldSourcedoc-comment already states the set "grows deliberately … when a new consumer needs a transform not here … Derived from the real Pattern-A projections in medcare-rs" — these are exactly that.Option<iN>/typeOptionFlagToOptionBool { column }r.col.map(|v| v != 0)Option<iN>flag →Option<bool>(nullable sibling ofIntFlagToBool)dms(6Option<i8>→Option<bool>fields)TruncateDate { column }r.col.date()NaiveDateTime→NaiveDate, non-optional (non-Optionsibling ofMapNaiveDate)lab_order(measured_on)Both reproduce a spelling already present in the hand-written medcare projections byte-for-byte, so the value oracle replays green. No existing variant, golden, or emitter behaviour changes.
Consumer follow-up (medcare-rs, after this lands)
Add
dms_projection_class()+lab_order_projection_class()recipes +generated_body_matches_handwritten_*parity tests tomedcare-analytics/src/projection_codegen.rs, then adopt live (include!the generatedFrom, delete the hand-roll) — the pathpatientalready took.Verification
cargo test -p ogar-emitter→ 39 passed (incl. newoption_flag_and_truncate_date_render_the_handwritten_spelling);cargo fmt --check+cargo clippyclean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Mwq1QKpw4zRd6oaGRoJhF2
Generated by Claude Code