def add_feature_rate_portfolio_type(profile_updated_df):
    """
    Create features
        - Total Count of the offer received, reviewed, completed for each type of portfolio (bogo, discount, and informational)
        - Rates for each offering type (bogo/discount/informational) :
            - rate_review = total reviewed / total received
            - rate_completed_reviewed = total completed / total reviewed
            - rate_completed_received = tatal completed / total received

    """
    profile_updated = profile_updated_df.copy()

    for offer in ['bogo', 'discount', 'informational']:
        received_cols = profile_updated.columns[(profile_updated.columns.str.contains('received_' + offer)) & \
                                                (~profile_updated.columns.str.contains('rate' ))].tolist()
        profile_updated[offer +'_received'] = profile_updated[received_cols].sum(axis=1).fillna(0)

        viewed_cols = profile_updated.columns[(profile_updated.columns.str.contains('viewed_' + offer)) & \
                                                (~profile_updated.columns.str.contains('rate'))].tolist()
        profile_updated[offer +'_viewed'] = profile_updated[viewed_cols].sum(axis=1).fillna(0)

        profile_updated['rate_viewed_' + offer] = (profile_updated[offer +'_viewed'] / profile_updated[offer +'_received']).fillna(0)

        if offer != 'informational':
            completed_cols = profile_updated.columns[(profile_updated.columns.str.contains('completed_' + offer)) & \
                                                (~profile_updated.columns.str.contains('rate' ))].tolist()
            profile_updated[offer +'_completed'] = profile_updated[completed_cols].sum(axis=1).fillna(0)

            profile_updated['rate_completed_viewed_' + offer] = \
                        (profile_updated[offer +'_completed'] /profile_updated[offer +'_viewed']).fillna(0)
            profile_updated['rate_completed_received_' + offer] = \
                        (profile_updated[offer +'_completed'] / profile_updated[offer +'_received']).fillna(0)

    return profile_updated