You are given a stream of events, each represented as a JSON object. Every event has an event_type (either "fraud_flag" or "underwriting"), a user_id, and a payload dictionary that contains various fields. Some of the fields in the payload are labeled as PII (personally identifiable information) and are listed in a global array PII_FIELDS.
Your task is to process this stream in the exact order received and, for every underwriting event, output true if any of the PII values inside its payload already appeared in a previous fraud_flag event’s payload (no matter which fraud_flag event), otherwise output false. A bug exists in the starter code: the helper extractPII adds the field name (key) to the set instead of the field value. You must first fix this bug, then implement the logic above.
You should write a function or class that accepts the event stream and returns the list of booleans corresponding to each underwriting event in the order they arrive.