Transaction Type Overview
Every record in the CoBHRM system must specify aTRANSACTION_TYPE that indicates the intended operation:
Primary Keys
Each schema uses a composite primary key to uniquely identify records. The primary key always includesRECORD_TYPE plus the appropriate identifier:
EFFECTIVE_DATE is not part of the primary key. It is used for versioning (SCD Type 2) to determine which record is most recent. See How Most-Recent Records Are Determined below.Transaction Type Details
Add (A)
UseTRANSACTION_TYPE = 'A' to create a new record.
Behavior:
- Creates a new record with the specified primary key
- Fails if a record with the same primary key already exists
- All required fields must be provided
- New client enrollment
- New treatment episode admission
- Adding a diagnosis to an admission
Update (U)
UseTRANSACTION_TYPE = 'U' to modify an existing record.
Behavior:
- Locates the existing record by primary key
- Creates a new version with the updated values
- Preserves the original record for historical purposes (SCD Type 2)
- Fails if no matching record exists
- Updating client demographics (address change, phone number)
- Adding information discovered after initial submission
Replace (R)
UseTRANSACTION_TYPE = 'R' to completely overwrite the most recent record.
Behavior:
- Locates the most recent record for the entity
- Completely replaces it with the new values
- Used for error corrections where the original submission was incorrect
- Fails if no matching record exists
- Correcting a data entry error in the most recent submission
- Fixing an invalid code value
- Replacing a record submitted with incorrect identifiers
Slowly Changing Dimensions (SCD Type 2)
The CoBHRM system uses SCD Type 2 for maintaining historical records:- All historical records are retained - nothing is deleted
- Each record version is effective-dated - determined by
EFFECTIVE_DATE - Current record = record with the most recent
EFFECTIVE_DATE - Updates create new versions rather than modifying in place
Example: Client Address Change
- Record effective 2024-01-15 with address “123 Main St” (historical)
- Record effective 2024-03-01 with address “456 Oak Ave” (current)
Idempotency
File submissions are idempotent for Add operations. Submitting the same Add record twice will fail on the second submission (duplicate key error), not create a duplicate record.
How Most-Recent Records Are Determined
The CoBHRM system determines the “current” version of a record differently depending on the record level:Because the system is insert-only (SCD Type 2), all historical records are retained. The “most recent” determination is used for querying current state, not for deleting prior versions.
Error Handling
Best Practices
Use Add for New Records
Always use transaction type
A when creating records for the first timeUse Update for Changes
Use
U with a new effective date for legitimate data changes over timeReserve Replace for Corrections
Only use
R to fix errors in the most recent submissionInclude All Fields
All transaction types require all required fields, even Update and Replace