This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query_feed_q = """ | |
select | |
toDate(time) as date | |
,count(distinct user_id) as users_feed | |
,countIf(action='like') as likes | |
,countIf(action='view') as views | |
,countIf(action='like') / countIf(action='view') as CTR | |
,likes+views as events | |
from simulator_20220620.feed_actions | |
where toDate(time) between today() - 8 and today() - 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@staticmethod | |
def today(): | |
current_date = datetime.datetime.now() | |
return {'day': current_date.day, | |
'month': current_date.month, | |
'year': current_date.year, | |
'hour': current_date.hour, | |
'minute': current_date.minute, | |
'second': current_date.second} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@classmethod | |
def fill_date(clf): | |
current_date = clf.today() | |
Logger.day = current_date.day | |
Logger.month = current_date.month | |
Logger.year = current_date.year | |
Logger.hour = current_date.hour | |
Logger.minute = current_date.minute | |
Logger.second = current_date.second |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msg = """ 📃Application report for {date}📃 | |
Events: {events} | |
🧑DAU: {users}({to_users_day_ago:+.2%} to day ago, {to_users_week_ago:+.2%} to week ago) | |
🧑DAU by platform: | |
📱IOS: {users_ios}({to_users_ios_day_ago:+.2%} to day ago, {to_users_ios_week_ago:+.2%} to week ago) | |
📞Android: {users_and}({to_users_and_day_ago:+.2%} to day ago, {to_users_and_week_ago:+.2%} to week ago) | |
👫DAU by gender: | |
🙎Male: {users_male}({to_users_male_day_ago:+.2%} to day ago, {to_users_male_week_ago:+.2%} to week ago) | |
👰Female: {users_female}({to_users_female_day_ago:+.2%} to day ago, {to_users_female_week_ago:+.2%} to week ago) | |
🧑New users: {new_users}({to_new_users_day_ago:+.2%} to day ago, {to_new_users_week_ago:+.2%} to week ago) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import telegram | |
import pandahouse as ph | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import io | |
import pandas as pd | |
sns.set() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: cr.yandex/crp742p3qacifd2hcon2/practice-da:latest | |
stages: | |
- init | |
- run | |
feed_report_job: | |
stage: run | |
script: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: cr.yandex/crp742p3qacifd2hcon2/practice-da:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bot = telegram.Bot(token=os.environ.get("REPORT_BOT_TOKEN")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plot_object = get_plot(data) | |
bot.sendPhoto(chat_id=chat_id, photo=plot_object) |