Skip to content

Civic Transparency – Types (Python)

Strongly-typed Python models for the Civic Transparency specification, built with Pydantic v2.

What This Package Provides

  • Runtime Type Safety: Full validation of civic transparency data structures
  • IDE Support: Complete type hints and autocompletion
  • Schema Compliance: Generated directly from canonical JSON schemas
  • Privacy Compliance: Built-in validation for privacy-preserving data patterns

Types API

ci.transparency.ptag.types.PTagSeries

Bases: BaseModel

generated_at = Field(..., description='UTC timestamp when this PTagSeries was generated (ISO 8601).') class-attribute instance-attribute

interval = Field(..., description='Aggregation interval for time-series data.') class-attribute instance-attribute

model_config = ConfigDict(extra='forbid') class-attribute instance-attribute

points = Field(default_factory=list) class-attribute instance-attribute

topic = Field(..., description='Topic key (e.g., hashtag) this PTagSeries describes.', min_length=1) class-attribute instance-attribute

ci.transparency.ptag.types.PTag

Bases: BaseModel

acct_age_bucket = Field(..., description="Account age bucketed for privacy: e.g., '0-7d', '8-30d', '1-6m', '6-24m', '24m+'.") class-attribute instance-attribute

acct_type = Field(..., description='Declared identity account type.') class-attribute instance-attribute

automation_flag = Field(..., description='Posting method with clear boundaries: manual (direct user interaction), scheduled (user-configured delayed posting), api_client (third-party tools like Buffer/Hootsuite), declared_bot (automated systems with explicit bot declaration).') class-attribute instance-attribute

client_family = Field(..., description='Application class: web, mobile, third_party_api.') class-attribute instance-attribute

content_digest = Field(None, description='Optional privacy-preserving content similarity hash for near-duplicate detection. Fixed 12-character hex values for standard implementations, with platform-configurable length (8-16 characters). Salted daily to prevent cross-dataset correlation. Field may be omitted for platforms preferring exact-match detection.') class-attribute instance-attribute

dedup_hash = Field(..., description='Privacy-preserving rolling hash for duplicate detection (8-16 hex characters, salted daily to prevent cross-dataset correlation).') class-attribute instance-attribute

media_provenance = Field(..., description='Embedded authenticity: c2pa_present, hash_only, none.') class-attribute instance-attribute

model_config = ConfigDict(extra='forbid') class-attribute instance-attribute

origin_hint = Field(None, description="Optional geographic origin limited to country-level (ISO country codes) or major subdivisions only for populations >1M, e.g., 'US', 'US-CA', where lawful.") class-attribute instance-attribute

post_kind = Field(..., description='Content relationship: original, reshare, quote, reply.') class-attribute instance-attribute