Skip to main content

Wagtail based CAP Editor

Project description

CAP Editor

Upload Python Package

A Wagtail Commmon Alerting Protocol (CAP) Editor python package installable as an app on any wagtail project (version>=4.1).

The Common Alerting Protocol (CAP) provides an open, non-proprietary digital message format for all types of alerts and notifications. It does not address any particular application or telecommunications method. The CAP format is compatible with emerging techniques, such as Web services, as well as existing formats including the Specific Area Message Encoding (SAME) used for the United States' National Oceanic and Atmospheric Administration (NOAA) Weather Radio and the Emergency Alert System (EAS)

The CAP xml response follows the structure of the schema provided at http://docs.oasis-open.org/emergency/cap/v1.2/CAP-v1.2-os.html

Contents

Quick start

1. Install in virualenvironment using pip

pip install capeditor

2. Configure settings

In your settings.py or settings/base.py, within the installed apps, include the rest_framework, rest_framework_xml and capeditor as below:

INSTALLED_APPS = [
    # ...
    'rest_framework',
    'rest_framework_xml',
    'capeditor'
]

Set up restframeworkxml renderers

REST_FRAMEWORK = {
    'DEFAULT_RENDERER_CLASSES': (
        'rest_framework.renderers.JSONRenderer',
        'rest_framework_xml.renderers.XMLRenderer',  # add XMLRenderer
    ),
    'DEFAULT_PARSER_CLASSES': (
        'rest_framework_xml.parsers.XMLParser',
    ),
}

3. Run model migrations

python manage.py migrate

Usage

Creating a CAP Alert

With capeditor successfully installed, both the Alert Listing page and Alert Detail page will be available on wagtail admin interface.

- AlertList
   |_ Alert 1
   |_ Alert 2

Create an Alert Listing Page by adding it as a child page and specifying the title of the page. This page will host a list of all alerts created.

Alert List Page

Create one or more Alert Page by adding it as a child to the Alert Listing Page

Alert Detail Page


Sections in the Alert Page and corresponding XML

The overall Document Object Model of an alert is as below:

Alert DOM

A. Alert Identification

This is the root section of CAP corresponds to:

<alert>
    <!-- ... -->
</alert>

It contains the Message ID (identifier), Sender ID(sender), Sent Dat/Time (sent), Message Status (status), Message Type (msgType), Scope (scope), Restriction (restriction), Addresses (addresses), Note (note), Reference IDs (references) and Incident ids (incidents).

NOTE: Some fields are visible based on selection of different parameters.

Alert Identification

B. Alert Info

This is an optional child section of the Alert Identification Section i.e

<alert>
    <!-- ... -->
    <info></info>
    <info></info>
</alert>

Multiple instances of this section are allowed. It contains the Langauge (langauge), Event Category/Categories (category), Event Type (event), Response Type/Types (responseType), Urgency (urgency), Severity (severity), Certainty (certainty), Audience (audience), Event Code/Codes (eventCode), Effective Date/Time (effective), Onset Date/Time (onset), Expiration Date/Time (expires), Sender Name (senderName), Headline (headline), Event description (description), Instructions (instruction), Information URL (web), Contact Info (contact) and Parameter/Parameters (parameter).

C. Alert Area

This is an optional child section of the Alert Info Section i.e

<alert>
    <!-- ... -->
    <info>
        <area></area>
        <area></area>
    </info>
    <info>
        <area></area>
    </info>
</alert>

Multiple instances of this section are allowed. It contains the Area Description (areaDesc), Area Polygon/Polygons (polygon), Area Circle/Circles (circle), Area Geocode/Geocodes (geocode), Altitude (altitude), Ceiling (ceiling).

Alert Area

D. Alert Resource

This is an optional child section of the Alert Info Section i.e

<alert>
    <!-- ... -->
    <info>
        <resource><resource>
        <resource><resource>
        <area></area>
        <area></area>
    </info>
    <info>
        <resource><resource>
        <area></area>
    </info>
</alert>

Alert Resource

Multiple instances of this section are allowed. It contains the Description (resourceDesc), MIME Type (mimeType), File Size (size), URI (uri), Dereferenced URI (derefUri) and Digest (digest)

Integrations

To integrate the alerts to another wagtail page and include in templates, for example in the home page refer to sandbox folder for sample standalone.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

capeditor-0.2.8.tar.gz (87.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

capeditor-0.2.8-py3-none-any.whl (123.2 kB view details)

Uploaded Python 3

File details

Details for the file capeditor-0.2.8.tar.gz.

File metadata

  • Download URL: capeditor-0.2.8.tar.gz
  • Upload date:
  • Size: 87.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for capeditor-0.2.8.tar.gz
Algorithm Hash digest
SHA256 257bf302bb3c93eb3f671045ac735b601d8cf3db1ec5455cb076796ef872fe0c
MD5 02074f47f5c68079d4db1141889963fc
BLAKE2b-256 7ca3294b7fe06e3254819b97982884a695dbf9f03691dbdbe35347f3cd8fe4e3

See more details on using hashes here.

File details

Details for the file capeditor-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: capeditor-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 123.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for capeditor-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a19464220bba4140c48fd896629c2e52a0bb10a73b0d08c123edfaddc88d265b
MD5 92a4529b222215e04bcf12ac7309900a
BLAKE2b-256 3c1dc7e86e9c692e9efb105616147baff620b14e1560d64c499346925467fdf9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page