# Example of a survey configuration file.
#
# These files, of which there should be one per project,
# describe where to find the relevant data and other
# parameters of interest.


archived: true # If true, the data in the database will be “frozen”.
id: EQ20211 # Not used. See bin/create_survey.sh
name: "Snorre" # Not used. See bin/create_survey.sh
schema: survey_1 # This must be the schema returned by bin/create_survey.sh
epsg: 23031 # The EPSG code used in bin/create_survey.sh
binning: # P6 data. Eventually will be replaced with the location of the P6 file.
    theta: 206.47 # Direction of I axis, degrees
    I_inc: 1 # Increment along I
    J_inc: 1 # Increment along J
    I_width: 12.50 # Inline bin width
    J_width: 12.50 # Crossline bin width
    origin:
        easting: 479735.00
        northing: 6565048.00
        I: 5000
        J: 1000
preplots: # List of preplot files
    -
        type: sps # Always "sps"
        class: "S" # Source preplots
        path: /srv/Data/EQ20211/preplots/Preplot_Source.sps
        format:
            # The “SPS” files seen in the wild all have different layouts. Rather than
            # forcing our own choice of layout upon the user, we let him describe what
            # his files look like.
            # This is done by providing:
            # * a list of field widths (negative values cause that number of columns to be skipped)
            # * a list of field names, its length must equal the number of positive field widths
            # * a list of type conversions – this is the name of a Python function to which the
            #   value will be passed. An exception is that `int` is our own custom function that
            #   can take a string like "3.0" without barfing.
            widths: [ -1, 10, 10, -25, 10, 10 ]
            names: [ "line_name", "point_number", "easting", "northing" ]
            types: [ "int", "int", "float", "float" ]
    -
        type: sps
        class: "V" # Vessel preplots
        path: /srv/Data/EQ20211/preplots/Preplot_Vessel.sps
        format:
            widths: [ -1, 10, 10, -25, 10, 10 ]
            names: [ "line_name", "point_number", "easting", "northing" ]
            types: [ "int", "int", "float", "float" ]

raw:
    # This section tells us where to find the raw data and what kind it is.
    # (raw data is what is produced by the navigation system during or right after acquisition)


    ntbp:
        # This section tells us how to identify NTBP (not to be processed) sequences.
        # We match the following regular expression pattern against the full path, not
        # just the file name. The pattern applies both to P1/90 and P1/11 files.
        pattern:
            regex: NTBP
            flags: i


    p190: # Use this section if you have P1/90 raw files
        timestamp_format: "%d%m%Y" # Different software can't seem to agree on what format to use
        pattern:
            # Some of the information we want is not even *in* the P1/90 but is conveyed
            # via the file name. So we parse the file name via a regular expression to
            # get those details. There are two items of data that we *must* get from the
            # file name: the sequence and the sailline number.
            # The following items are:
            # * regex: a Python (and ideally JavaScript) compatible regular expression
            # * flags: regular expression flags
            # * captures: the capture groups. "line" and "sequence" are required.
            regex: '^.*(10|20)([0-9]{4})([0-9])([0-9]{3})S00000\.([0-9]+)\.[Pp]?190$'
            flags: i
            captures: [ "direction", "line", "attempt", "sequence", "file_no" ]
        globs:
            # A list of glob expressions to capture P1/90 files
            - "*.P190"
        paths:
            # A list of directories to search for P1/90 files
            - /srv/Data/EQ20211/_live/raw

    p111: # Use this section if you have P1/11 raw files (recommended)
        pattern:
            regex: '^.*(10|20)([0-9]{4})([0-9])([0-9]{3})S00000(\.([0-9]+))?\.[Pp]?111$'
            flags: i
            captures: [ "direction", "line", "attempt", "sequence", "(ignore)", "file_no" ]
        globs:
            - "**/*.P111"
            - "**/*.p111"
        paths:
            - /srv/Data/EQ20211/_live/raw


final:
    # This section is analogue to "raw" above, but for final data.
    # (final data is what is given to the client)
    p190:
        timestamp_format: "%d%m%Y"
        pattern:
            regex: '^.*(10|20)([0-9]{4})([0-9])([0-9]{3})S00000\.([0-9]+)\.[Pp]?190$'
            flags: i
            captures: [ "direction", "line", "attempt", "sequence", "file_no" ]
        globs:
            - "*.190"
            - "*.p190"
            - "*.P190"
        paths:
            - /srv/Data/EQ20211/_live/final


