STD_HIV_DATAMART - widen NBS177/NBS167 columns + page-aware codeset#871
Open
ericnagel wants to merge 22 commits into
Open
STD_HIV_DATAMART - widen NBS177/NBS167 columns + page-aware codeset#871ericnagel wants to merge 22 commits into
ericnagel wants to merge 22 commits into
Conversation
…MODERN].[dbo].[nrt_investigation_case_management]
ericbuckley
reviewed
Jun 6, 2026
| THEN ''('' + CAST(src_num_prec AS NVARCHAR) + '','' + CAST(src_num_scale AS NVARCHAR) + '')'' | ||
| WHEN src_data_type = ''varchar'' | ||
| THEN ''('' + CASE WHEN src_char_max_len = -1 THEN ''MAX'' ELSE CAST(src_char_max_len AS NVARCHAR) END + '')'' | ||
| ELSE '''' |
Contributor
There was a problem hiding this comment.
what about floats or datetimes, do we need when statements to handle those?
Contributor
Author
There was a problem hiding this comment.
Yes, probably, and I can add them but this modification was a major side-quest to the original issue. I'm not sure how far down that path to go - and I'm not sure how I'd test types that are not part of this process.
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.
Description
This change fixes decoding and truncation issues affecting follow-up referral and notification fields throughout the HIV reporting pipeline.
Previously, notification follow-up values could be stored as numeric-only codes (for example,
6or7) and several columns were too narrow to store the full decoded descriptions. This prevented downstream consumers from seeing the complete business meaning of the data and introduced truncation risk for longer HIV values such as:Changes Implemented
1. Increased column widths to prevent truncation
The following columns were widened from
varchar(15)tovarchar(100):STD_HIV_DATAMART
FL_FUP_ACTUAL_REF_TYPEFL_FUP_NOTIFICATION_PLANnrt_investigation_case_management
fl_fup_actual_ref_typefl_fup_notification_plan_cdD_CASE_MANAGEMENT
A guarded Liquibase migration (
261-alter_std_hiv_case_management_widths-001.sql) performs the required schema updates for existing environments.2. Updated HIV follow-up value decoding
Both Actual Referral Type (
FL_FUP_ACTUAL_REF_TYPE) and Notification Plan (FLD_FOLL_UP_NOTIFICATION_PLAN) inD_CASE_MANAGEMENTare now derived by decoding the stored code against the Notification Actual Method (HIV) value set.This behavior was reviewed and confirmed with EPI Emily Holman.
3. Full decoded values now flow through the reporting pipeline
FL_FUP_NOTIFICATION_PLANandFL_FUP_ACTUAL_REF_TYPEinSTD_HIV_DATAMARTnow contain the full decoded text rather than numeric-only values.Examples:
66 - Refused77 - Partner Not NotifiedThis provides complete business context to downstream reporting consumers and aligns reporting output with expected HIV follow-up terminology.
4. DM_INV_HIV width adjustment
DM_INV_HIV.FL_FUP_ACTUAL_REF_TYhas been increased to a length of 25 characters.Unlike the other reporting tables, this column was not expanded to 100 characters due to the size and performance considerations associated with the
DM_INV_HIVtable. A length of 25 characters is sufficient to accommodate the currently defined HIV notification-method descriptions, including:Validation
Verified in
RDB_MODERN:STD_HIV_DATAMART.FL_FUP_ACTUAL_REF_TYPElength = 100STD_HIV_DATAMART.FL_FUP_NOTIFICATION_PLANlength = 100nrt_investigation_case_managementfollow-up columns length = 100D_CASE_MANAGEMENTfollow-up columns length = 100DM_INV_HIV.FL_FUP_ACTUAL_REF_TYlength = 25Verified output now contains fully decoded values such as:
rather than numeric-only codes.
RDB
D_CASE_MANAGEMENT
STD_HIV_DATAMART
RDB_MODERN
D_CASE_MANAGEMENT
STD_HIV_DATAMART
Testing
All existing functional tests pass after updates made to various
expected.jsonfiles.Related Issue
APP-619
Additional Notes
Added a dedicated HIV fixture that verifies decoding of a long value such as:
Checklist