This commit is contained in:
Correl Roush 2022-02-18 14:34:35 -05:00
parent c6ec0dd4b0
commit bbf9181119
5 changed files with 554 additions and 83 deletions

197
20220209144915-tutor.org Normal file
View file

@ -0,0 +1,197 @@
:PROPERTIES:
:ID: e79ad4ee-17d0-44f9-8270-2f19b65bc949
:END:
#+title: Tutor
A [[id:cda9c620-fec5-4549-b979-22fc06819d77][Python]] application backed by a SQLite database for tracking my [[id:d5efa5bd-dac9-4ef5-b352-a2b794a37bd0][Magic: The
Gathering]] card collection.
https://git.phoenixinquis.net/correlr/tutor
* Finding cards for a deck
Decklist -- Alive -- Shared via TopDecked MTG
Main (100)
1 Serra Ascendant
1 Soul's Attendant
1 Ajani's Pridemate
1 Alabaster Mage
1 Grateful Apparition
1 Suture Priest
1 Trelasarra, Moon Dancer
1 Angel of Vitality
1 Celestial Unicorn
1 Evolution Sage
1 Lurking Roper
1 Spike Feeder
1 Splendor Mare
1 Armorcraft Judge
1 Bloom Hulk
1 Core Prowler
1 Lathiel, the Bounteous Dawn
1 Lightkeeper of Emeria
1 Hamza, Guardian of Arashin
1 Ajani Goldmane
1 The Wanderer
1 Blossoming Wreath
1 Condemn
1 Fortifying Draught
1 Healing Salve
1 Light of Hope
1 Divine Offering
1 Revitalize
1 Abuna's Chant
1 Angel's Mercy
1 Blunt the Assault
1 Congregate
1 Refreshing Rain
1 War Report
1 Corrosive Gale
1 Bond of Flourishing
1 Courage in Crisis
1 Survival Cache
1 Hunters' Feast
1 Primal Command
1 Wanderer's Strike
1 Planewide Celebration
1 Fountain of Youth
1 Elixir of Immortality
1 Golden Urn
1 Sol Ring
1 Soul Net
1 The Ozolith
1 Contagion Clasp
1 Throne of Geth
1 Marble Chalice
1 Staff of Domination
1 Soul Conduit
1 Lifelink
1 Spirit Link
1 Ajani's Mantra
1 Inner Sanctum
1 Luminous Wake
1 Faith's Fetters
1 First Response
1 Vigil for the Lost
1 Noble Purpose
1 Noble Stand
1 Celestial Mantle
1 Blossoming Sands
1 Command Tower
14 Forest
1 Karn's Bastion
16 Plains
1 Razorverge Thicket
1 Sunpetal Grove
1 Yavimaya Hollow
Shared via TopDecked MTG
https://www.topdecked.com/decks/alive/833c308f-219f-4624-8b32-1adedcb477f0
#+caption: Adding the deck list to the database
#+begin_src sql :exports code :eval never
INSERT INTO decks (deck_id, name) VALUES (2, 'Alive');
INSERT INTO deck_cards (deck_id, oracle_id)
SELECT DISTINCT 2, oracle_id FROM cards WHERE name IN
(
'Serra Ascendant',
'Soul''s Attendant',
'Ajani''s Pridemate',
'Alabaster Mage',
'Grateful Apparition',
'Suture Priest',
'Trelasarra, Moon Dancer',
'Angel of Vitality',
'Celestial Unicorn',
'Evolution Sage',
'Lurking Roper',
'Spike Feeder',
'Splendor Mare',
'Armorcraft Judge',
'Bloom Hulk',
'Core Prowler',
'Lathiel, the Bounteous Dawn',
'Lightkeeper of Emeria',
'Hamza, Guardian of Arashin',
'Ajani Goldmane',
'The Wanderer',
'Blossoming Wreath',
'Condemn',
'Fortifying Draught',
'Healing Salve',
'Light of Hope',
'Divine Offering',
'Revitalize',
'Abuna''s Chant',
'Angel''s Mercy',
'Blunt the Assault',
'Congregate',
'Refreshing Rain',
'War Report',
'Corrosive Gale',
'Bond of Flourishing',
'Courage in Crisis',
'Survival Cache',
'Hunters'' Feast',
'Primal Command',
'Wanderer''s Strike',
'Planewide Celebration',
'Fountain of Youth',
'Elixir of Immortality',
'Golden Urn',
'Sol Ring',
'Soul Net',
'The Ozolith',
'Contagion Clasp',
'Throne of Geth',
'Marble Chalice',
'Staff of Domination',
'Soul Conduit',
'Lifelink',
'Spirit Link',
'Ajani''s Mantra',
'Inner Sanctum',
'Luminous Wake',
'Faith''s Fetters',
'First Response',
'Vigil for the Lost',
'Noble Purpose',
'Noble Stand',
'Celestial Mantle',
'Blossoming Sands',
'Command Tower',
'Forest',
'Karn''s Bastion',
'Plains',
'Razorverge Thicket',
'Sunpetal Grove',
'Yavimaya Hollow'
);
#+end_src
#+caption: Finding cards in the collection
#+begin_src sql :exports code :eval never
select distinct set_code,
color_identity,
cards.name,
sets.name,
type_line,
rarity
from deck_cards
join cards using(oracle_id)
join copies using (scryfall_id)
join rarities using (rarity)
join sets using(set_code)
where deck_id = 2
order by release_date desc, color_identity, rarity_ord desc, cards.name;
#+end_src
** Questions
- Where are the cards in my collection I need to build a deck?
- Which cards do I want in one deck that are currently in another?
- Which cards do I need more copies of?
- Which cards do I need that would improve specific decks?

