Routinely collected electronic health record data is increasingly being used as a fast and inexpensive way to investigate different diseases. Often these diseases are identified by “diagnostic codes” which are assigned to every admission to hospital, either as the primary code (“the main condition treated or investigated during the relevant episode of healthcare”) or as one or more secondary codes (“all conditions that coexist at the time of admission, that develop subsequently, or that affect the treatment received and/or the length of stay”). Microorganisms causing infections would get secondary codes, but these could also include things like diabetes. These codes are assigned by experienced teams in hospitals, but their primary purpose is to make sure that hospitals receive the right amount of money for the patients that they are treating, not to study diseases.
See publication: Combining Charlson and Elixhauser scores with varying lookback predicted mortality better than using individual scores