Public-Health-Scotland / source-linkage-files

This repo is for the syntax used for the PHS Source Linkage File project
https://public-health-scotland.github.io/source-linkage-files/
Other
4 stars 2 forks source link

Review the `attendance_status` variable #625

Open Moohan opened 1 year ago

Moohan commented 1 year ago

The attendance_status variable comes from GPOoHs (Consultation Recorded) and Outpatients (Clinic Attendance (Status) Code).

It was tidied up in this commit https://github.com/Public-Health-Scotland/source-linkage-files/commit/192a5c293b7d7b6855ed1702ed079d0854ab0b18 so that it now uses the SMR codes / definitions.

At one point the SLF team had discussed using factors to store these types of variables with (numeric) codes so that we could have the labels alongside. I think we moved away from the factor idea as 1) It doesn't really work for codes which are not exclusively numeric 2) Working with factors might not be obvious to users 3) It has the potential to break a lot of existing code in non-obvious ways.

The issue was not taken forward 'fully' due to attendance_status being used in the deaths cleanup code. https://github.com/Public-Health-Scotland/source-linkage-files/blob/f047aab76a4f6b4ceec3d33e0a7a5020ee43f5c9/_SPSS_archived/2014-15/C06%20Death%20fixes.sps#L33

This issue is now probably redundant as the deaths cleanup has been handled differently and I don't think you'll want to change the coding of attendance_status. It would be worth a look through the code - following attendance_status and just making sure it still makes sense and is consistent.

All uses of attendance_status

Old issue text We should probably change the GP OoH `attendance_status` (`"Consultation Recorded"`) and the outpatient `attendance_status` ("Clinic Attendance (Status) Code") to both be a factor with something like: `factor(, levels = c("Y", "N"), labels = c("Patient Seen", "DNA"))` and `factor(, levels = c(1, 5, 8), labels = c("Patient Seen", "CNW", "DNA"))`. But this would also involve tweaking some other code which uses the 1 / 8 values, so out of scope for this PR. For now, I think it's sufficient to alter the GP OoH values this just needs to be done at the right place.
github-actions[bot] commented 12 months ago

This issue is stale because it has been open approximately 5 months with no activity.

Moohan commented 2 months ago

@SwiftySalmon I update the issue description above.