Commit a38e78e
Add MIT Learn Cohort 2 dbt models and Dagster webhook delivery assets (#2277)
* feat: add MIT Learn Cohort 2 dbt staging/integration models and webhook delivery
Adds the dbt transformation layer and Dagster webhook delivery assets for the
four MIT Learn REST API sources added in PR #2276. Depends on the raw Iceberg
tables from that PR being loaded successfully before dbt can run.
dbt models added:
- stg__mit_climate__api__articles
- stg__mitpe__api__courses
- stg__oll__google_sheets__courses
- stg__edxorg__discovery__api__programs
- integrations__learn__mit_climate_articles
- integrations__learn__mitpe_courses
- integrations__learn__oll_courses
- integrations__learn__mit_edx_programs
Webhook delivery assets (learning_resources code location):
- mit_climate_webhook — fetches from integrations__learn__mit_climate_articles
- mitpe_webhook — fetches from integrations__learn__mitpe_courses
- oll_webhook — fetches from integrations__learn__oll_courses
- mit_edx_programs_webhook — fetches from integrations__learn__mit_edx_programs
MITLearnApiClient gains a unified notify_learning_resources() method used by
all four webhook assets. Schedules at staggered daily UTC times (06:00-06:45).
Fix vs original PR #2263:
- Remove integrations__learn__mitpe_programs model (no /feeds/programs/ endpoint)
- mitpe_webhook now delivers courses only (programs mixed in courses feed)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: remove mitpe programs dbt model (no separate programs API endpoint)
MIT PE does not have a /feeds/programs/ endpoint — programs are mixed
in with courses in the /feeds/courses/ feed. Remove the programs staging
and integration models added in error.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: address PR #2277 review feedback
integrations__learn__oll_courses.sql:
- Fix column reference: description → course_description (staging alias)
- Deduplicate to one row per readable_id by selecting the most recent
course-semester offering (ROW_NUMBER over year desc, semester desc),
since the OLL spreadsheet has one row per course-semester offering and
the integration contract requires unique readable_id per course
learn_api.py:
- Make notify_learning_resources() endpoint configurable via parameter
(defaults to /api/v1/webhooks/learning_resources/)
- Clarify docstring: all Cohort 2 sources use a single consolidated endpoint;
per-source routing is handled by MIT Learn based on etl_source/resource_type
mitpe.py:
- Fix misleading docstring: MIT PE delivers courses only (resource_type='course');
remove claim that resource_type distinguishes programs, since the dbt
integration model hard-codes resource_type='course'
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(dbt): add missing edxorg discovery API source declaration
stg__edxorg__discovery__api__programs references
source('ol_warehouse_raw_data', 'raw__edxorg__discovery__api__programs')
but no dbt source YAML declared the table, causing compilation failure.
Added _edxorg__discovery__sources.yml with loader: dlt and column docs
mirroring the pattern from the other three cohort-2 source files.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(oll): align source YAML and staging SQL with actual CSV schema
The OLL pipeline reads learning_resources/data/oll_metadata.csv from the
mit-learn repo, not a Google Sheet. The actual CSV has no Semester, Year,
Run ID, or Subjects columns, so the staging model failed with column-not-found
errors.
Changes:
- _oll__sources.yml: fix description (mit-learn CSV, PK is readable_id);
remove phantom columns (semester, year, run_id, subjects); add actual
columns (readable_id, ed_x_subject_1/2/3).
- stg__oll__google_sheets__courses.sql: replace run_id ref with readable_id;
build course_topics_raw by pipe-joining ed_x_subject_1/2/3 via concat_ws;
emit course_semester/course_year as null so integration-layer dedup
ordering degrades gracefully.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(mit_climate): rename resource_category to resource_type in webhook payload
Address PR review comment: MIT Learn expects 'resource_type' not
'resource_category' in the LearningResource webhook shape.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(learn-cohort2): use inline schema scalar in dlt source ymls
The oll and edxorg__discovery source files used a YAML folded scalar
(schema: >) which appends a trailing newline to the rendered schema
name, so the source would resolve to "..._raw\n" at dbt runtime
(table-not-found), a failure dbt parse and CI do not catch because the
models are never materialized in CI. Switch to the inline single-quoted
form used by the other 13 staging source files.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(mit_climate): lowercase resource_type 'article' in webhook payload
Sentry review flagged the MIT Climate delivery asset emitting
resource_type='Article' (capitalized), inconsistent with every other
Cohort 2 asset ('course', 'program') and the lowercase enum MIT Learn's
webhook handler expects. Lowercase it so articles are categorized rather
than rejected.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(mit_climate): deliver articles as resource_type "document"
MIT Learn's data model has no "article" resource_type — the legacy Celery ETL
loads MIT Climate articles via load_documents() as LearningResourceType.document
with resource_category "Article" (learning_resources/etl/pipelines.py). Emitting
resource_type "article" over the webhook meant MIT Learn's generic
learning_resources handler had no loader for it and would skip the batch.
Match the legacy contract: resource_type "document" + resource_category
"Article", so the webhook path ingests Climate articles through the same
load_documents route as before.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent f950e50 commit a38e78e
21 files changed
Lines changed: 1103 additions & 11 deletions
File tree
- dg_projects/learning_resources
- learning_resources
- assets
- packages/ol-orchestrate-lib/src/ol_orchestrate/resources
- src/ol_dbt/models
- integrations/learn
- staging
- edxorg
- mit_climate
- mitpe
- oll
Lines changed: 119 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
Lines changed: 141 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
Lines changed: 115 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
0 commit comments