Skip to content

Instantly share code, notes, and snippets.

View rdpapworth's full-sized avatar

Richard Papworth rdpapworth

  • Glasgow, Scotland
View GitHub Profile
@rdpapworth
rdpapworth / smr_cis_label.sql
Created September 28, 2018 15:09
Create a poor mans continuous inpatient stay within Scottish SMR01 data
-- Continuous Inpatient Stay (CIS) is an identifier for an unbroken period of time that
-- a patient spends as an inpatient. A patient may change consultant, significant
-- facility, speciality and/or hospital during a continuous inpatient stay. CIS can
-- be provided with Scottish SMR datasets. However, there are various rules associated
-- with CIS assignment that don't always map to study requirements (or are not
-- implemented correct - especially with older SMR records). The code below assigns
-- a naive CIS to an SMR dataset. That is, a given CIS will be assigned to contiguous
-- records based soley on date. No consideration is given to origin of record or type
-- of admission.