Database

A database is the main method of keeping track of requests to the telescope, noting its capabilities and logging what it has done. The data base is MariaDB version 10.3. This is a powerful opensource MySQL database with many users.

Here is an E/R/ diagram

There are two databases in use: observatory and weather.

Observatory Table Descriptions

Note: the InnoDB table type is used so that deletes or updates will be restricted or cascade when foreign keys are used (am I speaking English?).

There are also a lot of orphan tables that do not have the correct key associations, the above E/R diagram to see them.

Filter table - list the names, properties, filter wheel locations of the available filters.

+-------------------+----------+-----+-----+------+--+
| FilterID          | int(11)  | NO  | PRI | 0    |  |
| Name              | char(80) | NO  |     |      |  |
| Notes             | char(80) | YES |     | NULL |  |
| CentralWavelength | float    | YES |     | NULL |  |
| Bandwidth         | float    | YES |     | NULL |  |
| Thickness         | float    | YES |     | NULL |  |
| FocusShift        | float    | YES |     | NULL |  |
+-------------------+----------+-----+-----+------+--+

Fits table - is a listing of the images taken.

+-----------+----------+-----+-----+---------------------+----------------+
| FitsID    | int(11)  | NO  | PRI | NULL                | auto_increment |
| PictureID | int(11)  | YES | MUL | NULL                |                |
| Filestem  | char(20) | NO  | UNI |                     |                |
| Datetime  | datetime | NO  |     | 0000-00-00 00:00:00 |                |
| ImageType | char(20) | YES |     | OBJECT              |                |
+-----------+----------+-----+-----+---------------------+----------------+

Focus table - lists best focus measurements. It is generated by the focusanl program. Occasionally it is analyzed and the data are placed in the It is generated by the focus program.

+-------------+-----------+------+-----+---------------------+-------------------------------+
| TimeStamp   | timestamp | NO   | PRI | current_timestamp() | on update current_timestamp() |
| Millimeters | float     | NO   |     | NULL                |                               |
| FilterID    | int(11)   | YES  | MUL | NULL                |                               |
| Temp0       | float     | YES  |     | NULL                |                               |
| Temp1       | float     | YES  |     | NULL                |                               |
| Temp2       | float     | YES  |     | NULL                |                               |
| Temp3       | float     | YES  |     | NULL                |                               |
| Temp4       | float     | YES  |     | NULL                |                               |
| Temp5       | float     | YES  |     | NULL                |                               |
| Temp6       | float     | YES  |     | NULL                |                               |
| Temp7       | float     | YES  |     | NULL                |                               |
+-------------+-----------+------+-----+---------------------+-------------------------------+

Log table - lists what requests the telescope has observed and whether they succeeded or failed.

+-----------+------------+-----+-----+---------------------+----------------+
| LogID     | int(11)    | NO  | PRI | NULL                | auto_increment |
| RequestID | int(11)    | NO  | MUL | 0                   |                |
| Start     | datetime   | NO  |     | 0000-00-00 00:00:00 |                |
| Stop      | datetime   | YES |     | NULL                |                |
| Success   | tinyint(1) | YES |     | NULL                |                |
| Message   | char(80)   | YES |     | NULL                |                |
+-----------+------------+-----+-----+---------------------+----------------+

Object table - lists RA/Dec of non-orbiting celestial objects.

+----------------+------------+-----+-----+------+----------------+
| ObjectID       | int(11)    | NO  | PRI | NULL | auto_increment |
| ProjectID      | int(11)    | NO  |     | 0    |                |
| RightAscension | double     | YES |     | NULL |                |
| Declination    | double     | YES |     | NULL |                |
| Equinox        | float      | YES |     | NULL |                |
| Name           | char(80)   | YES |     | anon |                |
| ObserverID     | int(11)    | YES |     | NULL |                |
| IsPlanet       | tinyint(1) | YES |     | 0    |                |
| Epoch          | datetime   | YES |     | NULL |                |
+----------------+------------+-----+-----+------+----------------+

Observer table - contains information about the person submitting the request.

