Skip to content

LEGLINK-639: Terminology reads value-set membership status - #1769

Merged
MikeAtPinnacle merged 1 commit into
devfrom
users/mtherien/leglink-639-valueset-verification
Jul 29, 2026
Merged

LEGLINK-639: Terminology reads value-set membership status#1769
MikeAtPinnacle merged 1 commit into
devfrom
users/mtherien/leglink-639-valueset-verification

Conversation

@MikeAtPinnacle

@MikeAtPinnacle MikeAtPinnacle commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

🛠️ Description of Changes

Extends the optional Status (active/inactive) column support from CodeSystem CSV files to ValueSet CSV files, so value-set membership status is honored independently of code-system status.

Per Irene Zhuo, value-set membership carries its own active/inactive status: an intensional value set is expanded from a code system, and a code can remain active in the code system yet be dropped from the value set's membership. When a member carries a membership status it is authoritative and overrides the code system; a member with no membership status falls back to the existing code-system rejoin (LEGLINK-580 behavior).

  • Added ValueSetCode : Code carrying its own CodeStatus.
  • CsvValueSetRecord gains an optional [Index(3)] Status column ([Default(Active)] + [EnumIgnoreCase]), mirroring CsvCodeSystemRecord.
  • CodeGroupCacheService.ProcessValueSetCsv now accepts 3 or 4 columns (system,code,display[,status]) and selects the member type by header width — 4-col → ValueSetCode, 3-col → plain Code. This also fixes a latent bug where a 4-column value-set file threw in ProcessValueSetCsv and was silently swallowed by LoadCache, leaving that value set absent from the cache.
  • CodeGroupCacheService.LoadCache now tolerates a missing trailing field for ValueSet (not just CodeSystem).
  • FhirService.ResolveIsActive treats a ValueSetCode status as authoritative, falling through to the code-system rejoin only for plain Code members.

This is a Terminology-service-only change. The terminology service already emits the same Code is inactive. OperationOutcome whenever a code is inactive, so value-set-membership inactivation surfaces and categorizes through the identical Validation path — no Java, categories.json, app-config.yaml, or migration changes.

🧪 Testing Performed

  • Ran the Terminology unit suite: dotnet test DotNet/ServiceTests/ServiceTests.csproj --filter "FullyQualifiedName~Terminology"62/62 passing (includes the new value-set tests below and the existing CodeSystem/rejoin coverage).
  • Verified the branch builds clean and rebased onto the latest dev (including LEGLINK-814 duplicate-CSV-code handling) with tests still green.

🧑‍🔬 Unit Testing

  • Coverage: 100.0%

  • CodeGroupCacheServiceTests.LoadCache_ValueSetWithStatusColumn_LoadsValueSetCodeWithStatus — 4-col file loads ValueSetCode with the file's Active/Inactive status.

  • CodeGroupCacheServiceTests.LoadCache_ValueSetBlankStatus_DefaultsToActive — blank status defaults to Active.

  • CodeGroupCacheServiceTests.LoadCache_ValueSetNoStatusColumn_LoadsPlainCode — 3-col file loads plain Code (no membership status → rejoin path preserved).

  • CodeGroupCacheServiceTests.LoadCache_ValueSetMixedCaseStatus_ParsesCaseInsensitively — mixed-case status parses correctly.

  • FhirServiceTests.ValidateCodeInValueSet_ValueSetCodeInactive_OverridesActiveCodeSystem_ReturnsInactiveIssue — inactive membership overrides an active code system.

  • FhirServiceTests.ValidateCodeInValueSet_ValueSetCodeActive_OverridesInactiveCodeSystem_ReturnsNoIssue — active membership overrides an inactive code system.

  • Updated ProcessValueSetCsv_InvalidColumnCount_ThrowsException (4 columns is now valid; asserts on a 5-column header) and switched ProcessValueSetCsv_WithValidData_CallsSetCodeGroup to the shared CreateCsvReader helper.

📓 Documentation Updated

No documentation changes required — this is a data-format extension to an existing feature with no new config keys or public API surface.

Summary by CodeRabbit

  • New Features

    • ValueSet CSV files now support an optional membership status column.
    • Membership statuses are parsed case-insensitively, default to Active when blank or omitted, and can override the underlying CodeSystem status.
    • ValueSet entries without a status continue to load as standard codes.
  • Bug Fixes

    • Code activity validation now correctly honors ValueSet membership status when determining whether a code is active.

ValueSet CSV files may now carry an optional trailing Status column
(system,code,display,status), mirroring the CodeSystem support added in
LEGLINK-541/580. Value-set membership status is independent of the code
system: a code can remain active in its code system yet be dropped from a
value set's membership. When a member carries a membership status it is
authoritative and overrides the code system; a member with no membership
status falls back to the code-system rejoin (LEGLINK-580 behavior).

- Add ValueSetCode : Code carrying its own CodeStatus.
- CsvValueSetRecord gains an optional [Index(3)] Status column
  ([Default(Active)] + [EnumIgnoreCase]).
- ProcessValueSetCsv accepts 3 or 4 columns and selects the member type by
  header width (4-col -> ValueSetCode, 3-col -> plain Code). This also fixes
  a latent bug where a 4-column value-set file threw and was silently
  swallowed by LoadCache, leaving that value set absent from the cache.
- LoadCache tolerates a missing trailing field for ValueSet as well.
- FhirService.ResolveIsActive treats a ValueSetCode status as authoritative,
  falling through to the code-system rejoin only for plain Codes.

Testing: 59/59 Terminology unit tests pass, including 4 new value-set
status-parsing tests and 2 override-semantics tests.
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
Title check ✅ Passed The title is concise and accurately summarizes the main change: reading terminology value-set membership status.
Description check ✅ Passed The PR description follows the template and includes changes, testing, unit tests, and documentation notes.

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

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

@MikeAtPinnacle MikeAtPinnacle self-assigned this Jul 29, 2026
@MikeAtPinnacle
MikeAtPinnacle marked this pull request as ready for review July 29, 2026 14:31
@MikeAtPinnacle
MikeAtPinnacle merged commit 015ca41 into dev Jul 29, 2026
20 checks passed
@MikeAtPinnacle
MikeAtPinnacle deleted the users/mtherien/leglink-639-valueset-verification branch July 29, 2026 15:47
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