Which document in the health record serves as the primary source for assigning the principal diagnosis in an inpatient stay?