<?xml version="1.0" encoding="UTF-8"?>

<!-- <!DOCTYPE sddlschema SYSTEM "sddlschema.xsd">-->

<sddl>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- -->
<!--  SDDL Name:    QOARCHIVES.SDDL     -->
<!-- -->
<!--  Purpose:      This SDDL file defines relation QOARCHIVES-->
<!-- -->
<!--  Modification History:-->
<!-- -->
<!--    Date       OPR      Who                    Reason-->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!--  18-SEP-96    31905    MARose         Original-->
<!--  07/03/03   48821     CTB   Converted to XML format -->
<!--  12/23/03   49797     Gardner   Make index unique   -->
<!--  12/13/10   38534     MSwam     add missing data tracking fields -->
<!--  02/15/11   67511     MSwam     change rs_errsegs to rserrsegs -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <record name="QOARCH_TYPE">
           <description>This SDDL file defines relation QOARCHIVES.  A record
                  is appended to this relation when the OPUS data 
                  partitioning process determines the name of the ipppssoot
                  from the science POD file.  Any pipeline process that
                  subsequently has trouble processing science data will
                  update the trouble_flag and trbl_process fields.  
                  Fields are present to record missing or errored data
                  found in the original POD file via the QAC and other methods.
                  Archive processing updates a number of fields in QOARCHIVES.</description>
  

           <field name="program_id">
                   <type>C*3</type>
                   <description>Unique 3 character base 36 program identifier for
                        the proposal for which this observation is a part.
                        Used with the obset_id, ob_number, and data_class
                        fields to form the observation 'rootname', which 
                        uniquely identifies an observation.</description>
           </field>

           <field name="obset_id">
                   <type>C*2</type>
                   <description>A collection of one or more alignments that are 
                        grouped together based on FGS pointing requirements.
                        That is, if multiple alignments can all be executed 
                        using the same guide star pair, they are grouped
                        into the same observation set.  Part of the OPUS 
                        rootname.</description>
           </field>

           <field name="ob_number">
                   <type>C*2</type>
                   <description>Observations are numbered sequentially throughout
                        an observation set and are assigned by sms
                        (base 36 number max. 1295 observations per obset).
                        Part of the OPUS rootname.</description>
           </field>

           <field name="data_class">
                   <type>C*1</type>
                   <description>Type of data (R real-time, T tape-recorded, etc).</description>
           </field>

           <field name="obs_root">
                   <type>C*9</type>
                   <description>The ipppssoot, where
                        
                        i   = instrument code (N - NICMOS
                                               O - STIS
                                               U - WFPC2
                                               V - HSP
                                               W - WFPC1
                                               X - FOC
                                               Y - FOS
                                               Z - HRS)
                        ppp = program_id
                        ss  = obset_id
                        oo  = ob_number
                        t   = data_class</description>
           </field>

           <field name="proc_strt_tm">
                   <type>C*16</type>
                   <description>Time pipeline processing for this dataset.  Format
                        is yyyydddHHMMSSsss.</description>
           </field>

           <field name="proc_stop_tm">
                   <type>C*16</type>
                   <description>Time pipeline processing completed for this dataset.  
                        Format is yyyydddHHMMSSsss.</description>
           </field>

           <field name="data_eval">
                   <type>I*4</type>
                   <description>obsolete field??</description>
           </field>

           <field name="flg_mismatch">
                   <type>C*1</type>
                   <description>archive flag for file count mismatches</description>
           </field>

           <field name="geis_only">
                   <type>C*1</type>
                   <description>obsolete field??</description>
           </field>

           <field name="calib_indic">
                   <type>I*2</type>
                   <description>obsolete field??</description>
           </field>

           <field name="trouble_flag">
                   <type>C*1</type>
                   <description>Set to 'T' if observation sent to 'trouble'.</description>
           </field>

           <field name="trbl_process">
                   <type>C*6</type>
                   <description>Name of process that sent observation to 'trouble'.</description>
       
           </field>

           <field name="edsci_file">
                   <type>C*9</type>
                   <description>obsolete field??</description>
           </field>

           <field name="edt_archdate">
                   <type>C*20</type>
                   <description>DADS ARCHDATE for EDT archive class.  Format is 
                        yyyydddHHMMSSsss.</description>
           </field>

           <field name="edt_fcnt">
                   <type>I*2</type>
                   <description>File count for EDT archive class.</description>
           </field>

           <field name="calib_file">
                   <type>C*9</type>
                   <description>obsolete field??</description>
           </field>

           <field name="cal_archdate">
                   <type>C*20</type>
                   <description>DADS ARCHDATE for CAL archive class.  Format is 
                        yyyydddHHMMSSsss.</description>
           </field>

           <field name="cal_fcnt">
                   <type>I*2</type>
                   <description>File count for CAL archive class.</description>
           </field>

           <field name="cdbs_data">
                   <type>C*15</type>
                   <description>obsolete field??</description>
           </field>

           <field name="repro_flg">
                   <type>C*10</type>
                   <description>obsolete field.</description>
           </field>

           <field name="data_problems">
                   <type>C*1</type>
                   <description>Set to 'T' if missing or errored data was tallied.</description>
           </field>

           <field name="rserrsegs">
                   <type>I*2</type>
                   <description>count of segments with Reed-Solomon errors. Sets data_problems = 'T'</description>
           </field>

           <field name="fillsegs">
                   <type>I*2</type>
                   <description>count of segments with fill added. Sets data_problems = 'T'</description>
           </field>

           <field name="nmissing">
                   <type>I*2</type>
                   <description>count of missing data sections. Sets data_problems = 'T'</description>
           </field>

           <field name="missing_reads">
                   <type>I*2</type>
                   <description>count of missing detector readouts. Sets data_problems = 'T'</description>
           </field>

    </record>


    <relation name="qoarchives">

        <type>QOARCH_TYPE</type>

        <description>History of science data processing for a given 
                 observation</description>

        <subsystem_using>OPUS</subsystem_using>

        <index name="qoarchives_1">
            <type>unique clustered</type>
            <field name="program_id"/>
            <field name="obset_id"/>
            <field name="ob_number"/>
            <field name="proc_strt_tm"/>
        </index>

        <index name="qoarchives_2">
            <type>nonclustered</type>
            <field name="obs_root"/>
        </index>

        <index name="qoarchives_3">
            <type>nonclustered</type>
            <field name="proc_strt_tm"/>
        </index>

    </relation>


    <instance  name="QOARCHIVES" scope="global" type="QOARCH_TYPE" />

</sddl>
