Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds new column to vizdb.sdssid_to_pipes view #259

Merged
merged 3 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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