opensafely/ethnicity-covid-research

Simple algorithm to assign diabetes type

Closed this issue · 16 comments

For discussion:

If person only has T1DM codes AND No T2DM codes→ T1DM

If person has T2DM codes AND No T1DM codes → T2DM

If person has T1DM and T2DM codes OR T1DM and unknown codes OR unknown codes only
AND
Prescribed insulin
AND
Not prescribed oral antidiabetic drugs → T1DM

If person has T1DM and T2DM codes OR T2DM and unknown codes
AND
Number of T2DM codes > Number of T1DM codes/Number of unknown codes
AND
Prescribed OAD → T2DM

If person has unknown codes only
AND
Not prescribed insulin
AND
Prescribed OAD → T2DM

Else → DM type unknown

Re #6 we need to consider this algorithm before we decide on our lists. What did you do to deal with the "post-pancreatectomy hypoinsulinaemia" and "insulin autoimmune syndrome" in your CPRD algorithm. I can see the options are:

  1. Keep these diagnoses in unknown list and then decide they are most similar to type 1 or type 2 depending on the medication

  2. Create a 4th list of non-type 1 or 2 or unknown list called known causes and use in algorithm

  3. Exclude these codes entirely

@CarolineMorton we didn't include "post-pancreatectomy hypoinsulinaemia" in the codelist for diabetes and defined "insulin autoimmune syndrome" as "other diabetes" (ie/ not type 1 or type 2)
So we could exclude both these codes entirely and put them into a different codelists for 'Other non t1/t2 diabetes' which I wouldn't need for this study, but could be useful going forward.

I've attached the diabetes codes and categories we used in our CPRD algorithm, but these have not been updated since 2012 so would need a refresh.

UKB_CPRD_Diabetes_Codes.xlsx

Yes we should exclude them then. I have slightly run out of time to do this and don't want to delay. @HenryDrysdale are you around to do this? if not, I can try for Friday or Monday

I think we should leave the CPRD codes for now but we need to manually exclude the definitely not type 1, type 2 or unknowns from the unknown list

@CarolineMorton @rohinimathur Sure, I can do this. I will exclude these "other diabetes" codes as distinct from "DM unknown". (note: conditions like gestational diabetes would also come under "other diabetes").

Rohini, is this the "DM_unknown" codelist on #6? If not, please send a link or post the list here. Once that's done, shall I upload those three lists (type 1, type 2, unknown) to the opensafely codelists site?

@HenryDrysdale Yes all three codelists are on #6. For clarity we should probably rename 'unknown' as 't1 t2 unknown'.
Agree gestational diabetes etc are 'other'.

@CarolineMorton @rohinimathur Here are the updated lists:

  • Type 1 DM. This is straightforward, with all codes explicitly type 1 DM.
    Opensafely_codelist_T1DM_HD.xlsx

  • Type 2 DM. This is also clear, all codes explicitly type 2 DM.
    Opensafely_codelist_T2DM_HD.xlsx

  • DM unknown type. I have removed codes which represent "other diabetes" rather than "unknown" (these are the two codes mentioned above, and CF related diabetes). All remaining codes have some degree of ambiguity. I have left in the codes which mention "oral treatment only" or "diet control only": although these probably represent type 2 DM and not type 1, they could also be another type like gestational.
    Opensafely_codelist_DM_unknown_HD.xlsx

  • DM other. This is just the codes removed from the "unknown" list above, and not a complete list of "other diabetes".
    Opensafely_codelist_otherDM_HD.xlsx

@HenryDrysdale @CarolineMorton Many thanks!
Once signed off I can upload T1DM, T2DM, DM unknown to the opensafely codelists website.

Happy for these to be uploaded to opensafely codelists website. Thanks @rohinimathur

These are now uploaded.

For discussion:

If person only has T1DM codes AND No T2DM codes→ T1DM

If person has T2DM codes AND No T1DM codes → T2DM

If person has T1DM and T2DM codes OR T1DM and unknown codes OR unknown codes only
AND
Prescribed insulin
AND
Not prescribed oral antidiabetic drugs → T1DM

If person has T1DM and T2DM codes OR T2DM and unknown codes
AND
Number of T2DM codes > Number of T1DM codes/Number of unknown codes
AND
Prescribed OAD → T2DM

If person has unknown codes only
AND
Not prescribed insulin
AND
Prescribed OAD → T2DM

Else → DM type unknown

With regards to the medication, are you interested in "ever prescribed" or "in last X period"?

Number of T2DM codes > Number of T1DM codes/Number of unknown codes
AND

This is going to be difficult and computationally expensive to do. I would suggest we leave this out, rather than counting every code which could be hundred over a few million people.

Fine with me - from previous experience it would only apply to a small number of people.

In discussion with @rohinimathur, we have also done:

  • unknown codes only PLUS insulin AND oral medication --> unknown

Is it possible to get date of first DM code easily? If it is, then insulin in <3years of that date is T1DM
If first insulin>5 year after date of first DM code is likely T2DM. Between 3 & 5 years, I'd be less sure but you would know better.

Is it possible to get date of first DM code easily? If it is, then insulin in <3years of that date is T1DM
If first insulin>5 year after date of first DM code is likely T2DM. Between 3 & 5 years, I'd be less sure but you would know better.

It is possible yes- there are concerns around 'weight of evidence' for diabetes, in that people often have multiple and conflicting diabetes diagnostic codes on their primary care record, and so you need to parse through them in a logical manner. Exeter team have developed algorithm looking at being on current insulin, which is similar to your suggestion and we are meeting with them soon hopefully.

I understand the thing we're waiting for now for the diabetes algorithm is an OAD codelist - @brianmackenna is there any chance of getting this? We're really keen to use this variable definition in the snotty noses kids study, which is almost ready to run.