Your question is Transform and Filter Data. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
In an Informatica Cloud Data Integration interface, users need to preview records after applying configurable filters and field transformations. Implement transform_records to filter an array of record objects and return transformed copies without mutating the input.
The function receives records, a list of dictionaries, and criteria, a dictionary containing any of these optional keys:
allowed_statuses: list of accepted status strings. A record passes when its status is included.min_score: numeric lower bound, inclusive. Records without a numeric score fail this filter.required_tags: list of tags. A record must contain every required tag in its tags array.name_contains: case-insensitive substring that must occur in the record's name.include_fields: fields to retain in each output record. If omitted, retain all fields.rename: mapping from source field names to output field names. Apply this only to retained fields.All specified filters must pass. Preserve record order. Missing fields fail only the filter that requires them. Return a new list and do not mutate any input dictionary.
def transform_records(records, criteria):