Find open items the handoff summary dropped

Agent buildEasy10 min

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:

  1. Normalize every id on both sides: trim spaces and tabs from both ends, then uppercase it. So " inc-4102 " becomes "INC-4102".
  2. An open id that is empty after normalizing is ignored. So is an empty mention.
  3. An open id is covered only by a mention that is exactly equal to it after normalizing. INC-5-FOLLOWUP does not cover INC-5.
  4. 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
Inputfind_missing_handoff_items(["INC-4102", "INC-4118", "CHG-2201"], ["INC-4102", "CHG-2201"])
Output["INC-4118"]
Example 2
Inputfind_missing_handoff_items(["INC-4102", "INC-4118"], ["inc-4118", " INC-4102 "])
Output[]
Example 3
Inputfind_missing_handoff_items([], ["INC-4102"])
Output[]