View file

@ -0,0 +1,6 @@
:PROPERTIES:
:ID: d5efa5bd-dac9-4ef5-b352-a2b794a37bd0
:END:
#+title: Magic: The Gathering
A trading card game from the 90s that takes over wallets and lives.

View file

@ -9,58 +9,18 @@ exposing efficient materialized data views.
* Plan
- Parent ticket :: [[https://jira.aweber.io/browse/CCPANEL-11781][CCPANEL-11781]]
:PROPERTIES:
:COLUMNS: %40ITEM %Effort{:}
:END:
#+BEGIN: columnview :id local
| ITEM | Effort |
|-----------------------------------------------+----------|
| Plan | 19d 4:00 |
| Create the analytics view service | 2d |
| Create the analytics view service playbook | 4h |
| Plan API structure | |
| Create endpoints for existing reports | 17d 0:00 |
| Opens | 1d |
| Clicks | 1d |
| Sales | 1d |
| Sales Totals | 1d |
| Sale Currencies | 1d |
| Sale Events | 1d |
| Lifetime Sales | 1d |
| Pending Broadcasts | 1d |
| Completed Broadcasts | 1d |
| Cities, States, and Countries | 1d |
| Followups | 1d |
| New Subscribers Daily | 1d |
| New Subscribers Weekly | 1d |
| New Subscribers Monthly | 1d |
| Subscriber Totals Daily | 1d |
| Subscriber Totals Weekly | 1d |
| Subscriber Totals Monthly | 1d |
| Migrate reports to the Analytics View Service | |
#+END:
** Create the analytics view service
:PROPERTIES:
:Effort: 2d
:END:
- New project using cookie cutter
- Deployed to kubernetes
- Grafana dashboard created
** Create the analytics view service playbook
:PROPERTIES:
:Effort: 4h
:END:
** Plan API structure
- Pathing (=/reports/*=)?
- Report versioning? (=/reports/{name}.v{version}=)?
- Report versioning? (=/reports/$NAME.v$VERSION=)?
** Create endpoints for existing reports
- Based on the endpoints provided in the [[id:3ddc4e32-932f-4748-bfe9-7025d4d6b352][Report API Controller]]
- Are all of these report endpoints in use?
*** Opens over time
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: daily-opens
- Parameters ::
@ -95,9 +55,6 @@ exposing efficient materialized data views.
#+end_src
*** Clicks over time
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: daily-clicks
- Parameters ::
@ -132,9 +89,6 @@ exposing efficient materialized data views.
#+end_src
*** Sales over time (events)
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: sale-events
- Parameters ::
@ -209,9 +163,6 @@ exposing efficient materialized data views.
]
#+end_src
*** Sales over time (summary)
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: daily-sales
- Parameters ::
@ -261,9 +212,6 @@ exposing efficient materialized data views.
}
#+end_src
*** Sale Currencies
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: sale-currencies
- Parameters ::
@ -276,9 +224,6 @@ exposing efficient materialized data views.
["USD", "CAD"]
#+end_src
*** Pending Broadcasts
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: pending-broadcasts
- Parameters ::
@ -310,9 +255,6 @@ exposing efficient materialized data views.
]
#+end_src
*** Completed Broadcasts
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: completed-broadcasts
- Parameters ::
@ -395,9 +337,6 @@ exposing efficient materialized data views.
]
#+end_src
*** Cities, States, and Countries
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: subscribers-by-location
- Parameters ::
@ -473,38 +412,293 @@ exposing efficient materialized data views.
}
]
#+end_src
*** Campaign Statistics
Add the campaign start endpoint into analytics-view including
- DynamoDB fixtures
- Dynamo dbhelpers (currently there is no dynamo connectivity in analytics-view)
- CampaignStarted Handler
https://gitlab.aweber.io/CP/Services/campaignstats/-/blob/master/campaignstats/handlers.py
- Grafana dashboard updated
- Alerts configured
- Confluence docs updated
*** Followups
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: followup-totals
- Parameters ::
- List (default: all lists)
- Report API controller endpoints ::
- followups
Uses the =freq_mesg= and =freq_mesg_stats= tables in AppDB combined with data
from the =messages= table in Analytics.
=editor_path= is hard-coded in the current report endpoint.
#+caption: Sample Response (Production AID 91)
#+begin_src json
[
{
"followup_message": "1",
"num_emailed": 83024,
"num_opened": 89950,
"open_percentage": 23.659423781075,
"clicks": "13198",
"message_id": "28613652",
"click_percentage": 0,
"unique_opens": "19643",
"unique_clicks": "1584",
"clicks_percentage": 23.659423781075,
"editor_path": "messages#/active"
},
{
"followup_message": "2",
"num_emailed": 73714,
"num_opened": 49979,
"open_percentage": 13.675828200884,
"clicks": "6169",
"message_id": "28613655",
"click_percentage": 0,
"unique_opens": "10081",
"unique_clicks": "649",
"clicks_percentage": 13.675828200884,
"editor_path": "messages#/active"
},
{
"followup_message": "3",
"num_emailed": 70880,
"num_opened": 38472,
"open_percentage": 10.272291196388,
"clicks": "4322",
"message_id": "28613659",
"click_percentage": 0,
"unique_opens": "7281",
"unique_clicks": "409",
"clicks_percentage": 10.272291196388,
"editor_path": "messages#/active"
},
{
"followup_message": "4",
"num_emailed": 69375,
"num_opened": 37496,
"open_percentage": 10.105945945946,
"clicks": "4419",
"message_id": "28613661",
"click_percentage": 0,
"unique_opens": "7011",
"unique_clicks": "447",
"clicks_percentage": 10.105945945946,
"editor_path": "messages#/active"
},
{
"followup_message": "5",
"num_emailed": 67478,
"num_opened": 30996,
"open_percentage": 8.2752897240582,
"clicks": "3236",
"message_id": "28613662",
"click_percentage": 0,
"unique_opens": "5584",
"unique_clicks": "257",
"clicks_percentage": 8.2752897240582,
"editor_path": "messages#/active"
},
{
"followup_message": "6",
"num_emailed": 65414,
"num_opened": 32483,
"open_percentage": 9.2334974164552,
"clicks": "3127",
"message_id": "28613664",
"click_percentage": 0,
"unique_opens": "6040",
"unique_clicks": "323",
"clicks_percentage": 9.2334974164552,
"editor_path": "messages#/active"
},
{
"followup_message": "7",
"num_emailed": 63871,
"num_opened": 28756,
"open_percentage": 8.1883797028385,
"clicks": "1964",
"message_id": "28613665",
"click_percentage": 0,
"unique_opens": "5230",
"unique_clicks": "166",
"clicks_percentage": 8.1883797028385,
"editor_path": "messages#/active"
}
]
#+end_src
*** New Subscribers Daily
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: daily-new-subscribers
- Parameters ::
- List (default: all lists)
- Report API controller endpoints ::
- new_subscribers_daily
Uses the =public.leads_stats_day= table in AppDB.
#+caption: Sample Response (Production AID 91)
#+begin_src json
{
"2022-01-09T00:00:00Z": {
"subscribed": 324,
"unsubscribed": 83
},
"2022-01-10T00:00:00Z": {
"subscribed": 417,
"unsubscribed": 80
},
"2022-01-11T00:00:00Z": {
"subscribed": 433,
"unsubscribed": 92
},
...
}
#+end_src
*** New Subscribers Weekly
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: weekly-new-subscribers
- Parameters ::
- List (default: all lists)
- Report API controller endpoints ::
- new_subscribers_weekly
Uses the =public.leads_stats_day= table in AppDB.
#+caption: Sample Response (Production AID 91)
#+begin_src json
{
"2021-03-26T00:00:00Z": {
"subscribed": 3182,
"unsubscribed": 1249
},
"2021-04-02T00:00:00Z": {
"subscribed": 3423,
"unsubscribed": 1497
},
"2021-04-09T00:00:00Z": {
"subscribed": 3052,
"unsubscribed": 1217
},
...
}
#+end_src
*** New Subscribers Monthly
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: monthly-new-subscribers
- Parameters ::
- List (default: all lists)
- Report API controller endpoints ::
- new_subscribers_monthly
Uses the =public.leads_stats_day= table in AppDB.
#+caption: Sample Response (Production AID 91)
#+begin_src json
{
"2021-03-01T00:00:00Z": {
"subscribed": 14972,
"unsubscribed": 4770
},
"2021-04-01T00:00:00Z": {
"subscribed": 14973,
"unsubscribed": 7181
},
"2021-05-01T00:00:00Z": {
"subscribed": 12652,
"unsubscribed": 5243
},
...
}
#+end_src
*** Subscriber Totals Daily
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: subscribers-by-location
- Parameters ::
- List (default: all lists)
- Report API controller endpoints ::
- subscriber_totals_daily
Uses the =public.leads_stats_day= table in AppDB.
#+caption: Sample Response (Production AID 91)
#+begin_src json
{
"2022-01-09T00:00:00Z": {
"subscribed": 289192,
"unsubscribed": 920812
},
"2022-01-10T00:00:00Z": {
"subscribed": 289609,
"unsubscribed": 920892
},
"2022-01-11T00:00:00Z": {
"subscribed": 290042,
"unsubscribed": 920984
},
...
}
#+end_src
*** Subscriber Totals Weekly
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: subscribers-by-location
- Parameters ::
- List (default: all lists)
- Report API controller endpoints ::
- subscriber_totals_weekly
Uses the =public.leads_stats_day= table in AppDB.
#+caption: Sample Response (Production AID 91)
#+begin_src json
{
"2021-02-08T00:00:00Z": {
"subscribed": 191745,
"unsubscribed": 887713
},
"2021-02-15T00:00:00Z": {
"subscribed": 193972,
"unsubscribed": 888733
},
"2021-02-22T00:00:00Z": {
"subscribed": 196200,
"unsubscribed": 889717
},
...
}
#+end_src
*** Subscriber Totals Monthly
:PROPERTIES:
:Effort: 1d
:END:
#+attr_confluence: :as-table t
- Name :: subscribers-by-location
- Parameters ::
- List (default: all lists)
- Report API controller endpoints ::
- subscriber_totals_monthly
Uses the =public.leads_stats_day= table in AppDB.
#+caption: Sample Response (Production AID 91)
#+begin_src json
{
"2021-02-01T00:00:00Z": {
"subscribed": 196200,
"unsubscribed": 889717
},
"2021-03-01T00:00:00Z": {
"subscribed": 206569,
"unsubscribed": 894298
},
"2021-04-01T00:00:00Z": {
"subscribed": 215813,
"unsubscribed": 900020
},
...
}
#+end_src
** Migrate reports to the Analytics View Service

67
daily/2022-02-04.org Normal file
View file

@ -0,0 +1,67 @@
:PROPERTIES:
:ID: bea03f11-ea0e-495e-98e9-3f5fba9e056e
:END:
#+title: 2022-02-04
* Experimenting with Splash rendering
Looking into how to render landing page drafts for content moderation.
#+name: hello-html
#+begin_src html
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Untitled</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
</head>
<body bgcolor="red">
<!--[if lt IE 8]>
<p class="browserupgrade">
You are using an <strong>outdated</strong> browser. Please
<a href="http://browsehappy.com/">upgrade your browser</a> to improve
your experience.
</p>
<![endif]-->
<center><b>Hello!</b></center>
</body>
</html>
#+end_src
#+name: hello-data-url
#+begin_src emacs-lisp
(concat
"data:text/html;base64,"
(base64-encode-string
(cadr (org-babel-lob--src-info "hello-html")) t))
#+end_src
#+RESULTS: hello-data-url
: data:text/html;base64,PCFkb2N0eXBlIGh0bWw+CjxodG1sIGNsYXNzPSJuby1qcyIgbGFuZz0iIj4KICAgIDxoZWFkPgogICAgICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgICAgICA8bWV0YSBodHRwLWVxdWl2PSJ4LXVhLWNvbXBhdGlibGUiIGNvbnRlbnQ9ImllPWVkZ2UiPgogICAgICAgIDx0aXRsZT5VbnRpdGxlZDwvdGl0bGU+CiAgICAgICAgPG1ldGEgbmFtZT0iZGVzY3JpcHRpb24iIGNvbnRlbnQ9IiI+CiAgICAgICAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xIj4KCiAgICAgICAgPGxpbmsgcmVsPSJhcHBsZS10b3VjaC1pY29uIiBocmVmPSIvYXBwbGUtdG91Y2gtaWNvbi5wbmciPgogICAgICAgIDwhLS0gUGxhY2UgZmF2aWNvbi5pY28gaW4gdGhlIHJvb3QgZGlyZWN0b3J5IC0tPgoKICAgIDwvaGVhZD4KICAgIDxib2R5IGJnY29sb3I9InJlZCI+CiAgICAgICAgPCEtLVtpZiBsdCBJRSA4XT4KICAgICAgICAgICAgPHAgY2xhc3M9ImJyb3dzZXJ1cGdyYWRlIj4KICAgICAgICAgICAgWW91IGFyZSB1c2luZyBhbiA8c3Ryb25nPm91dGRhdGVkPC9zdHJvbmc+IGJyb3dzZXIuIFBsZWFzZQogICAgICAgICAgICA8YSBocmVmPSJodHRwOi8vYnJvd3NlaGFwcHkuY29tLyI+dXBncmFkZSB5b3VyIGJyb3dzZXI8L2E+IHRvIGltcHJvdmUKICAgICAgICAgICAgeW91ciBleHBlcmllbmNlLgogICAgICAgICAgICA8L3A+CiAgICAgICAgPCFbZW5kaWZdLS0+CiAgICAgICAgPGNlbnRlcj48Yj5IZWxsbyE8L2I+PC9jZW50ZXI+CgogICAgPC9ib2R5Pgo8L2h0bWw+
#+begin_src http :var url=hello-data-url
GET http://splash.service.testing.consul/render.html?url=${url}
#+end_src
#+RESULTS:
: HTTP/1.1 200 OK
: Date: Fri, 04 Feb 2022 16:38:45 GMT
: Content-Type: text/html; charset=utf-8
: Transfer-Encoding: chunked
: Connection: keep-alive
: Server: TwistedWeb/19.7.0
:
: <html><head></head><body></body></html>
Well, crap. It doesn't like data urls.
It is self-hosted, though, so it should be able to reach any internal hosted
versions of pages if/when they become available.

7
daily/2022-02-10.org Normal file
View file

@ -0,0 +1,7 @@
:PROPERTIES:
:ID: aa735987-ba02-4430-87b9-3f8dc5cefaa8
:END:
#+title: 2022-02-10
- Daily materialized report account stats table in appdb could be useful.
- Should followups be retained?