+----------------+-------------+-----+-----+------------------------------------------+----------------+
| ObserverID     | int(11)     | NO  | PRI | NULL                                     | auto_increment |
| OrganizationID | int(11)     | NO  |     | 0                                        |                |
| Name           | char(80)    | YES |     | NULL                                     |                |
| Email          | char(80)    | NO  | UNI |                                          |                |
| MaxPriority    | smallint(6) | YES |     | 0                                        |                |
| Password       | char(50)    | YES |     | cf2d1eac7ea105b6b4d6fcc562262178a127d189 |                |
| IsRoot         | tinyint(1)  | YES |     | 0                                        |                |
+----------------+-------------+-----+-----+------------------------------------------+----------------+

Organization table - contains information about the institutions submitting the request.

+----------------+---------------+-----+-----+------+--+
| OrganizationID | int(11)       | NO  | PRI | 0    |  |
| Name           | char(40)      | YES |     |      |  |
| Fraction       | decimal(11,2) | NO  |     | 0.00 |  |
+----------------+---------------+-----+-----+------+--+

Picture table - lists the particulars of the CCD images to be taken.

+--------------+-------------+-----+-----+------+----------------+
| PictureID    | int(11)     | NO  | PRI | NULL | auto_increment |
| FilterID     | int(11)     | YES | MUL | NULL |                |
| TargetID     | int(11)     | NO  | MUL | 0    |                |
| ExposureTime | float       | NO  |     | 0    |                |
| Binning      | tinyint(4)  | YES |     | 3    |                |
| Amplifier    | char(5)     | YES |     | 2    |                |
| Guide        | tinyint(1)  | YES |     | 0    |                |
| Count        | smallint(6) | YES |     | 1    |                |
+--------------+-------------+-----+-----+------+----------------+

Project table - contains information about the project submitting the request.

+-------------+--------------+----+-----+------+----------------+
| ProjectID   | int(11)      | NO | PRI | NULL | auto_increment |
| Name        | varchar(30)  | NO |     |      |                |
| ObserverID  | int(11)      | YES| MUL | NULL |                |
| Description | varchar(300) | NO |     |      |                |
| Abstract    | varchar(300) | NO |     |      |                |
| AllocTime   | int(11)      | NO |     | 0    |                |
+-------------+--------------+----+-----+------+----------------+

ProjectTeam table - contains information about the project?

+-----------+---------+------+-----+---------+----------------+
| TeamID    | int(11) | NO   | PRI | NULL    | auto_increment |
| ProjectID | int(11) | NO   | MUL | NULL    |                |
| Member    | int(11) | NO   | MUL | NULL    |                |
+-----------+---------+------+-----+---------+----------------+

ProjectQuota table - contains information about something

+----------------+---------------+-----+-----+------+----------------+
| ProjectQuotaID | int(11)       | NO  | PRI | NULL | auto_increment |
| ProjectID      | int(11)       | YES |     | NULL |                |
| ObserverID     | int(11)       | YES |     | NULL |                |
| Fraction       | decimal(11,5) | YES |     | NULL |                |
| EditPerm       | int(1)        | YES |     | NULL |                |
+----------------+---------------+-----+-----+------+----------------+

Request table - is the main table that holds information about the requested observation.

+--------------+-------------+-----+-----+---------------------+-------------------------------+
| RequestID    | int(11)     | NO  | PRI | NULL                | auto_increment                |
| ProjectID    | int(11)     | YES |     | NULL                |                               |
| Name         | char(80)    | YES |     | no label            |                               |
| ObsTime      | int(11)     | YES |     | NULL                |                               |
| Count        | smallint(6) | YES |     | 1                   |                               |
| NumberDone   | int(11)     | YES |     | 0                   |                               |
| Timestamp    | timestamp   | NO  |     | current_timestamp() | on update current_timestamp() |
| Priority     | smallint(6) | YES |     | 0                   |                               |
| Twilight     | float       | YES |     | -12                 |                               |
| Airmass      | char(20)    | YES |     | 3.0                 |                               |
| SunStart     | float       | YES |     | NULL                |                               |
| UTStart      | char(10)    | YES |     | NULL                |                               |
| MoonDistance | float       | YES |     | 30                  |                               |
| MoonPhase    | float       | YES |     | 1                   |                               |
| Earliest     | datetime    | YES |     | NULL                |                               |
| Latest       | datetime    | YES |     | NULL                |                               |
| Interval     | float       | YES |     | NULL                |                               |
| Active       | tinyint(4)  | YES |     | 1                   |                               |
+--------------+-------------+-----+-----+---------------------+-------------------------------+
Notes: If the count field is set to NULL, it has the action of a never ending request going once per night. A Count of 0 will cause the request to be ignored (the request is expired).. A Cascade delete has been placed on this table to the target file so if the request is deleted, the associated targets are also deleted.

