All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 32s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m3s
Build and Push Docker Images / Build Integrator (push) Successful in 55s
Build and Push Docker Images / Build Kestra Init (push) Successful in 31s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 1m29s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s
- Remove optional flag from total_pupils (Typesense requires default sorting field to be non-optional) - Add latitude/longitude columns to dim_location computed from PostGIS geom, for direct use by backend and Typesense sync Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
1.2 KiB
SQL
35 lines
1.2 KiB
SQL
-- Mart: School location dimension — one row per URN, PostGIS-enabled
|
|
-- Geometry derived from GIAS easting/northing (British National Grid → WGS84).
|
|
-- For schools missing easting/northing, the geocode script backfills via Postcodes.io.
|
|
|
|
select
|
|
s.urn,
|
|
s.address_line1,
|
|
s.address_line2,
|
|
s.town,
|
|
s.county,
|
|
s.postcode,
|
|
s.local_authority_code,
|
|
s.local_authority_name,
|
|
s.parliamentary_constituency,
|
|
s.urban_rural,
|
|
s.easting,
|
|
s.northing,
|
|
case
|
|
when s.easting is not null and s.northing is not null
|
|
then ST_Transform(ST_SetSRID(ST_MakePoint(s.easting::double precision, s.northing::double precision), 27700), 4326)
|
|
else null
|
|
end as geom,
|
|
case
|
|
when s.easting is not null and s.northing is not null
|
|
then ST_Y(ST_Transform(ST_SetSRID(ST_MakePoint(s.easting::double precision, s.northing::double precision), 27700), 4326))
|
|
else null
|
|
end as latitude,
|
|
case
|
|
when s.easting is not null and s.northing is not null
|
|
then ST_X(ST_Transform(ST_SetSRID(ST_MakePoint(s.easting::double precision, s.northing::double precision), 27700), 4326))
|
|
else null
|
|
end as longitude
|
|
from {{ ref('stg_gias_establishments') }} s
|
|
where s.status = 'Open'
|