Find open items the handoff summary dropped
Your task
Shift change is where incidents get dropped. An agent drafts the on-call handoff, and before the draft is sent, a check finds every open item it forgot to mention.
Write find_missing_handoff_items(open_item_ids, mentioned_ids): the check every handoff draft passes through.
open_item_ids(list of str): ids of the items still open at the end of the shift, such as"INC-4118".mentioned_ids(list of str): the ids the draft mentions.- Return the open ids the draft does not mention, normalized, each once, sorted in ascending order. An empty list means the draft is safe to send.
Rules:
- Normalize every id on both sides: trim spaces and tabs from both ends, then uppercase it. So
" inc-4102 "becomes"INC-4102". - An open id that is empty after normalizing is ignored. So is an empty mention.
- An open id is covered only by a mention that is exactly equal to it after normalizing.
INC-5-FOLLOWUPdoes not coverINC-5. - Mentions of ids that are not open are ignored.
Examples
find_missing_handoff_items(open_item_ids: list[str], mentioned_ids: list[str]) -> list[str]Example 1
Input
find_missing_handoff_items(["INC-4102", "INC-4118", "CHG-2201"], ["INC-4102", "CHG-2201"])Output
["INC-4118"]Example 2
Input
find_missing_handoff_items(["INC-4102", "INC-4118"], ["inc-4118", " INC-4102 "])Output
[]Example 3
Input
find_missing_handoff_items([], ["INC-4102"])Output
[]