Depends, @Clowson. If the condition is chronic (e.g. diabetes), each new diagnosis code is irrelevant – the patient is unlikely to get rid of the disease. If the condition is acute (e.g. asthma attack) each new code is a new onset. And everything else inbetween – you’d have to create some heuristic, like a typical duration or a gap after which you believe this is a new one (e.g. 7 days for an MI, after that gap it is a reinfarction or a new attack).
Resolution of a disease: I have yet to see a single data source where that is reliably captured. When the patients feel better they just stop showing up. Nobody comes to a visit for a healed disease.