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

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

<sddl>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- -->
<!--  SDDL Name:    ASN_MEMBERS.SDDL-->
<!-- -->
<!--  Purpose:      This SDDL file defines the ASN_MEMBERS relation.-->
<!-- -->
<!--  Modification History:-->
<!-- -->
<!--    Date       OPR      Who                       Reason-->
<!--  - - - -    - - - -    - -   - - - - - - - - - - - - - - - - - - - - - -->
<!--  05/10/99   39260      Baum  Original implementation-->
<!--  05/18/01   43960      Baum  Add product_status field-->
<lm>  07/03/03   48821     CTB   Converted to XML format </lm> <!-- last mod -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


    <record name="ASN_MEM_TYPE">

        <description>This relation is used for all members (exposure and product)
                   that form an OPUS association. This is one of the
                   relations used to describe OPUS associciations. The other
                   relations are ASN_ASSOCIATION and ASN_PRODUCT_LINK.

                   An association is a set of exposures that will be merged 
                   into products by OPUS pipeline. The full association
                   consists of a list of exposures and products.

                   An association product is a dataset, distinct from any 
                   exposure dataset, that is generated by the pipeline.  
                   Exposures are associated in order to generate products.  
                   For an exposure, the mem_number is two characters and is the
                   same as ob_number.
                   For a product, the mem_number is the combination of the
                   association number within the obset and the product_id.

                   Prior to the collection the member_status for exposures is 
                   'U'. Afterwards, it is either 'C' or 'O'. The value for
                   products is always 'P'.                    

                   Prior to the collection the product_status for products is 
                   'U'. Afterwards, it is either 'C' or 'M'. The value for
                   exposures is always 'E'.</description>
                                     

            <field name="association_id">
                    <type>C9</type>

                    <description>This field identifies an OPUS association.   An
                    association is a set of exposures that will be
                    merged into products by OPUS pipeline calibration
                    processing. The full association consists of a
                    list of exposures and products.  STIS can only have
                    one product per association.  NICMOS can have as
                    few as one and as many as nine products. ACS can have 
                    a single product having a product_id of either '0'
                    (for a dither product) or '1' for a cr-split or
                    repeat-obs product at a single pointing. If there are
                    more than one product the there is always a dither
                    product having the product_id '0' and the other products
                    use product ids that range from '1' to 'I'. 

                    This field completely identifies an association.  It
                    is set by TRANS.  It is used by DADS as the dataset
                    name to archive the association file.  This is the
                    OPUS value used for the keyword ASN_ID.  It has the
                    following format:

                           IPPPSSAAa

                    where:
                           I = instrument code
                               (e.g., N for NICMOS, O for STIS),
                         PPP = program_id
                          SS = obset_id of the first associated exposure,
                         AAa = the two-character sequence (AA = 01,02,...)
                               is unique within the obset SS;
                               plus the product id (a) that is always
                               0 for associations and primary products.</description>
            </field>

            <field name="program_id">
                    <type>C3</type>

                    <description>When a proposal is accepted into the PMDB by SPSS it must
                    be assigned a unique 3 character base 36 program identifier.
                    This is done by the PMDB/ACCEPT_PROP command.  This program
                    identifier is tagged as 'program_id' in most PMDB relations.
                    Is is used for identification of proposals by spacecraft
                    and OPUS software. It is also used in the OPUS and DADS
                    rootname for all archived science data files.
                    Because of flight design software, program_id must be
                    three characters.</description>
            </field>

            <field name="obset_id">
                    <type>C2</type>

                    <description>An observation set is 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.

                    An observation set is identified by a 2 character base 36
                    string.  This field,  typically called 'obset_id', will
                    often contribute to the index on relation together with a
                    proposal_id, version_num, and possibly other fields.

                    OBSET is an abbreviation for observation set.</description>
            </field>

            <field name="member_num">
                    <type>C3</type>
                    <units>BASE_36</units>
                    <description>For exposures, observations are numbered sequentially
                     throughout an observation set and are assigned by SMS/Gen.
                     For exposures the name is two characters and it is the
                     same as the observation ob_number. For products it is the
                     association number (two characters) plus the product_id.</description>
            </field>

            <field name="member_type">
                    <type>C12</type>
                    <description>This field describes the role of the member in the
                         association. If there are multiple products, then the
                         format of the exposure names correlate to the 
                         product names by rules that depend on the SI.

                         For exposures this name must be the same as exp_type
                         in qeassociation.</description>
            </field>

            <field name="member_status">
                    <type>C1</type>
                    <description>This field describes the status of a member of the
                         association. Valid values are:

                         U -- uncollected exposure
                         C -- collected exposure
                         O -- orphan exposure (not collected)
                         P -- product dataset</description>
            </field>
 
            <field name="product_status">
                    <type>C1</type>
                    <description>This field describes the status of a product of the
                         association. Valid values are:

                         U -- uncollected product
                         C -- collected product
                         N -- not collected - missing product after collection
                         E -- exposure (not a product)
                         X -- unknown (only valid for old records)</description>
            </field>
 
    </record>




    <relation name="asn_members">

        <type>ASN_MEM_TYPE</type>

        <description>Association Members Relation</description>

        <subsystem_using>OPUS</subsystem_using>
        <subsystem_using>DADS</subsystem_using>

        <index name="asn_members_1">
            <type>unique clustered</type>
            <field name="association_id"/>
            <field name="program_id"/>
            <field name="obset_id"/>
            <field name="member_num"/>
        </index>

        <index name="asn_members_2">
            <type>nonclustered</type>
            <field name="program_id"/>
            <field name="obset_id"/>
            <field name="member_num"/>
        </index>

    </relation>
</sddl>
