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
def get_plot(data): | |
fig, axes = plt.subplots(2, 2, figsize = (16 , 10)) | |
# fig.subtitle("Feed statistics for the previous 7 days") | |
plot_dict = {(0,0):{'y':'DAU', 'title': 'Unique users'}, | |
(0,1):{'y':'likes', 'title': 'Likes'}, | |
(1,0):{'y':'views', 'title': 'Views'}, | |
(1,1):{'y':'CTR', 'title': 'CTR'}} | |
for i in range(2): |
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
def feed_report(chat=None): | |
chat = chat or chat_id | |
bot = telegram.Bot(token=my_token) | |
msg = """ 📃Feed report for {date}📃 | |
Events: {events} | |
🧑DAU: {users}({to_users_day_ago:+.2%} to day ago, {to_users_week_ago:+.2%} to week ago) | |
👍Likes: {likes}({to_likes_day_ago:+.2%} to day ago, {to_likes_week_ago:+.2%} to week ago) | |
👀Views: {views}({to_views_day_ago:+.2%} to day ago, {to_views_week_ago:+.2%} to week ago) | |
🌈CTR: {ctr}({to_ctr_day_ago:+.2%} to day ago, {to_ctr_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
def feed_report(chat=None): | |
chat = chat or chat_id | |
bot = telegram.Bot(token=my_token) | |
msg = """ 📃Feed report for {data}📃 | |
Events: {events} | |
🧑DAU: {users}({to_users_day_ago:+.2%} to day ago, {to_users_week_ago:+.2%} to week ago) | |
👍Likes: {liked}({to_likes_day_ago:+.2%} to day ago, {to_likes_week_ago:+.2%} to week ago) | |
👀Views: {views}({to_views_day_ago:+.2%} to day ago, {to_views_week_ago:+.2%} to week ago) | |
🌈CTR: {ctr}({to_ctr_day_ago:+.2%} to day ago, {to_ctr_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
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
image: cr.yandex/crp742p3qacifd2hcon2/practice-da:latest | |
stages: | |
- build | |
- test | |
- deploy | |
job_name: | |
stage: test | |
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
job_name: | |
stage: test | |
script: | |
- echo 'test 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
stages: | |
- build | |
- test | |
- deploy |
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
data = Getch('select * from simulator.feed_actions where toDate(time) = today() limit 100').df | |
file_object = io.StringIO() | |
data.to_csv(file_object) | |
file_object.name = 'test_file.csv' | |
file_object.seek(0) | |
bot.sendDocument(chat_id=chat_id, document = file_object) |
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
x = np.arange(1, 10, 1) | |
y = np.random.choice(5, len(x)) | |
sns.lineplot(x, y) | |
plt.title('test plot') | |
plot_object = io.BytesIO() | |
plt.savefig(plot_object) | |
plot_object.seek(0) | |
plot_object.name = 'test_plot.png' | |
plt.close() | |
bot.sendPhoto(chat_id=chat_id, photo = plot_object) |
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
chat_id = -1001592565485 | |
msg = 'Hello' | |
bot.sendMessage(chat_id = chat_id, text = msg) |