Odds things that might fit into mappers :thread:
# plugins-general
v
Odds things that might fit into mappers ๐Ÿงต
Copy code
def password(self):
        random_chars = list("abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789")
        return ''.join(random.choices(random_chars, k=8))
Copy code
def samaccountname(self, firstname, lastname, preferredname):
        if preferredname:
            return f"{preferredname}_{lastname}"
        else:
            return f"{firstname}_{lastname}"
Copy code
def calculated_active(status, hiredate, employeestatusdate):
        date_to_use = hiredate
        if hiredate is None: date_to_use = employeestatusdate
        if (status == "Active" and (datetime.date.today() >= date_to_use-datetime.timedelta(days=14))) or (
                (employeestatusdate == datetime.date.today())):
                    return True
        else:
            return False
had to remove some comments and stuff for some of these so it may be hard to get (maybe not)
Copy code
def manager(manager_bamboohr_id, ad_df):
        filtered_ad_df = ad_df[ad_df["ad_employeeid"] == manager_bamboohr_id]
        if (len(filtered_ad_df)> 1):
            print(f"Found more than one match for {manager_bamboohr_id=}, there must be duplicate employeeids in AD")
        elif (len(filtered_ad_df) == 1):
            return filtered_ad_df["ad_distinguishedname"].values[0]
        else:
            return None
Here's where we get a little complicated
There's more like group mappings and things that are harder but those are the easy ones to share without giving up pii
Note that interrelation between "streams" (dataframes) and some of these rules. I may pass in a few different dataframes here
@aaronsteers here you go ๐Ÿ™‚