Skip to content

Commit

Permalink
add program_type and fix micromasters program certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
rachellougee committed Nov 6, 2023
1 parent 5774884 commit 2068ad2
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/ol_dbt/models/intermediate/mitx/_int_mitx__models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ models:
tests:
- unique
- name: micromasters_program_id
description: int, primary key representing the program in the MicroMasters database
description: int, primary key representing the program in the MicroMasters database.
tests:
- unique
- name: program_description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ with micromasters_program_certificates as (
, mitxonline_program_certificates as (
select * from {{ ref('int__mitxonline__program_certificates') }}
--- dedp is handled in micromasters_program_certificates
where
program_id not in (
{{ var("dedp_mitxonline_public_policy_program_id") }}
, {{ var("dedp_mitxonline_international_development_program_id") }}
)
where program_is_dedp = false
)

, mitx_programs as (
Expand All @@ -22,15 +18,13 @@ with micromasters_program_certificates as (
select
micromasters_program_certificates.program_title
, micromasters_program_certificates.micromasters_program_id
, mitx_programs.mitxonline_program_id
, micromasters_program_certificates.mitxonline_program_id
, micromasters_program_certificates.program_completion_timestamp
, micromasters_program_certificates.user_mitxonline_username
, micromasters_program_certificates.user_edxorg_username
, micromasters_program_certificates.user_email
, micromasters_program_certificates.user_full_name
from micromasters_program_certificates
left join mitx_programs
on micromasters_program_certificates.micromasters_program_id = mitx_programs.micromasters_program_id

union all

Expand Down
20 changes: 2 additions & 18 deletions src/ol_dbt/models/intermediate/mitx/int__mitx__programs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,6 @@ select
, mitxonline_programs.program_id as mitxonline_program_id
, null as program_description
, mitxonline_programs.program_title
, case
when
mitxonline_programs.program_id in
(
{{ var("dedp_mitxonline_public_policy_program_id") }}
, {{ var("dedp_mitxonline_international_development_program_id") }}
) then true
else false
end as is_micromasters_program
, case
when
mitxonline_programs.program_id in
(
{{ var("dedp_mitxonline_public_policy_program_id") }}
, {{ var("dedp_mitxonline_international_development_program_id") }}
) then true
else false
end as is_dedp_program
, mitxonline_programs.program_is_micromasters as is_micromasters_program
, mitxonline_programs.program_is_dedp as is_dedp_program
from mitxonline_programs
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,17 @@ models:
tests:
- unique
- not_null
- name: program_type
description: str, type of the program. Value is free text, it could be MicroMasters®,
Series, etc
- name: program_is_dedp
description: boolean, specifying if the program is DEDP from readable_id
tests:
- not_null
- name: program_is_micromasters
description: boolean, specifying if the program is MITx MicroMasters® Program
tests:
- not_null

- name: int__mitxonline__program_requirements
columns:
Expand Down Expand Up @@ -1166,6 +1177,17 @@ models:
description: str, Open edX ID formatted as program-v1:{org}+{program code}
tests:
- not_null
- name: program_type
description: str, type of the program. Value is free text, it could be MicroMasters®,
Series, etc
- name: program_is_dedp
description: boolean, specifying if the program is DEDP from readable_id
tests:
- not_null
- name: program_is_micromasters
description: boolean, specifying if the program is MITx MicroMasters® Program
tests:
- not_null
- name: user_username
description: str, username on MITx Online
tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ with certificates as (
, certificates.program_id
, programs.program_title
, programs.program_readable_id
, programs.program_type
, programs.program_is_dedp
, programs.program_is_micromasters
, certificates.programcertificate_is_revoked
, certificates.programcertificate_created_on
, certificates.programcertificate_updated_on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ select
, program_title
, program_is_live
, program_readable_id
, program_type
, program_is_dedp
, program_is_micromasters
from programs
8 changes: 3 additions & 5 deletions src/ol_dbt/models/staging/mitxonline/_mitxonline__sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,8 @@ sources:
MITx Online website
- name: title
description: str, title of the course
- name: program_id
description: id, foreign key to courses_program (deprecating)
- name: readable_id
description: str, Open edX ID formatted as course-v1:{org}+{course code}
- name: position_in_program
description: int, sequential number indicating the course position in a program
(deprecating)
- name: created_on
description: timestamp, specifying when a course was initially created
- name: updated_on
Expand Down Expand Up @@ -599,6 +594,9 @@ sources:
description: str, title of the program
- name: readable_id
description: str, Open edX ID formatted as program-v1:{org}+{program code}
- name: program_type
description: str, type of the program. Value is free text, it could be MicroMasters®,
Series, etc
- name: created_on
description: timestamp, specifying when a program was initially created
- name: updated_on
Expand Down
11 changes: 11 additions & 0 deletions src/ol_dbt/models/staging/mitxonline/_stg_mitxonline__models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,17 @@ models:
description: str, title of the program
tests:
- not_null
- name: program_type
description: str, type of the program. Value is free text, it could be MicroMasters®,
Series, etc
- name: program_is_dedp
description: boolean, specifying if the program is DEDP from readable_id
tests:
- not_null
- name: program_is_micromasters
description: boolean, specifying if the program is MITx MicroMasters® Program
tests:
- not_null
- name: program_readable_id
description: str, Open edX ID formatted as program-v1:{org}+{program code}
tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ with source as (
, live as program_is_live
, title as program_title
, readable_id as program_readable_id
, program_type
, if(program_type like 'MicroMasters%', true, false) as program_is_micromasters
, if(readable_id like '%DEDP%', true, false) as program_is_dedp
,{{ cast_timestamp_to_iso8601('created_on') }} as program_created_on
,{{ cast_timestamp_to_iso8601('updated_on') }} as program_updated_on
from source
Expand Down

0 comments on commit 2068ad2

Please sign in to comment.