The database module for LitePolis that is compatible with ParticiAPP
Project description
LitePolis-database-particiapi
ParticiAPI-compatible database module for LitePolis. This module extends LitePolis-database-default with ParticiAPI-specific models and functionality.
Overview
This module provides:
ParticiapiUser- Extended participant model with ParticiAPI fieldsParticipantExtended- Additional participant metadataParticiapiIssuer- OIDC issuer configurationMathMain- Math results cachingNotificationTasks- Notification queue management
Installation
litepolis-cli deploy add-deps litepolis-database-particiapi
litepolis-cli deploy sync-deps
Configuration
This module shares database configuration with LitePolis-database-default. To customize, create a config file:
litepolis-cli deploy init-config
Then edit ~/.litepolis/litepolis.config:
[litepolis_database_default]
database_url = sqlite:///database.db
# For production:
# database_url = postgresql://user:pass@localhost:5432/litepolis
sqlalchemy_engine_pool_size = 30
sqlalchemy_pool_max_overflow = 50
Or set environment variables:
export DATABASE_URL="postgresql://user:pass@localhost:5432/litepolis"
Models
ParticiapiUser (participants table)
| Column | Type | Description |
|---|---|---|
| pid | INTEGER | Participant ID (primary key) |
| uid | INTEGER | User ID |
| zid | INTEGER | Conversation ID |
| vote_count | INTEGER | Number of votes cast |
| last_interaction | INTEGER | Last activity timestamp (ms) |
| subscribed | BOOLEAN | Email subscription status |
| last_notified | INTEGER | Last notification timestamp (ms) |
| nsli | INTEGER | Not-since-last-interaction flag |
| mod | INTEGER | Moderation status |
| created | DATETIME | Creation timestamp |
ParticipantExtended (participants_extended table)
| Column | Type | Description |
|---|---|---|
| uid | INTEGER | User ID |
| zid | INTEGER | Conversation ID |
| referrer | VARCHAR | HTTP referrer |
| parent_url | VARCHAR | Parent page URL |
| created | DATETIME | Creation timestamp |
| modified | DATETIME | Last modified timestamp |
| subscribe_email | BOOLEAN | Email subscription |
| show_translation_activated | BOOLEAN | Translation feature |
| permanent_cookie | VARCHAR | Persistent cookie |
| origin | VARCHAR | Origin header |
Quick Start
- Install all ParticiAPI modules:
litepolis-cli deploy add-deps litepolis-database-particiapi
litepolis-cli deploy add-deps litepolis-router-particiapi
litepolis-cli deploy add-deps litepolis-ui-particiapp
litepolis-cli deploy sync-deps
- Start LitePolis server:
litepolis-cli deploy serve
Usage
from litepolis_database_particiapi import DatabaseActor
# Get or create participant
participant = DatabaseActor.get_or_create_participant(zid=1, uid=1)
# Record vote
vote = DatabaseActor.do_vote(zid=1, pid=1, tid=1, vote=1)
# Get statements for conversation
statements = DatabaseActor.get_statements(zid=1)
DatabaseActor Methods
| Method | Description |
|---|---|
get_or_create_participant(zid, uid) |
Get or create participant for conversation |
do_vote(zid, pid, tid, vote) |
Record a vote |
get_statements(zid) |
Get all statements for conversation |
get_conversation(zid) |
Get conversation details |
create_statement(zid, pid, text) |
Create new statement |
Development Testing
pip install -e .
pytest tests/
Related Modules
- LitePolis-router-particiapi - ParticiAPI router
- LitePolis-ui-particiapp - ParticiApp frontend
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file litepolis_database_particiapi-0.0.2.tar.gz.
File metadata
- Download URL: litepolis_database_particiapi-0.0.2.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e60f01605f11eaeb14ed20d3be4d5dab65dc040c1db3b095ec525a7168b2fcbb
|
|
| MD5 |
d39b88b3cde5ce64c6e94e50747731df
|
|
| BLAKE2b-256 |
3661bf61a01544c542431b8ecf69230c8026d146c962a4dbe7c2292417ffbe0d
|
Provenance
The following attestation bundles were made for litepolis_database_particiapi-0.0.2.tar.gz:
Publisher:
python-publish.yml on NewJerseyStyle/LitePolis-database-particiapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litepolis_database_particiapi-0.0.2.tar.gz -
Subject digest:
e60f01605f11eaeb14ed20d3be4d5dab65dc040c1db3b095ec525a7168b2fcbb - Sigstore transparency entry: 1171847388
- Sigstore integration time:
-
Permalink:
NewJerseyStyle/LitePolis-database-particiapi@86996c1f5f3e2c315be9ff27fade5bc482aaa061 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/NewJerseyStyle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@86996c1f5f3e2c315be9ff27fade5bc482aaa061 -
Trigger Event:
release
-
Statement type:
File details
Details for the file litepolis_database_particiapi-0.0.2-py3-none-any.whl.
File metadata
- Download URL: litepolis_database_particiapi-0.0.2-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcc3f9c781b9c8b96621c6efa7afc99e982ea0153abd7223193817a1f618386a
|
|
| MD5 |
b072574ae0e184ce598e78c661c02b0d
|
|
| BLAKE2b-256 |
11924f86272f20efe638c38685017be0b39564838a4d348964ddee568302d2da
|
Provenance
The following attestation bundles were made for litepolis_database_particiapi-0.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on NewJerseyStyle/LitePolis-database-particiapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litepolis_database_particiapi-0.0.2-py3-none-any.whl -
Subject digest:
dcc3f9c781b9c8b96621c6efa7afc99e982ea0153abd7223193817a1f618386a - Sigstore transparency entry: 1171847400
- Sigstore integration time:
-
Permalink:
NewJerseyStyle/LitePolis-database-particiapi@86996c1f5f3e2c315be9ff27fade5bc482aaa061 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/NewJerseyStyle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@86996c1f5f3e2c315be9ff27fade5bc482aaa061 -
Trigger Event:
release
-
Statement type: