1 / 20

Flexbol database : an introduction

Flexbol database : an introduction. PHP/MySQL System management Database design flexbol scripts Time accounting an example Authorization Future. Alexandre BEELEN IAS, Orsay, France. Flexbol database : PHP /MySQL. PHP (http://www.php.net)

leena
Download Presentation

Flexbol database : an introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Flexbol database :an introduction • PHP/MySQL • System management • Database design • flexbol scripts • Time accounting • an example • Authorization • Future Alexandre BEELEN IAS, Orsay, France A. Beelen, IAS, France

  2. Flexbol database : PHP/MySQL • PHP (http://www.php.net) • Script language to create dynamical HTML pages • These pages could be classical HTML pages, but with PHP code. <HTML> <HEAD> <TITLE>Test of PHP</TITLE></HEAD> <BODY> <?php echo “Hello World !"; ?> </BODY> </HTML> • Syntax similar to language C with loans in Perl and Java • PHP scripts are interpreted by the server • The source code is not available from the produced page • Interface with Database : Oracle, Sybase,MySQL, ODBC… • Works on most UNIX/Linux/BSD/NT platform A. Beelen, IAS, France

  3. Flexbol database : PHP/MySQL • MySQL (http://www.mysql.org) • MySQL is a relational database management system. • ODBC compliant • SQL = Strutured Query Language SELECT * FROM database WHERE field0 = 1 • Separate tables instead putting all data in one big storeroom • One database, multiple tables • Tables are linked  speed and flexibility • Possibility to combine data from several tables on request SELECT table1.field1, table2.field3 FROM table1, table2 WHERE table1.field2 = table2.field2 • Multi-users, multi-threaded • Easy interface to/from PHP • Works on most UNIX/Linux/BSD platform A. Beelen, IAS, France

  4. Flexbol database : System management • PHP server • Web scripts  module (Apache, Ms IIIS, Netscape, iPlan ) • In line scripts  PHP executable • Programs with GUI  PHP-GTK • phpMyAdmin  set of tools to manipulate MySQL table • MySQL server • Server on any supported platform • Does not need to be on the same server of the PHP/Web server • Web Server • Apache provide easy interface with PHP & MySQL. • Large variety of platform • Apache Server with PHP module & MySQL ‘currently’ installed on mrt-lx2 MySQL 3.22.32 / 3.23.49a PHP 4.0.0 / 4.1.2 Apache 1.3.12 / 1.3.23 A. Beelen, IAS, France

  5. phpMyAdmin MySQL server PHP/WEB Server HTML Page HTML Page Flex_bol scripts MySQL Database .cat files LOGBOOK.ALL Flexbol database : System management A. Beelen, IAS, France

  6. Flexbol database : Database design • The most critical point • All depends on the design of the database • One table to log the observations • LOGBOOK.ALL  logbook • One table to list the sources • *.CAT  source • One table to rules them all • session A. Beelen, IAS, France

  7. date Observer name Operator name Scan number Obs. flag UT Azimuth Elevation Name of object Type of scan Coordinates of observation corrections Number of subscan Time per subscan (in sec) Type of observation (planet/galactic/extragalactic) Flexbol database : LOGBOOK.ALL • Obs program log example 15-FEB-02 PROJECT: FLEXBOL OBSERVER: lutz OPERATOR: fernando -------------------------------------------------------------------------------------------------------------------------------- SCAN|SOURCE |BAS|LAMBDA |BETA |VEL | |COL*|NULE|SFCZ|UT |AZM|ELV|OFF_1|OFF_2| |ISS|SSTI|BE|FREQUENCY| |LINE |PROCEDURE | | | | | | | | | | | |REF_1|REF_2| | | |BE|FREQUENCY| |LINE -------------------------------------------------------------------------------------------------------------------------------- 7864|HERO-2 | -1|13:24:22.3| 27:29:01| 0|L| -2| 0|-1.9|00:31| 86| 45| 0| 0|H| 16| 10|10|250.00000|L|CONT |ONOFF | | | | | | | | | | | | 150| 0| | | | | | | 7865|HERO-2 | -1|13:24:22.3| 27:29:01| 0|L| -2| 0|-1.9|00:35| 87| 46| 0| 0|H| 16| 10|10|250.00000|L|CONT |ONOFF | | | | | | | | | | | | 150| 0| | | | | | | 7866|HERO-2 | -1|13:24:22.3| 27:29:01| 0|L| -2| 0|-1.9|00:39| 88| 47| 0| 0|H| 16| 10|10|250.00000|L|CONT |ONOFF | | | | | | | | | | | | 150| 0| | | | | | | 7867| 1308+326 | 1|13:08:07.5| 32:36:40| 0|L| -2| 0|-1.9|00:42| 88| 48| 0| 0|H| 4| 30|10|250.00000|L|CONT |POINTING | | | | | | | | | | | | 150| 0| | | | | | | 7868| 1308+326 | 1|13:08:07.5| 32:36:40| 0|L| -2| 1|-1.9|00:45| 83| 53| 0| 0|H| 6| 10|10|250.00000|L|CONT *|FOCUS | | | | | | | | | | | | 150| 0| | | | | | | A. Beelen, IAS, France

  8. Flexbol database : Database design Thelogbooktable : Image of the LOGBOOK.ALL file Unique Identification Scan number Source name Type of observation Correction factor U.T. Azimuth Elevation Number of subscan Time for each subscan Date of observation Observer name Operator name Scan cancelled ? A. Beelen, IAS, France

  9. Project number Source name comments Position of the source Flexbol database : .CAT file The.cat file contains sources list for each project • 150.cat : INDIVIDUAL: SNAM SLAM SBET COMMON: SBAS -1 ! using J 2000.0 coordinates ! !! ********** QSOs at z =2 ************** ! ! SOURCE RA DEC Z Mb ! SNAM= ahso1555 ; SLAM= 00 17 33.3 ; SBET= +15 55 09 ; ! 2.110 -24.7 SNAM= 02250033 ; SLAM= 02 25 47.9 ; SBET= +00 33 29 ; ! 2.092 -24.5 SNAM= 07076909 ; SLAM= 07 26 17.8 ; SBET= +69 09 22 ; ! 2.100 -25.7 SNAM= 09144615 ; SLAM= 09 14 03.6 ; SBET= +46 15 50 ; ! 2.180 -26.1 SNAM= 09144610 ; SLAM= 09 14 04.1 ; SBET= +46 10 45 ; ! 2.180 -24.7 SNAM= 09243701 ; SLAM= 09 24 20.5 ; SBET= +37 01 19 ; ! 2.450 -24.9 SNAM= 09444732 ; SLAM= 09 44 27.2 ; SBET= +47 32 37 ; ! 2.103 -26.5 A. Beelen, IAS, France

  10. Flexbol database : Database design Thesourcestable : List all the sources Source ID Name of the source Position of the source Priority within the project Project number Comments A. Beelen, IAS, France

  11. Flexbol database : Database design Thesessiontable : List all the projects Project number PI name Title of the project Short description Mode of observation Allowed time Time spent Priority of the project Weather condition Remark Path to the command file live example A. Beelen, IAS, France

  12. List all projects List all sources of a project Display the logbook Edit source information Edit projet information db.inc refresh.inc var.inc convert.inc cat.inc Contain all variables Read the cat file Databaseconnectioninformation Refresh database from LOGBOOK.ALL Routine to convert UT to LST Flexbol database : flexbol scripts session.php project.php logbook.php edit_source.php edit_project.php A. Beelen, IAS, France

  13. db.inc cat.inc project.php edit_source.php edit_project.php session.php refresh.inc convert.inc logbook.php Flexbol database : flexbol scripts var.inc A. Beelen, IAS, France

  14. Flexbol database : time accounting • Source matching • 9/10 characters used for extragalactic sources in LOGBOOK.ALL SUBSTRING(logbook.source,1,9) = SUBSTRING(sources.name,1,9) • Overheard time • var.inc : $observation_desc =array("ON-OFF", "MAP",(…) $overhead_time =array( 100, 40, (…) • time computation • refresh.inc : $ptime += ($iss*$ssti)*$flag*(1.+$overhead_time[$proc]*1./100); • project.php : $time[$count++] = $t_ssti*$t_iss; $stime+=$time[$i]*$flag[$i]*(1.+$overhead_time[$proc[$from]]*1./100); (…) $ptime_n+=$stime;(…) A. Beelen, IAS, France

  15. Flexbol database : an example • list_project.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML><HEAD><TITLE>an example of php script</TITLE></HEAD> <BODY> <?php include "db.inc"; // connect to the Db $year_list = array("2001","2002"); foreach ($year_list as $key => $year) { print "<BR>$year<BR>\n"; $query="SELECT logbook.scan FROM logbook, sources WHERE SUBSTRING(logbook.source,1,9) = SUBSTRING(sources.name,1,9) AND sources.project = '$id' AND YEAR(DATE) < ".($year+1)." AND YEAR(DATE) >= $year ORDER BY DATE,SCAN"; $result = mysql_query($query,$db); while(list($scan) = mysql_fetch_row($result) ) { $scan_file = $scan.".fits"; print "$scan\n"; } print "<BR>\n"; } ?> </BODY></HTML> HTML Tag    PHP Tag   Include File  Array definition  Foreach Loop  Print command  SQL Query   While loop  Print Command  A. Beelen, IAS, France

  16. Flexbol database : an example • list_project.php?id=150 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML><HEAD><TITLE>an example of php script</TITLE></HEAD> <BODY> <BR>2001<BR> 4937 4938 (…) 8325 8326 <BR> <BR>2002<BR> 1211 1212 (…) 6943 6944 <BR> <BODY></HTML> A. Beelen, IAS, France

  17. Flexbol database : Authorization • Observer : • Need to access all projects informations • Permission to modify source/project information • priority • source list • Should not have the permission to modify • the flex_bol scripts • the database directly (phpMyAdmin) • Internet : • Restricted access • Permit to each PI to modify his own project information Different pages ? A. Beelen, IAS, France

  18. Flexbol database : Authorization • MySQL • Password protection • User/Password could/must be different of the passwd file • Connection information remains in ONE file (db.inc) <?php $db = mysql_pconnect('localhost','flexible','teide510'); mysql_select_db('flexible',$db); ?> • Password in clear text  Protect the access of this file • Apache/PHP • .htaccess protection • https authentification • Php session (?) A. Beelen, IAS, France

  19. Flexbol database : Future • Security Issue • Observer • Internet • Retrieve the LOGBOOK.ALL directly • Permissions problems • LOGBOOK.ALL bug • Comments database • Web interface • Database backup • Sources identification • now by name • by position • Code optimisation A. Beelen, IAS, France

  20. Flexbol database : Future • Printable forms • PHP can produce pdf files directly • Generate the project tar file automatically • Even send email to PI !! • Statistics • Easy to do with database • New database : • Pointing sources • calibrators • Graphics pages • PHP can produce images dynamically • HTML 3.0/4.0 compatibility • Browser independent • Pages Style • CSS • XML • Last but not least !! • Reduce the data • Write the article • Send it directly to A&A • Open Champagne bottle A. Beelen, IAS, France

More Related