labels:
    FDSP:
        view:
            colour: "#80CBC4"
            description: "First shot of the day"
        model:
            user: false
            multiple: false
    FSP:
        view:
            colour: "#03A9F4"
            "description": "First shot point"
        model:
            user: true
            multiple: false
    FGSP:
        view:
            colour: "light-blue darken-1"
            "description": "First good shot point"
        model:
            user: true
            multiple: true
    FOSP:
        view:
            colour: "light-blue darken-2"
            "description": "First overlap shot point"
        model:
            user: true
            multiple: true
    Guns:
        view:
            "colour": "#F48FB1"
            "description": "Gun events"
        model:
            user: true
            #multiple: true # This is the default
    LDSP:
        view:
            colour: "#4DB6AC"
            description: "Last shot of the day"
        model:
            user: false
            multiple: false
    LSP:
        view:
            colour: "#00BCD4"
            description: "Last shot point"
        model:
            user: true
            multiple: false
    LGSP:
        view:
            colour: "cyan darken-1"
            "description": "Last good shot point"
        model:
            user: true
            multiple: true
    LOSP:
        view:
            colour: "cyan darken-2"
            "description": "Last overlap shot point"
        model:
            user: true
            multiple: true
    Nav:
        view:
            colour: "#EF9A9A"
            description: "Navigation events"
        model:
            user: true
            multiple: true
    Nav Proc:
        view:
            colour: "#FFCC80"
            description: "Navigation processing events"
        model:
            user: true
            multiple: true
    Weather:
        view:
            colour: "blue accent-1"
            description: "Weather information"
        model:
            user: true
            multiple: true
    Missed shot:
        view:
            colour: "red darken-1"
            description: "Missing shot"
        model:
            user: false
            multiple: true
    NTBP:
        view:
            colour: "red"
            description: "Not to be processed"
        model:
            user: true
            multiple: true
    QC Error:
        view:
            colour: "#FF0000"
            description: "This shot fails one or more QC checks"
        model:
            user: false
            multiple: true
    Daily:
        view:
            colour: "#C0C0C0"
            description: "Of interest in the daily report"
        model:
            user: true
            multiple: true
    Weekly:
        view:
            colour: "#C0C0C0"
            description: "Of interest in the weekly report"
        model:
            user: true
            multiple: true
    Final report:
        view:
            colour: "#C0C0C0"
            description: "Of interest in the final report"
        model:
            user: true
            multiple: true
    Shift handover:
        view:
            colour: "#C0C0C0"
            description: "Of interest during shift handover"
        model:
            user: true
            multiple: true
# NOTE to self:
# insert into labels (select ld.key as name, ld.value as data from file_data fd, json_each(fd.data->'labels') ld);

events:
    presetRemarks:
        -
            text: Navigation
            items:
                -
                    text: Online
                    labels: [ Nav ]
                    items:
                        - text: Strong currents
                        - text: Bridge takes control
                        - text: Back on autopilot
                        - text: Start deviation
                -
                    text: Processing
                    labels: [ "Nav Proc" ]
                    items:
                        - text: Lost DGPS
                        - text: Lost RGPS
        -
            text: Gunners
            labels: [ Guns ]
            items:
                -
                    text: Port array
                    items:
                        -
                            text: GS6
                            items:
                                - text: GS6 Autofire
                                - text: "GS6 Swapped guns: "
                                - text: "GS6 Hydrophone dead: "
                                - text: "GS6 Depth sensor dead: "
                        -
                            text: GS5
                            items:
                                - text: GS5 Autofire
                                - text: "GS5 Swapped guns: "
                                - text: "GS5 Hydrophone dead: "
                                - text: "GS5 Depth sensor dead: "
                        -
                            text: GS4
                            items:
                                - text: GS4 Autofire
                                - text: "GS4 Swapped guns: "
                                - text: "GS4 Hydrophone dead: "
                                - text: "GS4 Depth sensor dead: "
                -
                    text: Starboard array
                    items:
                        -
                            text: GS3
                            items:
                                - text: GS3 Autofire
                                - text: "GS3 Swapped guns: "
                                - text: "GS3 Hydrophone dead: "
                                - text: "GS3 Depth sensor dead: "
                        -
                            text: GS2
                            items:
                                - text: GS2 Autofire
                                - text: "GS2 Swapped guns: "
                                - text: "GS2 Hydrophone dead: "
                                - text: "GS2 Depth sensor dead: "
                        -
                            text: GS1
                            items:
                                - text: GS1 Autofire
                                - text: "GS1 Swapped guns: "
                                - text: "GS1 Hydrophone dead: "
                                - text: "GS1 Depth sensor dead: "
        -
            text: Bridge
            items:
                - text: Bridge takes control
                - text: Back on autopilot
        -
            text: HSE
            labels: [ HSE ]
            items:
                - text: Toolbox meeting
