Example documents

config_docs.json

/*
    Various elements of the system have configuration options set in Couch
    documents, which use specific document IDs.
*/

/*
    parser_config contains configuration for the parser, including which parser
    modules to load and relevant pre-parse filters for each.
*/
"parser_config": {
    "type": "config",
    "modules": [
        {
            "name": "UKHAS",
            "class": "habitat.parser_modules.ukhas_parser.UKHASParser",
            "pre-filters": [
                {
                    "type": "normal",
                    "callable": "habitat.filters.dire_emergency"
                }
            ]
        }
    ]
},

/*
    message_server_config contains configuration for the message server,
    including which sources and sinks to load.
*/
"message_server_config": {
    "type": "config",
    "sinks": [
        "habitat.parser.ParserSink",
        "habitat.archive.ArchiveSink"
    ]
}

/*
    sensor_manager_config lists the libraries that the sensor manager
    should load at startup and the shorthand they should be assigned.

    The example below loads the module habitat.sensors.stdtelem
    and assigns it the shortcut "stdtelem".
*/
"sensor_manager_config": {
   "type": "config",
   "libraries": {"stdtelem": "habitat.sensors.stdtelem"}
}

flight_docs.json

/*
    Flight IDs are CouchDB document IDs.
*/
"c89860d6f68b1f31ac9480ff9f95bb62": {
    "type": "flight",

    /*
        Start and end dates reflect the time period that telemetry for this
        payload will be logged against this flight, typically a 24 hour period
        from the start date.
    */
    "start": 1292771680,
    "end": 1292772670,

    /*
        Name is used to refer to this flight in various user interfaces.
    */
    "name": "Habitat Test Launch",

    /*
        Launch time, timezone and location reflect when and where the launch
        actually happened. Timezone should be a tz db identifier e.g.,
        "Europe/London".
    */
    "launch": {
        "time": 1292771780,
        "timezone": "Europe/London",
        "location": {
            "latitude": 52.2135,
            "longitude": 0.0968
        }
    }

    /*
        Metadata stores various human-readable information about the flight,
        which can be used to identify it and be otherwise informative when
        browsing the archives. These fields are all optional.
    */
    "metadata": {
        "location": "Churchill College, Cambridge, UK",
        "predicted_landing": "Washed up at sea",
        "project": "Habitat",
        "group": "HabHub"
    },

    /*
        Payloads contains complete information on each payload flying in this
        flight.  This includes radio settings and telemetry format.
    */
    "payloads": {
        "habitat": {
            /*
                Radio contains information for actually tuning a radio to
                receive the payload.
            */
            "radio": {
                "frequency": 434.075,
                "mode": "USB"
            },

            /*
                Telemetry contains information for decoding the received audio.
            */
            "telemetry": {
                "modulation": "rtty",
                "shift": 425,
                "encoding": "ascii-8",
                "baud": 50,
                "parity": "none",
                "stop": 2
            },

            /*
                Sentence contains information for parsing the received data
                into useful data.  Protocol reflects what parser module should
                be used, and the rest of this example is specific to UKHAS:
                    * Checksum indicates the checksum function in use
                    * Payload indicates the payload name, the first field
                        of any UKHAS-protocol sentence
                    * Fields is a list of dictionaries containing name,
                        type and (when type is "coordinate") format keys.
            */
            "sentence": {
                "protocol": "UKHAS",
                "checksum": "crc16-ccitt",
                "payload": "habitat",
                "fields": [
                    {
                        "name": "message_count",
                        "type": "int"
                    }, {
                        "name": "time",
                        "type": "time"
                    }, {
                        "name": "latitude",
                        "type": "coordinate",
                        "format": "dd.dddd"
                    }, {
                        "name": "longitude",
                        "type": "coordinate",
                        "format": "dd.dddd"
                    }, {
                        "name": "altitude",
                        "type": "int"
                    }, {
                        "name": "speed",
                        "type": "float"
                    }, {
                        "name": "custom_string",
                        "type": "string"
                    }
                ],
            },

            /*
                Filters is a list of intermediate or post parse filters
                which are applied either before or after the parser
                is used to extract the field information.
                (Pre-filters run on all payloads for a given protocol
                and therefore are configured separately).
                They may be either normal filters, in which case a
                Python path is specified for the function and a
                configuration object may be passed, or hotfix filters,
                in which case the Python code is given as a string making
                up the body of a function that is passed 'message' as its
                parameter.
            */
            "filters": {
                "intermediate": [
                    {
                        "type": "normal",
                        "callable": "habitat.filters.ohnonotagain",
                        "config": {
                            "fubared": true
                        }
                   }
                ],
                "post": [
                    {
                        "type": "hotfix",
                        "code": "return message + '\r\n'"
                    }
                ]
            },

            /*
                Chasers are people out tracking the payloads and moving as they
                do so, and therefore are also transmitting GPS telemetry.
            */
            "chasers": [
                "M0RND",
                "2E0JSO"
            ]
        }
    }
}

