Skip to main content

openIMIS Backend Home Messages Module

Home Messages provides Django models and GraphQL operations for messages and their file or URL attachments in openIMIS.

Assembly integration

Register the module in the backend assembly's openimis.json:

{
  "name": "notice",
  "pip": "git+https://github.com/openimis/openimis-be-home-messages_py.git@develop#egg=openimis-be-notice"
}

develop is a development example. Pin a reviewed commit or release tag for a reproducible deployment. Follow the assembly's dependency-generation and installation workflow after changing its manifest.

Keep the assembly name as notice: the distribution name and Django import name are different. The assembly must also provide Core and Location, which supply base models, GraphQL helpers, configuration, and health facilities.

For an editable local checkout in the backend environment:

pip install -e /path/to/openimis-be-home-messages_py

If replacing an installed openimis-be-notice distribution, uninstall that distribution before installing the renamed one. Both provide the same notice Python package and should not be installed together. Existing Docker checkouts may still use /app/modules/openimis-be-notice_py; use the actual checkout path.

On a new installation, run the assembly's normal Django migrations. The rename itself requires no new migration or data reset.

Models

Both message and attachment models inherit core.models.VersionedModel.

Model Database table Purpose
Notice tblNotices Message content, priority, audience, and publication fields
NoticeAttachment tblNoticeAttachments File or URL attachments linked to a message
NoticeMutation notice_NoticeMutation Links messages to Core mutation logs

Messages

Notice uses an integer id primary key and a separate unique, 36-character uuid. It stores:

  • title: up to 255 characters at the model level.
  • description: message content.
  • priority: LOW, MEDIUM, or HIGH; the model default is MEDIUM.
  • health_facility: optional audience restriction; null represents no specific facility.
  • created_at, updated_at, and inherited validity/history fields.
  • is_active, schedule_publish, and optional publish_start_date.
  • audit_user_id.

Publication fields describe stored state; clients should not assume that the existence of scheduling fields alone guarantees an automatic publishing workflow.

Attachments

NoticeAttachment has an integer primary key and a separate unique UUID. Its notice foreign key uses the reverse relation notice_attachments.

general_type is FILE or URL. Other fields include title, type description, date, filename, MIME type, URL, and Base64 document content. The module field retains the value notice for compatibility.

GraphQL

The API retains its existing Notice names. Queries return Relay connections with totalCount, pageInfo, and edges { node { ... } }.

Queries

  • notices: paginated message lookup, with filters defined in notice/gql_queries.py. Retrieve one message using its uuid filter; there is no separate singular notice query registered by this module.
  • noticeAttachments: paginated attachment lookup, including notice_Uuid filtering.

Example:

query PublishedMessages {
  notices(isActive: true, first: 10) {
    totalCount
    pageInfo {
      hasNextPage
      endCursor
    }
    edges {
      node {
        uuid
        title
        description
        priority
        createdAt
        isActive
        healthFacility { code name }
        attachmentCount
      }
    }
  }
}

Use the returned cursor with after to request subsequent pages. Supported query filters include title and description containment, priority, active status, publication dates, and health-facility fields. showHistory controls the resolver's default validity filtering; consult the schema for exact generated argument names.

Mutations

  • createNotice
  • updateNotice
  • deleteNotice
  • toggleNoticeStatus
  • createNoticeAttachment
  • updateNoticeAttachment
  • deleteNoticeAttachment

Input definitions and validation are implemented in notice/gql_mutations.py. Message mutation-log links are handled through the Core mutation signal integration in notice/schema.py.

Permissions and row security

Permission defaults are loaded through core.models.ModuleConfiguration under the module name notice.

Configuration key Default permission
gql_query_notices_perms 112001
gql_mutation_create_notices_perms 112002
gql_mutation_update_notices_perms 112003
gql_mutation_delete_notices_perms 112004
gql_mutation_toggle_notice_status_perms 112005
gql_mutation_send_notice_email_perms 112006
gql_mutation_send_notice_sms_perms 112007

Email/SMS permission settings do not imply that separate email/SMS mutations are registered in this module's schema.

When the assembly enables ROW_SECURITY, the message queryset limits non-admin users to messages without a facility restriction or messages for their own facility. Superusers and IMIS administrators bypass that facility restriction. Anonymous users receive no message rows through this queryset when row security is enabled. Query permission checks also apply.

Configuration

notice/apps.py defines DEFAULT_CFG and loads overrides when the app initializes. Besides permissions, declared defaults include:

Key Default
notice_max_length_title 100
notice_max_length_description 1000
notice_priority_options ["Low", "Medium", "High"]
notice_default_priority "Low"
notice_max_restore null
notice_email_enabled true
notice_sms_enabled true
notice_attachments_root_path null
allowed_domains_attachments []

These are application configuration defaults, not a replacement for model definitions or mutation validation. For example, the model's priority default is MEDIUM, while the configuration declares Low. Check the consuming code before relying on a setting to change behavior.

Rename compatibility

The repositories are now openimis-be-home-messages_py and openimis-fe-home-messages_js. The Python distribution is openimis-be-notice: the assembly installs each module as openimis-be-<name> and imports it as <name>, so the distribution follows the notice app name. Imports, the Django app label, configuration namespace, GraphQL names, database tables, and migration history are notice too.

Do not rename the notice/ directory or rewrite historical migrations as part of this package rename. Existing installations retain their data. Local checkout folders may keep their previous names.

Changing repository metadata does not publish a PyPI release. Use the Git source above, an editable checkout, or an available published release.

Source map

  • setup.py: distribution metadata and declared dependencies.
  • notice/apps.py: app registration and configuration defaults.
  • notice/models.py: database models.
  • notice/schema.py: query/mutation registration and mutation signals.
  • notice/gql_queries.py: GraphQL types, filters, and message row security.
  • notice/gql_mutations.py: mutation inputs and behavior.
  • notice/migrations/: database migration history.

Metadata

Release files for openimis-be-notice 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openimis-be-notice 1.0.0
File Size Uploaded Provenance Actions
openimis_be_notice-1.0.0.tar.gz 20.6 kB Without provenance Details for openimis_be_notice-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openimis-be-notice 1.0.0
File Interpreter ABI Platform Actions
openimis_be_notice-1.0.0-py3-none-any.whl Python 3 none any Details for openimis_be_notice-1.0.0-py3-none-any.whl

Total release size: 40.9 kB

Release files / openimis_be_notice-1.0.0.tar.gz

Download URL openimis_be_notice-1.0.0.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b680ac6973ce1c3db24f83f90746356d87888931c6fb2d82177bd6574094dd48
BLAKE2b-256 checksum
How to use checksums
c1f37db811c7fef4ee90c25c0f49a1c5fd66e4411c4c5021fea36688c47aa1e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Release files / openimis_be_notice-1.0.0-py3-none-any.whl

Download URL openimis_be_notice-1.0.0-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
665d39d6219475e9c16df9bf8413af52639cfdab0e019f1d2b7779a42d26d0c4
BLAKE2b-256 checksum
How to use checksums
d199cc56e0e344f725f0b428006328fb2c67c5ceb0e79b708017b0894a7923cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Security for openimis-be-notice 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page