yeref 0.24.64__tar.gz → 0.24.65__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {yeref-0.24.64 → yeref-0.24.65}/PKG-INFO +1 -1
- {yeref-0.24.64 → yeref-0.24.65}/setup.py +1 -1
- {yeref-0.24.64 → yeref-0.24.65}/yeref/yeref.py +64 -1
- {yeref-0.24.64 → yeref-0.24.65}/yeref.egg-info/PKG-INFO +1 -1
- {yeref-0.24.64 → yeref-0.24.65}/pyproject.toml +0 -0
- {yeref-0.24.64 → yeref-0.24.65}/setup.cfg +0 -0
- {yeref-0.24.64 → yeref-0.24.65}/yeref/__init__.py +0 -0
- {yeref-0.24.64 → yeref-0.24.65}/yeref/l_.py +0 -0
- {yeref-0.24.64 → yeref-0.24.65}/yeref/tonweb.js +0 -0
- {yeref-0.24.64 → yeref-0.24.65}/yeref.egg-info/SOURCES.txt +0 -0
- {yeref-0.24.64 → yeref-0.24.65}/yeref.egg-info/dependency_links.txt +0 -0
- {yeref-0.24.64 → yeref-0.24.65}/yeref.egg-info/top_level.txt +0 -0
@@ -16372,7 +16372,6 @@ async def return_cohort_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
|
|
16372
16372
|
row.append(str(row_sum))
|
16373
16373
|
table.append(row)
|
16374
16374
|
|
16375
|
-
# Записываем CSV
|
16376
16375
|
path = os.path.join(EXTRA_D, "3_cohort_metrics.csv")
|
16377
16376
|
with open(path, "w", newline="", encoding="utf-8") as f:
|
16378
16377
|
writer = csv.writer(f)
|
@@ -16391,6 +16390,70 @@ async def return_retention_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
|
|
16391
16390
|
sql = 'SELECT USER_TID, USER_VARS, USER_LSTS FROM "USER"'
|
16392
16391
|
data_users = await db_select_pg(sql, (), BASE_P)
|
16393
16392
|
|
16393
|
+
months = ["2025-06", "2025-07", "2025-08", "2025-09"]
|
16394
|
+
data_users = []
|
16395
|
+
for _ in range(20):
|
16396
|
+
# дата входа
|
16397
|
+
entry_month = random.choice(months)
|
16398
|
+
entry_day = random.randint(1, 28)
|
16399
|
+
entry_date = f"{entry_month}-{entry_day:02}"
|
16400
|
+
entry_dt_obj = datetime.strptime(entry_date, '%Y-%m-%d')
|
16401
|
+
entry_dt = f"{entry_dt_obj.strftime('%d-%m-%Y')}_{datetime.now().strftime('%H-%M-%S')}"
|
16402
|
+
utm = random.choice(["/start", "/startapp"])
|
16403
|
+
|
16404
|
+
# месяцы от входа и дальше
|
16405
|
+
valid_months = [m for m in months if datetime.strptime(m + "-01", "%Y-%m-%d") >= entry_dt_obj.replace(day=1)]
|
16406
|
+
if not valid_months:
|
16407
|
+
valid_months = [entry_month]
|
16408
|
+
|
16409
|
+
user_mau = sorted(random.sample(valid_months, k=random.randint(1, len(valid_months))))
|
16410
|
+
user_dau_dates = set()
|
16411
|
+
txs, payments = [], []
|
16412
|
+
|
16413
|
+
# платеж
|
16414
|
+
if user_mau:
|
16415
|
+
pay_month = random.choice(user_mau)
|
16416
|
+
pay_day = random.randint(1, 28)
|
16417
|
+
pay_date = f"{pay_month}-{pay_day:02}"
|
16418
|
+
dt_pay = datetime.strptime(pay_date, "%Y-%m-%d")
|
16419
|
+
# if dt_pay >= entry_dt_obj:
|
16420
|
+
payments = [{
|
16421
|
+
"TYPE": random.choice(["don", "sub", "pst"]),
|
16422
|
+
"DT_START": f"{dt_pay.strftime('%d-%m-%Y')}_14-00-00",
|
16423
|
+
"DT_END": "0",
|
16424
|
+
"AMOUNT": str(random.randint(1, 10))
|
16425
|
+
}]
|
16426
|
+
user_dau_dates.add(pay_date)
|
16427
|
+
|
16428
|
+
# вход в приложение
|
16429
|
+
user_dau_dates.add(entry_date)
|
16430
|
+
for m in user_mau:
|
16431
|
+
day = random.randint(1, 28)
|
16432
|
+
visit = f"{m}-{day:02}"
|
16433
|
+
dt_visit = datetime.strptime(visit, "%Y-%m-%d")
|
16434
|
+
if dt_visit >= entry_dt_obj and random.random() < 0.7:
|
16435
|
+
user_dau_dates.add(visit)
|
16436
|
+
|
16437
|
+
# статусы (отток) с низкой вероятностью
|
16438
|
+
USER_STATUSES = []
|
16439
|
+
if random.random() < 0.2: # 10% шанс оттока
|
16440
|
+
churn_month = random.choice(valid_months)
|
16441
|
+
churn_day = random.randint(1, 28)
|
16442
|
+
churn_date = f"{churn_month}-{churn_day:02}"
|
16443
|
+
churn_ts = datetime.strptime(churn_date, "%Y-%m-%d").strftime("%d-%m-%Y") + "_23-59-59"
|
16444
|
+
USER_STATUSES = [{random.choice(["left", "kicked"]): churn_ts}]
|
16445
|
+
|
16446
|
+
user_dau = sorted(user_dau_dates)
|
16447
|
+
wallet = f"wallet{random.randint(1, 100)}" if txs else random.choice([f"wallet{random.randint(1, 100)}", ""])
|
16448
|
+
|
16449
|
+
data_users.append((
|
16450
|
+
random.randint(100000, 999999),
|
16451
|
+
json.dumps({"USER_WALLET": wallet, "USER_UTM": utm, "USER_DT": entry_dt}),
|
16452
|
+
json.dumps({"USER_DAU": user_dau, "USER_MAU": user_mau, "USER_TXS": txs,
|
16453
|
+
"USER_PAYMENTS": payments, "USER_STATUSES": USER_STATUSES})
|
16454
|
+
))
|
16455
|
+
print(f"gen {data_users=}")
|
16456
|
+
|
16394
16457
|
# собираем выручку по пользователю и месяцу
|
16395
16458
|
user_month_rev = defaultdict(lambda: defaultdict(float))
|
16396
16459
|
for USER_TID, USER_VARS, USER_LSTS in data_users:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|