Skip to content

Instantly share code, notes, and snippets.

@brianv0
Created November 7, 2018 23:21
Show Gist options
  • Save brianv0/bec1bc2ad82c145ef207ae9479743870 to your computer and use it in GitHub Desktop.
Save brianv0/bec1bc2ad82c145ef207ae9479743870 to your computer and use it in GitHub Desktop.
processed sdqa file
CREATE TABLE sdqa.`sdqa_ImageStatus` (
`sdqa_imageStatusId` SMALLINT COMMENT 'Primary key',
`statusName` VARCHAR(30) COMMENT 'One-word, camel-case, descriptive name of a possible image status (e.g., passedAuto, marginallyPassedManual, etc.)',
definition VARCHAR(255) COMMENT 'Detailed Definition of the image status'
)COMMENT='Unique set of status names and their definitions, e.g. ''passed'', ''failed'', etc.'
CREATE TABLE sdqa.`sdqa_Metric` (
`sdqa_metricId` SMALLINT COMMENT 'Primary key.',
`metricName` VARCHAR(30) COMMENT 'One-word, camel-case, descriptive name of a possible metric (e.g., mSatPix, median, etc).',
`physicalUnits` VARCHAR(30) COMMENT 'Physical units of metric.',
`dataType` CHAR(1) COMMENT 'Flag indicating whether data type of the metric value is integer (0) or float (1).',
definition VARCHAR(255)
)COMMENT='Unique set of metric names and associated metadata (e.g., ''nDeadPix'';, ''median'';, etc.). There will be approximately 30 records total in this table.'
CREATE TABLE sdqa.`sdqa_Rating_ForAmpVisit` (
`sdqa_ratingId` BIGINT COMMENT 'Primary key. Auto-increment is used, we define a composite unique key, so potential duplicates will be captured.',
`sdqa_metricId` SMALLINT COMMENT 'Pointer to sdqa_Metric.',
`sdqa_thresholdId` SMALLINT COMMENT 'Pointer to sdqa_Threshold.',
`ampVisitId` BIGINT COMMENT 'Pointer to AmpVisit.',
`metricValue` DOUBLE COMMENT 'Value of this SDQA metric.',
`metricSigma` DOUBLE COMMENT 'Uncertainty of the value of this metric.'
)COMMENT='Various SDQA ratings for a given amplifier image. There will approximately 30 of these records per image record.'
CREATE TABLE sdqa.`sdqa_Rating_CcdVisit` (
`sdqa_ratingId` BIGINT COMMENT 'Primary key. Auto-increment is used, we define a composite unique key, so potential duplicates will be captured.',
`sdqa_metricId` SMALLINT COMMENT 'Pointer to sdqa_Metric.',
`sdqa_thresholdId` SMALLINT COMMENT 'Pointer to sdqa_Threshold.',
`ccdVisitId` BIGINT COMMENT 'Pointer to CcdVisit.',
`metricValue` DOUBLE COMMENT 'Value of this SDQA metric.',
`metricSigma` DOUBLE COMMENT 'Uncertainty of the value of this metric.'
)COMMENT='Various SDQA ratings for a given CcdVisit.'
CREATE TABLE sdqa.`sdqa_Threshold` (
`sdqa_thresholdId` SMALLINT COMMENT 'Primary key.',
`sdqa_metricId` SMALLINT COMMENT 'Pointer to sdqa_Metric table.',
`upperThreshold` DOUBLE COMMENT 'Threshold for which a metric value is tested to be greater than.',
`lowerThreshold` DOUBLE COMMENT 'Threshold for which a metric value is tested to be less than.',
`createdDate` TIMESTAMP NULL DEFAULT 'CURRENT_TIMESTAMP' COMMENT 'Database timestamp when the record is inserted.'
)COMMENT='Version-controlled metric thresholds. Total number of these records is approximately equal to 30 x the number of times the thresholds will be changed over the entire period of LSST operations (of order of 100), with most of the changes occuring in the first year of operations.'
CREATE TABLE sdqa."sdqa_ImageStatus" (
"sdqa_imageStatusId" NUMBER(5),
"statusName" VARCHAR2,
definition VARCHAR2
)
COMMENT ON TABLE sdqa."sdqa_ImageStatus" IS 'Unique set of status names and their definitions, e.g. ''passed'', ''failed'', etc.'
COMMENT ON COLUMN sdqa."sdqa_ImageStatus"."sdqa_imageStatusId" IS 'Primary key'
COMMENT ON COLUMN sdqa."sdqa_ImageStatus"."statusName" IS 'One-word, camel-case, descriptive name of a possible image status (e.g., passedAuto, marginallyPassedManual, etc.)'
COMMENT ON COLUMN sdqa."sdqa_ImageStatus".definition IS 'Detailed Definition of the image status'
CREATE TABLE sdqa."sdqa_Metric" (
"sdqa_metricId" NUMBER(5),
"metricName" VARCHAR2,
"physicalUnits" VARCHAR2,
"dataType" CHAR,
definition VARCHAR2
)
COMMENT ON TABLE sdqa."sdqa_Metric" IS 'Unique set of metric names and associated metadata (e.g., ''nDeadPix'';, ''median'';, etc.). There will be approximately 30 records total in this table.'
COMMENT ON COLUMN sdqa."sdqa_Metric"."sdqa_metricId" IS 'Primary key.'
COMMENT ON COLUMN sdqa."sdqa_Metric"."metricName" IS 'One-word, camel-case, descriptive name of a possible metric (e.g., mSatPix, median, etc).'
COMMENT ON COLUMN sdqa."sdqa_Metric"."physicalUnits" IS 'Physical units of metric.'
COMMENT ON COLUMN sdqa."sdqa_Metric"."dataType" IS 'Flag indicating whether data type of the metric value is integer (0) or float (1).'
CREATE TABLE sdqa."sdqa_Rating_ForAmpVisit" (
"sdqa_ratingId" NUMBER(38, 0),
"sdqa_metricId" NUMBER(5),
"sdqa_thresholdId" NUMBER(5),
"ampVisitId" NUMBER(38, 0),
"metricValue" BINARY_DOUBLE,
"metricSigma" BINARY_DOUBLE
)
COMMENT ON TABLE sdqa."sdqa_Rating_ForAmpVisit" IS 'Various SDQA ratings for a given amplifier image. There will approximately 30 of these records per image record.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."sdqa_ratingId" IS 'Primary key. Auto-increment is used, we define a composite unique key, so potential duplicates will be captured.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."sdqa_metricId" IS 'Pointer to sdqa_Metric.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."sdqa_thresholdId" IS 'Pointer to sdqa_Threshold.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."ampVisitId" IS 'Pointer to AmpVisit.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."metricValue" IS 'Value of this SDQA metric.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."metricSigma" IS 'Uncertainty of the value of this metric.'
CREATE TABLE sdqa."sdqa_Rating_CcdVisit" (
"sdqa_ratingId" NUMBER(38, 0),
"sdqa_metricId" NUMBER(5),
"sdqa_thresholdId" NUMBER(5),
"ccdVisitId" NUMBER(38, 0),
"metricValue" BINARY_DOUBLE,
"metricSigma" BINARY_DOUBLE
)
COMMENT ON TABLE sdqa."sdqa_Rating_CcdVisit" IS 'Various SDQA ratings for a given CcdVisit.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."sdqa_ratingId" IS 'Primary key. Auto-increment is used, we define a composite unique key, so potential duplicates will be captured.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."sdqa_metricId" IS 'Pointer to sdqa_Metric.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."sdqa_thresholdId" IS 'Pointer to sdqa_Threshold.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."ccdVisitId" IS 'Pointer to CcdVisit.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."metricValue" IS 'Value of this SDQA metric.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."metricSigma" IS 'Uncertainty of the value of this metric.'
CREATE TABLE sdqa."sdqa_Threshold" (
"sdqa_thresholdId" NUMBER(5),
"sdqa_metricId" NUMBER(5),
"upperThreshold" BINARY_DOUBLE,
"lowerThreshold" BINARY_DOUBLE,
"createdDate" TIMESTAMP DEFAULT 'CURRENT_TIMESTAMP'
)
COMMENT ON TABLE sdqa."sdqa_Threshold" IS 'Version-controlled metric thresholds. Total number of these records is approximately equal to 30 x the number of times the thresholds will be changed over the entire period of LSST operations (of order of 100), with most of the changes occuring in the first year of operations.'
COMMENT ON COLUMN sdqa."sdqa_Threshold"."sdqa_thresholdId" IS 'Primary key.'
COMMENT ON COLUMN sdqa."sdqa_Threshold"."sdqa_metricId" IS 'Pointer to sdqa_Metric table.'
COMMENT ON COLUMN sdqa."sdqa_Threshold"."upperThreshold" IS 'Threshold for which a metric value is tested to be greater than.'
COMMENT ON COLUMN sdqa."sdqa_Threshold"."lowerThreshold" IS 'Threshold for which a metric value is tested to be less than.'
COMMENT ON COLUMN sdqa."sdqa_Threshold"."createdDate" IS 'Database timestamp when the record is inserted.'
CREATE TABLE sdqa."sdqa_ImageStatus" (
"sdqa_imageStatusId" SMALLINT,
"statusName" VARCHAR,
definition VARCHAR
)
COMMENT ON TABLE sdqa."sdqa_ImageStatus" IS 'Unique set of status names and their definitions, e.g. ''passed'', ''failed'', etc.'
COMMENT ON COLUMN sdqa."sdqa_ImageStatus"."sdqa_imageStatusId" IS 'Primary key'
COMMENT ON COLUMN sdqa."sdqa_ImageStatus"."statusName" IS 'One-word, camel-case, descriptive name of a possible image status (e.g., passedAuto, marginallyPassedManual, etc.)'
COMMENT ON COLUMN sdqa."sdqa_ImageStatus".definition IS 'Detailed Definition of the image status'
CREATE TABLE sdqa."sdqa_Metric" (
"sdqa_metricId" SMALLINT,
"metricName" VARCHAR,
"physicalUnits" VARCHAR,
"dataType" CHAR,
definition VARCHAR
)
COMMENT ON TABLE sdqa."sdqa_Metric" IS 'Unique set of metric names and associated metadata (e.g., ''nDeadPix'';, ''median'';, etc.). There will be approximately 30 records total in this table.'
COMMENT ON COLUMN sdqa."sdqa_Metric"."sdqa_metricId" IS 'Primary key.'
COMMENT ON COLUMN sdqa."sdqa_Metric"."metricName" IS 'One-word, camel-case, descriptive name of a possible metric (e.g., mSatPix, median, etc).'
COMMENT ON COLUMN sdqa."sdqa_Metric"."physicalUnits" IS 'Physical units of metric.'
COMMENT ON COLUMN sdqa."sdqa_Metric"."dataType" IS 'Flag indicating whether data type of the metric value is integer (0) or float (1).'
CREATE TABLE sdqa."sdqa_Rating_ForAmpVisit" (
"sdqa_ratingId" BIGINT,
"sdqa_metricId" SMALLINT,
"sdqa_thresholdId" SMALLINT,
"ampVisitId" BIGINT,
"metricValue" DOUBLE PRECISION,
"metricSigma" DOUBLE PRECISION
)
COMMENT ON TABLE sdqa."sdqa_Rating_ForAmpVisit" IS 'Various SDQA ratings for a given amplifier image. There will approximately 30 of these records per image record.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."sdqa_ratingId" IS 'Primary key. Auto-increment is used, we define a composite unique key, so potential duplicates will be captured.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."sdqa_metricId" IS 'Pointer to sdqa_Metric.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."sdqa_thresholdId" IS 'Pointer to sdqa_Threshold.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."ampVisitId" IS 'Pointer to AmpVisit.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."metricValue" IS 'Value of this SDQA metric.'
COMMENT ON COLUMN sdqa."sdqa_Rating_ForAmpVisit"."metricSigma" IS 'Uncertainty of the value of this metric.'
CREATE TABLE sdqa."sdqa_Rating_CcdVisit" (
"sdqa_ratingId" BIGINT,
"sdqa_metricId" SMALLINT,
"sdqa_thresholdId" SMALLINT,
"ccdVisitId" BIGINT,
"metricValue" DOUBLE PRECISION,
"metricSigma" DOUBLE PRECISION
)
COMMENT ON TABLE sdqa."sdqa_Rating_CcdVisit" IS 'Various SDQA ratings for a given CcdVisit.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."sdqa_ratingId" IS 'Primary key. Auto-increment is used, we define a composite unique key, so potential duplicates will be captured.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."sdqa_metricId" IS 'Pointer to sdqa_Metric.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."sdqa_thresholdId" IS 'Pointer to sdqa_Threshold.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."ccdVisitId" IS 'Pointer to CcdVisit.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."metricValue" IS 'Value of this SDQA metric.'
COMMENT ON COLUMN sdqa."sdqa_Rating_CcdVisit"."metricSigma" IS 'Uncertainty of the value of this metric.'
CREATE TABLE sdqa."sdqa_Threshold" (
"sdqa_thresholdId" SMALLINT,
"sdqa_metricId" SMALLINT,
"upperThreshold" DOUBLE PRECISION,
"lowerThreshold" DOUBLE PRECISION,
"createdDate" TIMESTAMP WITHOUT TIME ZONE DEFAULT 'CURRENT_TIMESTAMP'
)
COMMENT ON TABLE sdqa."sdqa_Threshold" IS 'Version-controlled metric thresholds. Total number of these records is approximately equal to 30 x the number of times the thresholds will be changed over the entire period of LSST operations (of order of 100), with most of the changes occuring in the first year of operations.'
COMMENT ON COLUMN sdqa."sdqa_Threshold"."sdqa_thresholdId" IS 'Primary key.'
COMMENT ON COLUMN sdqa."sdqa_Threshold"."sdqa_metricId" IS 'Pointer to sdqa_Metric table.'
COMMENT ON COLUMN sdqa."sdqa_Threshold"."upperThreshold" IS 'Threshold for which a metric value is tested to be greater than.'
COMMENT ON COLUMN sdqa."sdqa_Threshold"."lowerThreshold" IS 'Threshold for which a metric value is tested to be less than.'
COMMENT ON COLUMN sdqa."sdqa_Threshold"."createdDate" IS 'Database timestamp when the record is inserted.'
CREATE TABLE sdqa."sdqa_ImageStatus" (
"sdqa_imageStatusId" SMALLINT,
"statusName" VARCHAR(30),
definition VARCHAR(255)
)
CREATE TABLE sdqa."sdqa_Metric" (
"sdqa_metricId" SMALLINT,
"metricName" VARCHAR(30),
"physicalUnits" VARCHAR(30),
"dataType" CHAR(1),
definition VARCHAR(255)
)
CREATE TABLE sdqa."sdqa_Rating_ForAmpVisit" (
"sdqa_ratingId" BIGINT,
"sdqa_metricId" SMALLINT,
"sdqa_thresholdId" SMALLINT,
"ampVisitId" BIGINT,
"metricValue" DOUBLE,
"metricSigma" DOUBLE
)
CREATE TABLE sdqa."sdqa_Rating_CcdVisit" (
"sdqa_ratingId" BIGINT,
"sdqa_metricId" SMALLINT,
"sdqa_thresholdId" SMALLINT,
"ccdVisitId" BIGINT,
"metricValue" DOUBLE,
"metricSigma" DOUBLE
)
CREATE TABLE sdqa."sdqa_Threshold" (
"sdqa_thresholdId" SMALLINT,
"sdqa_metricId" SMALLINT,
"upperThreshold" DOUBLE,
"lowerThreshold" DOUBLE,
"createdDate" TIMESTAMP DEFAULT 'CURRENT_TIMESTAMP'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment