Index: /trunk/docs/VOimplementation.tex
===================================================================
--- /trunk/docs/VOimplementation.tex	(revision 128)
+++ /trunk/docs/VOimplementation.tex	(revision 129)
@@ -1,5 +1,6 @@
 \documentclass{article}
 \usepackage{natbib}
-\usepackage{fancyheadings}
+%\usepackage{fancyheadings}
+\usepackage{fancyhdr}
 \usepackage{array}
 \usepackage{xspace}
@@ -19,5 +20,6 @@
 \cfoot{}
 \rfoot{\thepage}
-\setlength{\headrulewidth}{0in}
+\renewcommand{\headrulewidth}{0cm}
+\renewcommand{\footrulewidth}{0cm}
 
 \newcommand{\eg}{e.g.\xspace}
@@ -196,5 +198,30 @@
 The only remaining problem sources as far as positions go are those
 with no positional information in the table. There are 246 rows that
-satisfy this criterion -- how are we going to deal with these?
+satisfy this criterion -- how are we going to deal with these? If they
+have a pulsar name, then we can access the positions somehow and
+manually put them in. However that may be a somewhat labourious
+process...
+
+While adding in the decimal RA \& Dec, we could also add in the proper
+values for the galactic coordinates. These have not been put in the
+database for most/all(?) of the existing data, and so we could do it
+all at once. The code is shown in
+\texttt{sql/create\_new\_obs\_table.sql}: it first creates a temp copy
+of \texttt{observations}, with RA and DEC but without GL and GB. It
+then creates a new table with the following code, calculating the
+values of GL and GB:
+\begin{quote}
+\begin{verbatim}
+SET @ngpra=192.859508, @ngpdec=27.128336, @ascnode=32.932; -- base coords for galactic coord transformation.
+
+CREATE TEMPORARY TABLE newobs
+   SELECT *,
+        case when degrees( atan2( ( sin(radians(decjd))*cos(radians(@ngpdec)) - cos(radians(decjd))*sin(radians(@ngpdec))*cos(radians(rajd-@ngpra)) ) , ( cos(radians(decjd))*sin(radians(rajd-@ngpra)) ) ) ) + @ascnode > 0 
+	     then degrees( atan2( ( sin(radians(decjd))*cos(radians(@ngpdec)) - cos(radians(decjd))*sin(radians(@ngpdec))*cos(radians(rajd-@ngpra)) ) , ( cos(radians(decjd))*sin(radians(rajd-@ngpra)) ) ) ) + @ascnode
+	     else degrees( atan2( ( sin(radians(decjd))*cos(radians(@ngpdec)) - cos(radians(decjd))*sin(radians(@ngpdec))*cos(radians(rajd-@ngpra)) ) , ( cos(radians(decjd))*sin(radians(rajd-@ngpra)) ) ) ) + @ascnode + 360. end as gl,
+	(degrees( asin( cos(radians(decjd))*cos(radians(@ngpdec))*cos(radians(rajd-@ngpra)) + sin(radians(decjd))*sin(radians(@ngpdec))))) as gb
+    FROM temptab;
+\end{verbatim}
+\end{quote}
 
 \newpage
@@ -241,5 +268,6 @@
 	nchan INT,
 	scanlen DOUBLE,
-	tbin DOUBLE,
+	tsamp DOUBLE,
+        nbits INT,
 	PRIMARY KEY (file_id)
 );
@@ -256,5 +284,5 @@
 IGNORE 1 LINES  -- ignore the first line in the csv file (contains the headers)
 (filename,fileloc,hdrver,survey,src_name,raj,decj,rajd,decjd,gl,gb,
-bmaj,bmin,bpa,date_obs,mjd,obsfreq,chanbw,nchan,scanlen,tbin);
+bmaj,bmin,bpa,date_obs,mjd,obsfreq,chanbw,nchan,scanlen,tsamp,nbits);
 \end{verbatim}
 \end{quote}
@@ -296,5 +324,6 @@
 and used to query the database via a dynamic webpage. This .php file
 can also produce an XML file rather than the usual HTML format. The
