Initialize Evaluation module seed
This commit is contained in:
@@ -0,0 +1 @@
|
||||
"""Backend package for the GovOPlaN Evaluation module."""
|
||||
@@ -0,0 +1,100 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from govoplan_core.core.access import CAPABILITY_AUTH_PERMISSION_EVALUATOR, CAPABILITY_AUTH_PRINCIPAL_RESOLVER
|
||||
from govoplan_core.core.modules import (
|
||||
DocumentationTopic,
|
||||
ModuleInterfaceProvider,
|
||||
ModuleInterfaceRequirement,
|
||||
ModuleManifest,
|
||||
PermissionDefinition,
|
||||
RoleTemplate,
|
||||
)
|
||||
|
||||
MODULE_ID = "evaluation"
|
||||
MODULE_NAME = "Evaluation"
|
||||
MODULE_VERSION = "0.1.8"
|
||||
READ_SCOPE = "evaluation:evaluation:read"
|
||||
WRITE_SCOPE = "evaluation:evaluation:write"
|
||||
ADMIN_SCOPE = "evaluation:evaluation:admin"
|
||||
RESPOND_SCOPE = "evaluation:response:write"
|
||||
ANALYZE_SCOPE = "evaluation:result:analyze"
|
||||
|
||||
|
||||
def _permission(scope: str, label: str, description: str) -> PermissionDefinition:
|
||||
module_id, resource, action = scope.split(":", 2)
|
||||
return PermissionDefinition(
|
||||
scope=scope,
|
||||
label=label,
|
||||
description=description,
|
||||
category="Evaluation",
|
||||
level="tenant",
|
||||
module_id=module_id,
|
||||
resource=resource,
|
||||
action=action,
|
||||
)
|
||||
|
||||
|
||||
PERMISSIONS = (
|
||||
_permission(READ_SCOPE, "View evaluations", "Read evaluation templates, runs, responses, and summaries."),
|
||||
_permission(WRITE_SCOPE, "Manage evaluations", "Create and update evaluation templates, runs, invitations, and response windows."),
|
||||
_permission(ADMIN_SCOPE, "Administer evaluations", "Configure tenant-level evaluation policies, retention, and scoring defaults."),
|
||||
_permission(RESPOND_SCOPE, "Respond to evaluations", "Submit and update own evaluation responses where policy allows it."),
|
||||
_permission(ANALYZE_SCOPE, "Analyze evaluation results", "View aggregated evaluation metrics, scoring, exports, and reports."),
|
||||
)
|
||||
|
||||
ROLE_TEMPLATES = (
|
||||
RoleTemplate(
|
||||
slug="evaluation_manager",
|
||||
name="Evaluation manager",
|
||||
description="Create evaluation templates and runs, manage response windows, and analyze results.",
|
||||
permissions=(READ_SCOPE, WRITE_SCOPE, RESPOND_SCOPE, ANALYZE_SCOPE),
|
||||
),
|
||||
RoleTemplate(
|
||||
slug="evaluation_participant",
|
||||
name="Evaluation participant",
|
||||
description="Read assigned evaluations and submit own responses.",
|
||||
permissions=(READ_SCOPE, RESPOND_SCOPE),
|
||||
),
|
||||
)
|
||||
|
||||
DOCUMENTATION = (
|
||||
DocumentationTopic(
|
||||
id="evaluation.module-boundary",
|
||||
title="Evaluation module boundary",
|
||||
summary="Structured questionnaires, feedback, rubrics, scoring, aggregation, and report-ready evaluation results.",
|
||||
body=(
|
||||
"Evaluation owns structured post-process feedback, surveys, scoring, rubrics, recurring "
|
||||
"evaluation runs, aggregation, and export-ready results. It may import poll response "
|
||||
"collections as context, but lightweight decision and availability polls remain owned by Poll."
|
||||
),
|
||||
layer="available",
|
||||
documentation_types=("admin",),
|
||||
audience=("operator", "module_admin", "product_owner"),
|
||||
related_modules=("poll", "scheduling", "calendar", "campaigns", "forms", "forms-runtime", "reporting"),
|
||||
metadata={"seed": True},
|
||||
),
|
||||
)
|
||||
|
||||
manifest = ModuleManifest(
|
||||
id=MODULE_ID,
|
||||
name=MODULE_NAME,
|
||||
version=MODULE_VERSION,
|
||||
dependencies=("access",),
|
||||
optional_dependencies=("poll", "scheduling", "calendar", "campaigns", "forms", "forms-runtime", "files", "reporting", "dashboard", "portal", "mail", "notifications"),
|
||||
required_capabilities=(CAPABILITY_AUTH_PRINCIPAL_RESOLVER, CAPABILITY_AUTH_PERMISSION_EVALUATOR),
|
||||
provides_interfaces=(
|
||||
ModuleInterfaceProvider(name="evaluation.feedback", version="0.1.8"),
|
||||
ModuleInterfaceProvider(name="evaluation.scoring", version="0.1.8"),
|
||||
ModuleInterfaceProvider(name="evaluation.result_aggregation", version="0.1.8"),
|
||||
),
|
||||
requires_interfaces=(
|
||||
ModuleInterfaceRequirement(name="poll.response_collection", version_min="0.1.8", version_max_exclusive="0.2.0", optional=True),
|
||||
),
|
||||
permissions=PERMISSIONS,
|
||||
role_templates=ROLE_TEMPLATES,
|
||||
documentation=DOCUMENTATION,
|
||||
)
|
||||
|
||||
|
||||
def get_manifest() -> ModuleManifest:
|
||||
return manifest
|
||||
Reference in New Issue
Block a user