Public-Health-Scotland / phsmethods

An R package to standardise methods used in Public Health Scotland (https://public-health-scotland.github.io/phsmethods/)
https://public-health-scotland.github.io/phsmethods/
54 stars 14 forks source link

add triplicate ID function for nrs records #113

Open ekm87 opened 1 year ago

ekm87 commented 1 year ago

Is your feature request related to a problem? Please describe. NRS live births, NRS stillbirths and GRO infant deaths on smra all have three fields that uniquely identify records, when combined. At the moment analysts have to manually combine the fields to create the triplicate ID, and add a prefix to indicate whether it relates to a live or stillbirth. Whilst it is not onerous to do manually, there is potential for error in the padding of fields, or for the prefix not to be added, which becomes a problem if working with both live and stillbirths records so it would be safer to have a standard field.

Describe the solution you'd like A function to concatenate the three fields together. The user will have to specify in the function which database they are using to apply the correct prefix. Field names need to be specifiable (although function could also contain default names from the databases).

I can write the function but will need help with documentation, testing etc.

Describe alternatives you've considered

Additional context