Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Update script params for the 2018 CourseA-CourseF levels backfill - #26362

#26362
Merged
uponthesun merged 27 commits into
stagingcode-dot-org/code-dot-org:stagingfrom
2018-courses-proficiencies-backfillcode-dot-org/code-dot-org:2018-courses-proficiencies-backfillCopy head branch name to clipboard
Dec 18, 2018
Merged

Update script params for the 2018 CourseA-CourseF levels backfill#26362
uponthesun merged 27 commits into
stagingcode-dot-org/code-dot-org:stagingfrom
2018-courses-proficiencies-backfillcode-dot-org/code-dot-org:2018-courses-proficiencies-backfillCopy head branch name to clipboard

Conversation

@uponthesun

@uponthesun uponthesun commented Dec 14, 2018

Copy link
Copy Markdown

Followed the same process as this previous proficiencies backfill: #18530

Context:

Between July 1, 2018 and Oct 4, 2018 (when #25185 was merged), the 2018 versions of the CourseA-CourseF levels were missing level concept difficulty tagging, so user_proficiencies counters weren't updated for user progress on those courses during that time. user_proficiencies data is used in our analysis of the efficacy of those courses, as well as in our donor reports.

I'm going to be executing these queries/this script to backfill user_proficiencies; posting this PR to get more eyes on the changes before I do against the prod db.

  • The *.sed files and user_proficiencies.template.sql file were just used to generate the sql queries for getting the updated counter data. The template comes from the comment at the top of the bin/oneoff/backfill_data/user_proficiencies file.
  • The *.sql files contain queries which I executed against the production reporting database.
  • Updated bin/oneoff/backfill_data/user_proficiencies to use the script IDs for 2018 CourseA-CourseF, and the appropriate date ranges from July 1 to present. The date ranges are monthly, with the exception of October being split into 2 date ranges, since 10/1-10/4 is part of the missing data time period, and rest of the month had the correct data already. (The script still needs data from the time period after the LCD import to correctly calculate basic_proficiency_at.)

I'm including the *.sed and *.sql files here for review, but I won't commit those files.

Josh Lory and others added 20 commits November 13, 2018 18:18
DTT (Staging > Test) [robo-dtt]
DTT (Staging > Test) [robo-dtt]

@Hamms Hamms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how were the start_ and end_ids in the sed files obtained?

AGGREGATE_FILENAME = '/tmp/proficiency/aggregate_20170601_20171001'.freeze
# This script wasn't written to take in arguments; instead it uses these hardcoded paths
# (together with DATE_RANGES) above for input and output files.
DATA_DIRECTORY = '/Users/winterdong/CDO/proficiencies_backfill'.freeze

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd suggest either keeping this in /tmp/ or just updating the script to take arguments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is changing this constant back to /tmp acceptable?

/lazy

@uponthesun

Copy link
Copy Markdown
Author

I got the start_id and end_id in the .sed files from trial and error (finding ids close to the date range boundaries). For start_id, I erred slightly before the start of the date range, and end_id erred slightly after.

@Hamms Hamms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I love the generated .sql files being included here for clarity!

require_relative '../../../dashboard/config/environment'

# Fields:
# start_date, end_date, end_timestamp, already_recorded

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's one script ID missing here (303, the express course) It was script_id 258 in the previous version.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching!

@bencodeorg bencodeorg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I see to change is adding the script ID for the express course to the query template. Thanks for handling this Winter!

[note: this big red X seems very harsh. maybe I should have just added this as a comment. not sure what the appropriate git-iquette is]

DTT (Staging > Test) [robo-dtt]
@uponthesun

Copy link
Copy Markdown
Author

Haha I often feel that way too, but I think "changes requested" is appropriate for any changes that must be made before committing (or in this case running). Will add and update, thanks!

@bencodeorg bencodeorg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@uponthesun

Copy link
Copy Markdown
Author

Had to add a nil check to the script when it hit a certain case during execution (when the user only had progress during the already recorded date ranges), but otherwise the backfill ran smoothly. Here are the numbers for before/after the backfill on basic proficiency achieved per month:

Before:
count,year,month
86728,2016,1
92750,2016,2
102077,2016,3
95597,2016,4
97341,2016,5
43404,2016,6
16639,2016,7
33029,2016,8
77721,2016,9
90445,2016,10
110141,2016,11
61494,2016,12
110234,2017,1
113501,2017,2
138771,2017,3
96188,2017,4
117853,2017,5
54995,2017,6
21970,2017,7
43003,2017,8
96393,2017,9
120798,2017,10
143254,2017,11
134618,2017,12
137091,2018,1
142559,2018,2
162723,2018,3
152122,2018,4
155266,2018,5
64445,2018,6
21189,2018,7
27984,2018,8
49665,2018,9
106028,2018,10
109313,2018,11
54435,2018,12

After:
mysql> select count(user_id), month(basic_proficiency_at) as month, year(basic_proficiency_at) as year from user_proficiencies group by year, month;
+----------------+-------+------+
| count(user_id) | month | year |
+----------------+-------+------+
| 11121652 | NULL | NULL |
| 86728 | 1 | 2016 |
| 92750 | 2 | 2016 |
| 102077 | 3 | 2016 |
| 95597 | 4 | 2016 |
| 97341 | 5 | 2016 |
| 43404 | 6 | 2016 |
| 16639 | 7 | 2016 |
| 33029 | 8 | 2016 |
| 77721 | 9 | 2016 |
| 90445 | 10 | 2016 |
| 110141 | 11 | 2016 |
| 61494 | 12 | 2016 |
| 110234 | 1 | 2017 |
| 113501 | 2 | 2017 |
| 138771 | 3 | 2017 |
| 96188 | 4 | 2017 |
| 117853 | 5 | 2017 |
| 54995 | 6 | 2017 |
| 21970 | 7 | 2017 |
| 43003 | 8 | 2017 |
| 96393 | 9 | 2017 |
| 120798 | 10 | 2017 |
| 143254 | 11 | 2017 |
| 134618 | 12 | 2017 |
| 137091 | 1 | 2018 |
| 142559 | 2 | 2018 |
| 162723 | 3 | 2018 |
| 152122 | 4 | 2018 |
| 155266 | 5 | 2018 |
| 64445 | 6 | 2018 |
| 22841 | 7 | 2018 |
| 34932 | 8 | 2018 |
| 71768 | 9 | 2018 |
| 110006 | 10 | 2018 |
| 109358 | 11 | 2018 |
| 55030 | 12 | 2018 |
+----------------+-------+------+

@davidsbailey

Copy link
Copy Markdown
Member

hi folks, it looks like this branch is currently checked out on production-console. OK for me to put that machine back onto the production branch?

@uponthesun
uponthesun merged commit 30adfa6 into staging Dec 18, 2018
@uponthesun
uponthesun deleted the 2018-courses-proficiencies-backfill branch December 18, 2018 22:53
@uponthesun

Copy link
Copy Markdown
Author

Yes, I'm all done with the branch, you can change it back. Sorry about that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.