Skip to main content

No project description provided

Project description

Rappi's WFM Team Data Analysis and Forecasting

This Python package provides functionality for data analysis and forecasting for Rappi's Workforce Management (WFM) system.

Installation

You can install the package using pip:

pip install wfrappi


# #The package includes functions for processing and preparing data for analysis.

# importar librerias
from wfrappi import data_processing as dp, modeling, order_distribution as od
import pandas as pd

# definir parametros
month="Agosto"
startdate = "2024-03-01"
FEATURES = ['dayofweek', 'quarter', 'month', 'year', 'dayofyear', 'dayofmonth', 'weekofyear']
year_month="2024-08"
TARGET = "SS" # or "BR"
SERVICE_USER_TYPE="Users"
SERVICE="Customer Live Orders"
REGION="SS" # or "BR"
concurrencia = 2  # concurrencia del servicio
sla = 0.8  # nivel de servicio
meta_aht = 10  
date_range=['2023-01-01', '2024-05-31']  

df_ordered = dp.read_and_sort_orders(date_range)
csv_path = "C:/Users/jonathan.marin/Documents/GitHub/rappi/wfm/Calendario Rappi - BD_Feriados.csv"
special = pd.read_csv(csv_path)
special=special.filter(['PAIS', 'FERIADO', 'Fecha', 'Criticidad'])
special['Fecha'] = pd.to_datetime(special['Fecha'], format='%d/%m/%Y').dt.date
special = special[special["PAIS"].isin(["CO","MX"])]
special = special[special["Criticidad"] == "Alto"]
special_days = special["Fecha"].to_list()

df_filtered = dp.filter_special_dates(df_ordered, special_days)

orders = dp.pivot_orders(df_filtered,REGION)
data = orders.set_index("FECHA")
train, test = dp.split_train_test_data(data, startdate)
train = dp.create_features(train)
test = dp.create_features(test)

X_train = train[FEATURES]
y_train = train[TARGET]
X_test = test[FEATURES]
y_test = test[TARGET]
model = modeling.train_xgboost_model(X_train, y_train, X_test, y_test)
predictions = modeling.make_predictions(model, X_test)
test['prediction'] = predictions

predictions = dp.create_future_predictions(model, FEATURES, '2024-08-01','2024-08-31', 'D')
month_to_predict = predictions
ordenes_financieras = od.create_ordenes_financieras(df_ordered, month_to_predict, ordenes_aprobadas=None, REGION=REGION , year_month=year_month)
curva_ordenes = od.create_curva_ordenes(df_ordered,REGION)
df3 = od.distribute_orders(ordenes_financieras, curva_ordenes)
print(df3.head())
# ajustar dias de festividades
# valor_a_ajustar = 1.30
# df3.loc[df3["FECHA"] == "2024-08-07", "CO"] *= valor_a_ajustar

inflow = dp.read_cr_aht(date_range)

result=od.distribute_inflow_intraday(inflow, df3, SERVICE_USER_TYPE, SERVICE, REGION)
result2 = od.distribute_aht_intraday(inflow, df3, SERVICE_USER_TYPE, SERVICE,REGION, result, meta_aht)

required_headcount_df = od.hc(result,result2,sla, concurrencia)
print(required_headcount_df.head(1))
print("Done!")

# License
# This project is licensed under a private license by Rappi Inc. Unauthorized copying, distribution, or modification of this project, via any medium, is strictly prohibited. For more details, please contact the legal department at Rappi.

## Contact Information
# For licensing inquiries, please reach out to:
# * **Email: legal@rappi.com**

# © 2024 Rappi Inc. Todos los derechos reservados

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

wfm_rappi_co-0.1.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file wfm_rappi_co-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wfm_rappi_co-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.13

File hashes

Hashes for wfm_rappi_co-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 239c950f0044d17a5184e004d5f88dee88e9bedc4f55fe2b6f24754801eca2ce
MD5 88c8f81166fbc2785857de90afebfba6
BLAKE2b-256 7215cbc3bd3f94d1aa81d56d9c58a996487fee713460f4f4cec956a0c8910fa4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page