Skip to content

Commit

Permalink
add confirm active jobs test
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew D.Gramigna committed Nov 8, 2023
1 parent f7cf23c commit fc2d8fb
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions levergreen_dbt/tests/confirm_active_jobs_per_company_scraped.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{# Nov 2023
Adds a test which confirms that the expected number of job postings from the source is being
displayed properly in active job postings. Added because of script error when lever changed around
their departments
#}

with unique_active_jobs_per_company as (
select run_hash, source, job_board, count(*) as num_openings
from {{ ref('active_job_postings') }}
group by 1,2,3
),

sources as (
select run_hash, source, 'greenhouse' as job_board, count(*) as num_source_openings
from {{ source('greenhouse', 'greenhouse_jobs_outline') }}
where department_ids is not null --excludes a couple broken links from source (General Applications)
group by 1,2,3
union all
select run_hash, source, 'lever' as job_board, count(*) as num_source_openings
from {{ source('lever', 'lever_jobs_outline') }}
group by 1,2,3
union all
select run_hash, ashby_job_board_source, 'ashby' as job_board, count(*) as num_source_openings
from {{ source('ashby', 'ashby_jobs_outline') }}
group by 1,2,3
)

select * from unique_active_jobs_per_company as unique_active_jobs
inner join sources on unique_active_jobs.run_hash = sources.run_hash
and unique_active_jobs.source = sources.source
where num_openings != num_source_openings

0 comments on commit fc2d8fb

Please sign in to comment.