-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
49 lines (45 loc) · 1.24 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
A CLI to segment customers
"""
import click
from datetime import datetime
from process.rfm import get_rfm
from process.statistics import get_statistics
@click.command()
@click.option(
"--start_date",
prompt="Analyze start date",
help="Start date to fetch data: 1 March 2022 -> '20220301'",
)
@click.option(
"--end_date",
prompt="Analyze end date",
help="End date to fetch data: 31 January 2023 -> '20230131'",
)
@click.option(
"--rfm_date",
prompt="RFM analyze date",
help="Analyze date for RFM analysis: 31 January 2023 -> '2023-01-31'",
)
@click.option(
"--statistics_date",
prompt="Statistical analyze date",
help="Analyze date for statistical analysis (BG-NBD & Gamma-Gamma): 31 January 2023 -> '2023-01-31'",
)
def main(
start_date="202180101",
end_date="20221231",
rfm_date="2022-01-01",
statistics_date="2022-01-01",
):
"""
An Example CLI
"""
BASE_PATH = "./data/"
RAW_PATH = BASE_PATH + "raw.pickle"
QUERY = "exec Proc '',''".format(start_date, end_date)
rfm_date = datetime.strptime(rfm_date, "%Y-%m-%d").date()
get_rfm(BASE_PATH, RAW_PATH, rfm_date)
get_statistics(BASE_PATH, RAW_PATH, statistics_date)
if __name__ == "__main__":
main()