Formatting patient history output JSON