-way to do this is to have at the start of the php file the expression
+way to do this is to have the following expression at the start of the
+php file:
 \begin{quote}
 \verb|header("Content-type: text/xml");|
@@ -328,8 +357,10 @@
 \begin{enumerate}
 \item NVO at \href{http://www.us-vo.org/pubs/files/PublishHowTo.html}%
-{http://www.us-vo.org/pubs/files/PublishHowTo.html}, linking to three different NVO registries.
-\item Euro-VO, at \href{http://www.euro-vo.org/pub/tc/registries.html}%
-{http://www.euro-vo.org/pub/tc/registries.html}, which also links to
-three different registries.
+  {http://www.us-vo.org/pubs/files/PublishHowTo.html}, linking to
+  three different NVO registries.
+\item Euro-VO, at
+  \href{http://www.euro-vo.org/pub/tc/registries.html}%
+  {http://www.euro-vo.org/pub/tc/registries.html}, which also links to
+  three different registries.
 \end{enumerate}
 
@@ -344,4 +375,67 @@
 Observatory'', at \href{http://www.ivoa.net/Documents/latest/RM.html}%
 {http://www.ivoa.net/Documents/latest/RM.html}.
+
+\newpage
+\section{The web query form}
+This section will layout the rough format of the query form that acts
+as the front-end to the archive. The following options should exist:
+\begin{itemize}
+\item Position query. RA \& Dec should be the default. May be useful
+  to offer the possibility of a query in Galactic coordinates. Will
+  need to be able to switch between these.
+
+  Also need a search radius box. Default units in arcmin? degrees?
+  Allow this to be selectable?
+
+\item Pulsar name. This should accept a pulsar name, be able to deal
+  with a leading letter (\eg J1234$-$5678 and 1234$-$5678 should act the
+  same). This functionality exists, although check that it uses SQL
+  directly and not vap or similar.
+
+\item Time of observation. This should be a range, default values
+  being the range of observation dates in the database (although maybe
+  make final date today's date?). 
+
+  It may be good to make this field selectable as well, so that one
+  can query with MJD rather than date. 
+
+\item Refinement of returned parameters. Since there are different
+  tables with different fields, the way to deal with this might be to
+  make a master list of fields to select from. The queries can then
+  only refer to the relevant ones for their table and set the others
+  to NULL or similar (can we use something like \textit{left outer
+    join}?).
+
+  Perhaps a format similar to that used by
+  Vizier\footnote{\href{http://vizier.u-strasbg.fr/cgi-bin/VizieR}%
+    {http://vizier.u-strasbg.fr/cgi-bin/VizieR} -- see an example
+    catalogue at
+    \href{http://vizier.u-strasbg.fr/viz-bin/VizieR?-source=VIII/34}%
+    {http://vizier.u-strasbg.fr/viz-bin/VizieR?-source=VIII/34}
+    (select ``catalog'').},
+  where it provides a default list of parameters but allows selection
+  of more and querying on them as well.
+
+  The way it is currently set up does not allow querying on these
+  parameters. This is beyond the scope of the current project,
+  although may be worthwhile implementing in the future. Something
+  similar is enabled with the pulsar database (\ie querying on
+  \textit{pulsar} parameters such as period, DM, period-derivative),
+  although there is no data access involved. The difference here is
+  that one would be able to query on the parameters related to the
+  observations (such as \texttt{tsamp, nchan}).
+
+\item The existing webpage has the possibility of restricting the
+  query by specifying what type of data to look for (CPSR2, DFB,
+  WBC). This should be extended to include FB\_1BIT (as for the 70cm
+  data) and MFB (for multibeam-filterbank -- uncertain exactly what to
+  call this at this stage). These need to be included in the database
+  ingest, and be extracted from the database in making the query page.
+
+  The selection of data type could allow more than one selection --
+  this will change how the selection is done in the sql query.
+
+\end{itemize}
+
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -440,28 +534,30 @@
 \begin{table}[h]
 \begin{tabular}{l|l|l|l|l|l}
- Field     & Type                 & Null & Key & Default & Extra\\
-\hline
- file\_id  & smallint(5) unsigned &      & PRI & NULL    & auto\_increment\\
- filename  & varchar(30)          & YES  &     & NULL    &\\
- fileloc   & varchar(100)         & YES  &     & NULL    &\\
- hdrver    & varchar(10)          & YES  &     & NULL    &\\
- survey    & varchar(10)          & YES  &     & NULL    &\\
- src\_name & varchar(20)          & YES  &     & NULL    &\\
- raj       & varchar(15)          & YES  &     & NULL    &\\
- decj      & varchar(15)          & YES  &     & NULL    &\\
- rajd      & double               & YES  &     & NULL    &\\
- decjd     & double               & YES  &     & NULL    &\\
- gl        & decimal(9,4)         & YES  &     & NULL    &\\
- gb        & decimal(9,4)         & YES  &     & NULL    &\\
- bmaj      & float                & YES  &     & NULL    &\\
- bmin      & float                & YES  &     & NULL    &\\
- bpa       & float                & YES  &     & NULL    &\\
- date\_obs & varchar(30)          & YES  &     & NULL    &\\
- mjd       & double               & YES  &     & NULL    &\\
- obsfreq   & double               & YES  &     & NULL    &\\
- chanbw    & double               & YES  &     & NULL    &\\
- nchan     & int                  & YES  &     & NULL    &\\
- scanlen   & double               & YES  &     & NULL    &\\
- tbin      & double               & YES  &     & NULL    &\\
+ Field      & Type                 & Null & Key & Default & Extra\\
+\hline      
+ file\_id   & smallint(5) unsigned &      & PRI & NULL    & auto\_increment\\
+ filename   & varchar(30)          & YES  &     & NULL    &\\
+ fileloc    & varchar(100)         & YES  &     & NULL    &\\
+ hdrver     & varchar(10)          & YES  &     & NULL    &\\
+ survey     & varchar(10)          & YES  &     & NULL    &\\
+ src\_name  & varchar(20)          & YES  &     & NULL    &\\
+ raj        & varchar(15)          & YES  &     & NULL    &\\
+ decj       & varchar(15)          & YES  &     & NULL    &\\
+ rajd       & double               & YES  &     & NULL    &\\
+ decjd      & double               & YES  &     & NULL    &\\
+ gl         & decimal(9,4)         & YES  &     & NULL    &\\
+ gb         & decimal(9,4)         & YES  &     & NULL    &\\
+ bmaj       & float                & YES  &     & NULL    &\\
+ bmin       & float                & YES  &     & NULL    &\\
+ bpa        & float                & YES  &     & NULL    &\\
+ date\_obs  & varchar(30)          & YES  &     & NULL    &\\
+ mjd        & double               & YES  &     & NULL    &\\
+ obsfreq    & double               & YES  &     & NULL    &\\
+ chanbw     & double               & YES  &     & NULL    &\\
+ nchan      & int                  & YES  &     & NULL    &\\
+ scanlen    & double               & YES  &     & NULL    &\\
+ tsamp      & double               & YES  &     & NULL    &\\
+ nbits      & int                  & YES  &     & NULL    &\\
+ data\_type & varchar(16)          & YES  &     & NULL    &\\
 \end{tabular}
 \caption{Fields for the proposed 70cm data table in the mySQL
Index: /trunk/sql/create_table_s70.sql
===================================================================
--- /trunk/sql/create_table_s70.sql	(revision 128)
+++ /trunk/sql/create_table_s70.sql	(revision 129)
@@ -42,5 +42,5 @@
 OPTIONALLY ENCLOSED BY "\""
 IGNORE 1 LINES  -- this ignores the first line in the csv file which contains the column headers.
-(filename,fileloc,hdrver,survey,src_name,raj,decj,rajd,decjd,gl,gb,bmaj,bmin,bpa,date_obs,mjd,obsfreq,chanbw,nchan,scanlen,tbin);
+(filename,fileloc,hdrver,survey,src_name,raj,decj,rajd,decjd,gl,gb,bmaj,bmin,bpa,date_obs,mjd,obsfreq,chanbw,nchan,scanlen,tsamp,nbits);
 
 -- -- add gl and gb columns to the table.
