civiqhub

The objects of a CiviqHub Project, in Python, from a token or a file:

project = civiqhub.connect().project()            # the token is read in CIVIQHUB_TOKEN
project = civiqhub.connect(source=civiqhub.MemorySource(rows)).project()
project = civiqhub.load("consultation.json").project()

connect() returns a Client of a Source: the API (ApiSource), a file (FileSource) or memory (MemorySource). What a source gives is a Dataset: a frozen graph of the objects of the product, Group, Project, Article (with ArticleVersion, Paragraph, Placement and Citation), Proposal, Amendment, Revision, Argument, Actant (with Member and Agent) and Vote. They share Listing and Entity, carry the values of civiqhub.values, and raise the errors of civiqhub.errors.

make_project() gives a synthetic Project, which describes nobody, to try the SDK without a token.

civiqhub.__version__

Version of the package, in PEP 440 notation.

Exported names

These names are imported from civiqhub. Each one links to the module that defines it.

Name

What it is

__version__

Version of the package, in PEP 440 notation.

Actant

Anyone who acts in a Project: a human member or an agent.

ActantKind

What an Actant is.

Agent

A software agent that takes part with the same grammar as a member.

Amendment

A Proposal that amends another Proposal, on one Revision of it.

AmendmentStatus

Where an Amendment stands.

ApiSource

The public API of CiviqHub, read with a personal access token. It only sends GET.

Argument

A reasoned stance on a Proposal. Arguments reply to each other as a tree.

Article

An article of a Project: a text in numbered versions, which Proposals belong to.

ArticleVersion

One numbered version of an article, frozen as it was published.

AuthenticationError

Raised when the token is missing, malformed, expired or revoked.

Citation

A Proposal cited in the text of an article that is not its parent article.

CiviqHubError

The root of every error of the SDK.

Client

Reads one source at one level of exposure, and keeps what it read.

connect

Open CiviqHub with a personal access token, or with a source of your own.

Dataset

Everything a source gave at one instant, at one level of exposure, frozen.

DeprecatedValue

A value of an old dataset that the model no longer has, read and marked.

Entity

An object of the product: frozen, known by its id, tied to its dataset.

Exposure

The level of detail that a dataset holds.

ExposureError

Raised when data is asked for at a level of detail the dataset does not hold.

FileSource

A file written by save(), read without network.

Group

A community on CiviqHub. It holds Groups and Projects.

Listing

An ordered, immutable sequence of objects, also searched by id.

load

Reopen a dataset written by save().

make_project

Return a synthetic Project, to try the SDK without a token and without network.

make_rows

Return the rows of a synthetic Project, at the pseudonymised level.

make_truth

Return the planted structure of the synthetic Project, to test what finds it.

Member

A human member of a Project, known by a pseudonym.

MemorySource

Rows held in memory: for tests, simulations and the data of another system.

MissingExtraError

Raised when an analysis is asked for and the engine is not installed.

NotFoundError

Raised when what is asked for is not covered by the token, or does not exist.

Paragraph

A numbered division of an article version, made by a heading of level 1 to 4.

Participation

How much a Project is used, in counts.

Placement

Where a Proposal sits in a version of its parent article: a paragraph and a rank.

Position

The side that an Argument takes.

Project

A Project of a Group: the set of its articles and of their versions.

Proposal

A statement put to the collective of a Project.

RateLimitedError

Raised when the API asks to slow down.

Revision

One numbered version of a Proposal. Votes are cast on a Revision.

Role

The roles in a Group or a Project, from the lowest to the highest.

Source

Anything that gives rows in the format of a dataset: the API, a file, memory.

UnavailableError

Raised when a value is read from an analysis that has none.

ValidationError

Raised when rows break an invariant of the model.

Vote

The vote of one Actant on one Revision, from -2 to +2.

VoteCounts

The five vote counts of a Revision, from score -2 to score +2.

VoteState

Where an Actant stands with a Revision.

Modules