The SunStart altitude is not corrected for the elevation of the observatory.

UTStart may contain a dash to allow a span of Universal time start time. For example: 12:12 - 14:30.

Airmass may contain a dash to allow a span of allowable airmasses.

Schedule table - is generated by the telescope scheduler program insgen. It lists the active requests, i.e. those for which the requested number of observations have not been made yet and when they will be observed.

+------------+----------+----+-----+---------------------+--+
| ScheduleID | int(11)  | NO | PRI | 0                   |  |
| RequestID  | int(11)  | NO | PRI | 0                   |  |
| Start      | datetime | NO | UNI | 0000-00-00 00:00:00 |  |
| BlockTime  | int(11)  | NO |     | 0                   |  |
+------------+----------+----+-----+---------------------+--+

Skipped table - is generated by the telescope scheduler program insgen. It lists the active requests that cannot be scheduled. The reasons may be due to errors in the request file, telescope limitations, the fact the celestial object is not up at the right time, or there is no room.

+-----------+------------+-----+-----+------+--+
| SkippedID | int(11)    | NO  | PRI | 0    |  |
| RequestID | int(11)    | NO  | PRI | 0    |  |
| Rejected  | tinyint(1) | YES |     | 0    |  |
| Reason    | char(80)   | YES |     | NULL |  |
+-----------+------------+-----+-----+------+--+

Target table - lists the observations associated with the request.

+-----------+-------------+-----+-----+-------+----------------+
| TargetID  | int(11)     | NO  | PRI | NULL  | auto_increment |
| RequestID | int(11)     | YES | MUL | NULL  |                |
| ObjectID  | int(11)     | YES | MUL | NULL  |                |
| Procedure | char(80)    | YES |     | photo |                |
| Count     | smallint(6) | YES |     | 1     |                |
+-----------+-------------+-----+-----+-------+----------------+
The telescope will point to the fixed object if that is specified, or calculate the position of the orbiting object if that is specified. A Cascade delete has been placed on this table to the Picture file so if the Target is deleted, the associated pictures are also deleted.

Window table - contains information about the request used for graphical display and debugging. It is generated by insgen.

+------------+----------+-----+-----+------+--+
| WindowID   | int(11)  | NO  | PRI | 0    |  |
| ScheduleID | int(11)  | YES | MUL | NULL |  |
| RequestID  | int(11)  | NO  |     | 0    |  |
| UpStart    | datetime | YES |     | NULL |  |
| UpEnd      | datetime | YES |     | NULL |  |
| NightStart | datetime | YES |     | NULL |  |
| NightEnd   | datetime | YES |     | NULL |  |
| BestStart  | datetime | YES |     | NULL |  |
| BestEnd    | datetime | YES |     | NULL |  |
+------------+----------+-----+-----+------+--+

*** Caution: the words Procedure and Interval are MySQL reserved words and have to be properly cited using backquotes or the table name. For example:

SELECT `Interval` FROM Request LIMIT 5;
or SELECT Request.Interval FROM Request LIMIT 5;
SELECT `Procedure` FROM Target LIMIT 5;
or SELECT Target.Procedure FROM Target LIMIT 5;

Weather Description

Mets table contains the weather data. It is filled in by the weatherd daemon.

+--------------------+-------------+-----+-----+---------------------+-------------------------------+
| Timestamp          | timestamp   | NO  | PRI | current_timestamp() | on update current_timestamp() |
| OAT                | float       | YES |     | NULL                |                               |
| WindSpeed          | smallint(6) | YES |     | NULL                |                               |
| windDirection      | smallint(6) | YES |     | NULL                |                               |
| Humidity           | tinyint(4)  | YES |     | NULL                |                               |
| BarometricPressure | float       | YES |     | NULL                |                               |
| Rain               | tinyint(1)  | YES |     | NULL                |                               |
| Cloud              | float       | YES |     | NULL                |                               |
| CCDTemp            | float       | YES |     | NULL                |                               |
| Slit               | tinyint(4)  | YES |     | NULL                |                               |
| Temps              | char(60)    | YES |     | NULL                |                               |
+--------------------+-------------+-----+-----+---------------------+-------------------------------+

CREATING THE DATABASE

There are scripts in ~treffers/Documents/Database that are for creating the database:
RCT Index