A principal diagnosis is the [[diagnosis]] established after [[study]] to be chiefly responsible for occasioning an episode of admitted patient care, an episode of residential care or an attendance at a health care establishment, as represented by a code.