Skip to content

Commit

Permalink
adds new column to vizdb.sdssid_to_pipes view (#259)
Browse files Browse the repository at this point in the history
* adding new has_been_observed_column

* fixing temp change

* updating metadata
  • Loading branch information
havok2063 authored Aug 1, 2024
1 parent 567f81d commit 19eae57
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion python/sdssdb/peewee/sdss5db/vizdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ class SDSSidToPipes(VizBase):
in_boss = BooleanField(null=False)
in_apogee = BooleanField(null=False)
in_astra = BooleanField(null=False)
has_been_observed = BooleanField(null=False)

class Meta:
table_name = 'sdssid_to_pipes'
print_fields = ['sdss_id', 'in_boss', 'in_apogee', 'in_astra']
print_fields = ['sdss_id', 'in_boss', 'in_apogee', 'in_astra', 'has_been_observed']


class DbMetadata(VizBase):
Expand Down
3 changes: 2 additions & 1 deletion python/sdssdb/sqlalchemy/sdss5db/vizdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ class SDSSidStacked(Base):

class SDSSidToPipes(Base):
__tablename__ = 'sdssid_to_pipes'
print_fields = ['sdss_id', 'in_boss', 'in_apogee', 'in_astra']
print_fields = ['sdss_id', 'in_boss', 'in_apogee', 'in_astra', 'has_been_observed']

pk = Column('pk', BigInteger, primary_key=True)
sdss_id = Column('sdss_id', BigInteger)
in_boss = Column('in_boss', Boolean)
in_apogee = Column('in_apogee', Boolean)
in_astra = Column('in_astra', Boolean)
has_been_observed = Column('has_been_observed', Boolean)


class Releases(Base):
Expand Down
9 changes: 9 additions & 0 deletions schema/sdss5db/metadata/vizdb.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,15 @@
"description": "Flag indicating if the sdss_id is in the astra reduction tables",
"unit": "None"
},
{
"schema": "vizdb",
"table_name": "sdssid_to_pipes",
"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",
"unit": "None"
},
{
"schema": "vizdb",
"table_name": "releases",
Expand Down
3 changes: 2 additions & 1 deletion schema/sdss5db/vizdb/vizdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ 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,
(a.sdss_id IS NOT NULL) AS in_astra
(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.id as boss_spectrum_pk,
-- v.star_pk as apogee_star_pk,
-- v.visit_pk as apogee_visit_pk,
Expand Down

0 comments on commit 19eae57

Please sign in to comment.