listener_docs.json

/*
    Listener information documents use Couch IDs.
*/

"10bedc8832fe563c901596c9000026d3": {
    "type": "listener_info",
    "time_created": 1292772133,
    "time_uploaded": 1292772135,
    "data": {
        "callsign": "M0RND",
        "name": "Adam Greig",
        "location": "Cambridge, UK",
        "radio": "ICOM IC-7000",
        "antenna": "9el 434MHz Yagi"
    }
}

telemetry_docs.json

/*
    Payload telemetry documents have the SHA256 of the sentence string as their
    ID.  This helps avoid the race condition of two people submitting the same
    string at the same time - CouchDB's optimistic concurrency model will block
    two people from creating a document with the same ID, so one will succeed
    and the other backs off, loads the new document and just appends a
    receiver.
*/
"ab2a7300684278180d5d26d614a85139d186a5a09038bbbfcfbfce07f953507b": {
    "type": "payload_telemetry",

    /*
        Estimated received time is calculated based on all the received times
        of individual listeners, who may have inaccurately synchronised clocks
        or be very far out indeed.
    */
    "estimated_time_created": 1292772125,

    /*
        Data is the dict returned by the parser module, containing all the
        useful data from this string, hopefully including a latitude and
        longitude.
    */
    "data": {
        /*
            The name chosen in the parser config for the parser module
            that parsed this telemetry
        */
        "_protocol": "UKHAS",

        /*
            The flight document that was used to determine configuration
            when the message was parsed is here if available
        */
        "_flight": "c89860d6f68b1f31ac9480ff9f95bb62",

        /*
            _raw is the original message string as transmitted by the payload,
            in base64. If the payload used an ascii protocol, and there were no
            errors, and the whole message could be represented as ascii,
            then _sentence is also the original message string, but in ascii
        */
        "_raw": "JCRoYWJpdGF0LDEyMywxMjo0NTowNiwtMzUuMTAzMiwxMzguODU2OCw0Mjg1LDMuNixoYWIqNTY4MQ=="
        "_sentence": "$$habitat,123,12:45:06,-35.1032,138.8568,4285,3.6,hab*5681"

        /*
            The callsign of the payload
        */
        "payload": "habitat",

        /*
            Further data is typically protocol-specific, but the following
            are typical of a telemetry message:
        */

        /*
            Sequential Message ID
        */
        "message_count": 123,

        /*
            GPS Data
        */
        "time": {
            "hour": 12,
            "minute": 45,
            "second": 6
        },
        "latitude": -35.1032,
        "longitude": 138.8568,
        "altitude": 0,
        "speed": 0.0,

        /*
            Other data
        */
        "custom_string": "hab"
    },

    /*
        Receivers is a list of people who received this message, including when
        they think they received it, when habitat got their message and the
        CouchIDs of the last listener position telemetry and listener
        information they sent about themselves.
    */
    "receivers": {
        "M0RND": {
            "time_created": 1292772125,
            "time_uploaded": 1292772130,
            "latest_telemetry": "10bedc8832fe563c901596c900001906",
            "latest_info": "10bedc8832fe563c901596c900038917"
        },
        "M0ZDR": {
            "time_created": 1292772126,
            "time_uploaded": 1292772122,
            "latest_telemetry": "10bedc8832fe563c901596c9000031dd"
            "latest_info": "10bedc8832fe563c901596c9000079fe"
        }
    }
},

/*
    Listener telemetry documents use Couch IDs.
*/
"10bedc8832fe563c901596c900001906": {
    "type": "listener_telemetry",
    "time_created": 1292772138,
    "time_uploaded": 1292772140,
    "data": {
        "callsign": "M0RND",
        "time": {
            "hour": 12,
            "minute": 40,
            "second": 12
        },
        "latitude": -35.11,
        "longitude": 137.567,
        "altitude": 12
    }
}

Table Of Contents

Previous topic

Full Schema

Next topic

Message Data and HTTP Post Format

This Page