Rename person_employments, add end date logic #1459
Merged
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.
Context
Having done analysis on the last 4 months TPS data extracts and got answers from Capita about various quirks, we are now in a position to draw a line on the initial phase of the workforce data import.
Changes proposed in this pull request
Rename the
person_employments
table in TRS totps_employments
.Add a
withdrawal_confirmed
field to thetps_employments
table (so this can be passed on to BQ in case it is needed in future).Where the end date in the extract file is in the future, use the extract date as the last known employed date.
Amend the logic used on the TPS import to include ageing the data
Set the end date to the last known employed date when we get a W indicator
Set the end date to the last known employed date when the last known employed date is greater than 5 months after the extract date
Reset the end date to NULL if the W indicator is removed in a future extract for a given TRN / LA Code / Establishment Number / Start Date (as long as the last known TPS employed date is less than 5 months after the extract date)
Reset the end date to NULL if the last known TPS employed date for a given TRN / LA Code / Establishment Number / Start Date is less than 5 months after the extract date
Checklist