habitat.views.payload_configuration

Functions for the payload_configuration design document.

Contains schema validation and a view by payload name and configuration version.

Functions

callsign_time_created_index_map(doc) View: payload_configuration/callsign_time_created_index
must_be_admin(user[, msg]) Raise UnauthorizedError if the user is not an admin
name_time_created_map(doc) View: payload_configuration/name_time_created
only_validates(doc_type)
read_json_schema(schemaname)
rfc3339_to_timestamp Mock out external modules that might annoy documentation build systems.
validate(new, old, userctx, secobj) Validate payload_configuration documents against the schema and then against specific validation requirements.
validate_doc(data, schema) Validate data against schema, raising descriptive errors
habitat.views.payload_configuration.name_time_created_map(doc)[source]

View: payload_configuration/name_time_created

Emits:

[name, time_created] -> null

In the key, time_created is emitted as a UNIX timestamp (seconds since epoch).

Used to get a list of all current payload configurations, for display purposes or elsewhere where sorting by name is useful.

habitat.views.payload_configuration.callsign_time_created_index_map(doc)[source]

View: payload_configuration/callsign_time_created_index

Emits:

[callsign, time_created, 1] -> [metadata, sentence 1]
[callsign, time_created, 2] -> [metadata, sentence 2]
...
[callsign, time_created, n] -> [metadata, sentence n]

Where metadata is:

{
    "name": doc.name,
    "time_created": doc.time_created (original string),
    "metadata": doc.metadata (if present in doc)
}

(In other words, one row per sentence in this document).

In the key, time_created is emitted as a UNIX timestamp (seconds since epoch).

Useful to obtain configuration documents for a given callsign if it can’t be found via upcoming flights, for example parsing test telemetry or selecting a sentence to copy when making a new document.