Skip to content

Commit

Permalink
fixing vizdb pipes sql
Browse files Browse the repository at this point in the history
  • Loading branch information
havok2063 committed Sep 24, 2024
1 parent ab87dbf commit cb62723
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions schema/sdss5db/metadata/vizdb.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@
"schema": "vizdb",
"table_name": "sdssid_to_pipes",
"column_name": "in_astra",
"display_name": "In APOGEE",
"display_name": "In Astra",
"sql_type": "boolean",
"description": "Flag indicating if the sdss_id has been reduced by the Astra pipeline, either sdss5 or dr17 release data.",
"description": "Flag indicating if the sdss_id has been matched to an Astra source (i.e. in the Source table)",
"unit": "None"
},
{
Expand All @@ -286,7 +286,7 @@
"column_name": "has_been_observed",
"display_name": "Has Been Observed",
"sql_type": "boolean",
"description": "Flag indicating if the sdss_id target has been observed or not, either in sdss5 or dr17 release data.",
"description": "Flag indicating if the sdss_id target has been observed and reduced, or not, either in sdss5 or dr17 release data.",
"unit": "None"
},
{
Expand Down
4 changes: 2 additions & 2 deletions schema/sdss5db/vizdb/vizdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ ANALYZE vizdb.sdss_id_flat;
CREATE MATERIALIZED VIEW vizdb.sdssid_to_pipes AS
SELECT row_number() over(order by s.sdss_id) as pk, s.sdss_id,
(b.sdss_id IS NOT NULL) AS in_boss,
(v.star_pk IS NOT NULL) AS in_apogee,
(v.star_pk IS NOT NULL or v.visit_pk IS NOT NULL) AS in_apogee,
(o.source_pk IS NOT NULL) AS in_bvs,
(a.sdss_id IS NOT NULL) AS in_astra,
(b.sdss_id IS NOT NULL OR v.star_pk IS NOT NULL OR a.sdss_id IS NOT NULL) AS has_been_observed,
(b.sdss_id IS NOT NULL OR v.source_pk IS NOT NULL OR o.source_pk IS NOT NULL) AS has_been_observed,
case when b.sdss_id IS NOT NULL then 'sdss5' when v.source_pk IS NOT NULL then v.release when o.source_pk is NOT NULL then o.release end as release,
case when b.sdss_id IS NOT NULL then lower(b.obs) when v.source_pk IS NOT NULL then substring(v.telescope,0,4) when o.source_pk IS NOT NULL then substring(o.telescope,0,4) end as obs,
case when b.sdss_id IS NOT NULL then b.mjd when v.source_pk IS NOT NULL then v.mjd when o.source_pk IS NOT NULL then o.mjd end as mjd
Expand Down

0 comments on commit cb62723

Please sign in to comment.