Skip to content

FWTX-DAO/fwtx-wiki-engine

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Fort Worth Wiki Logo

Fort Worth Wiki Engine

A knowledge graph-based wiki for Texas municipal information, powered by GraphRAG and implementing the Texas Ontology Protocol (TOP)
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Texas Ontology Protocol (TOP)
  5. Roadmap
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgments

About The Project

Fort Worth Wiki provides citizens with intelligent access to Fort Worth municipal information through state-of-the-art Knowledge Graph Retrieval-Augmented Generation (GraphRAG). This project introduces the Texas Ontology Protocol (TOP), a standardized framework for modeling Texas municipal and county government structures in knowledge graphs.

Key Features:

  • Temporal Knowledge Graph: Bi-temporal data model tracking both event occurrence and data recording times
  • Texas-Specific Ontology: Models home-rule cities, council-manager government, and Texas Local Government Code structures
  • GraphRAG-Powered Search: Combines graph traversal with LLM-based retrieval for intelligent query responses
  • AI Research Agents: Autonomous agents using Agno framework with OpenAI for live data collection
  • Live Data Synchronization: Scheduled updates from official Fort Worth sources
  • Interactive Web Client: Modern UI with graph visualization and chat interface
  • Entity Resolution: Automatic deduplication using embeddings and similarity search
  • Open Source Protocol: TOP provides a reusable standard for any Texas municipality

Built With

  • Python
  • FastAPI
  • FalkorDB
  • Graphiti
  • OpenAI
  • Agno
  • [![Cytoscape.js][Cytoscape]][Cytoscape-url]

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • Python 3.13+
  • Docker (for FalkorDB)
  • uv (recommended for Python package management)
    curl -LsSf https://astral.sh/uv/install.sh | sh

Installation

  1. Clone the repo

    git clone https://github.com/FWTX-DAO/fwtx-wiki-engine.git
    cd fwtx-wiki-engine
  2. Install Python dependencies

    uv sync
  3. Set up environment variables

    cp .env.example .env

    Edit .env and add your:

    • OPENAI_API_KEY (required for embeddings/LLM)
    • Optional: OPENAI_MODEL (defaults to gpt-4o-mini), OPENAI_API_BASE for custom endpoints
    • Optional: API authentication key, PostgreSQL settings
  4. Start FalkorDB

    docker run -p 6379:6379 -p 3000:3000 -it --rm falkordb/falkordb:latest
  5. Initialize the knowledge graph (first time only)

    # Option 1: Load TOP-compliant base data (recommended)
    uv run init_top_data.py
    
    # Option 2: Reset database and load all data
    uv run reset_and_init.py

    This will:

    • Build graph indices following Texas Ontology Protocol (TOP)
    • Create complete Fort Worth government structure
    • Process data from data/ directory (JSON, PDFs, Markdown)
    • Extract entities: City, Mayor, Council Members, Departments
    • Create relationships: governance, representation, administration
    • Optionally fetch live data using AI research agents
  6. Run the application

    uv run wiki.py
  7. Access the web interface Open your browser to http://localhost:8001

Optional: Enable Automated Data Sync

To enable automated data synchronization:

# Add to your .env file
ENABLE_SYNC_SCHEDULER=true
SYNC_INTERVAL_HOURS=24  # How often to sync data

Usage

Web Interface

The Fort Worth Wiki includes a modern web client interface accessible at http://localhost:8001

Features:

  • Knowledge Graph Visualization: Interactive graph view using Cytoscape.js
  • AI-Powered Chat: Natural language queries with suggested questions
  • Real-time Updates: Live connection status and graph refresh
  • Export Functionality: Download graph data for analysis

API Endpoints

# Chat with the knowledge graph (GraphRAG)
POST /chat
{
  "message": "Who is the current mayor of Fort Worth?"
}

# Trigger AI research on a specific topic
POST /api/research/topic
{
  "topic": "city budget",
  "data_requirements": ["total_budget", "department_allocations"]
}

# Manual data synchronization
POST /api/sync/trigger

# Get sync status
GET /api/sync/status

Example Queries:

  • "What are the requirements for a home-rule city in Texas?"
  • "Show me the city council districts and their representatives"
  • "When are the next municipal elections?"
  • "What ordinances were passed in the last month?"
  • "How does Fort Worth's government structure work?"

For more examples, please refer to the API Documentation

Texas Ontology Protocol

The Texas Ontology Protocol (TOP) is a comprehensive standard for modeling Texas municipal and county government structures in knowledge graphs. It provides:

  • Standardized entity types for Texas government structures (home-rule cities, council-manager form, etc.)
  • Temporal modeling patterns for tracking political terms, elections, and legislative changes
  • Spatial relationships for districts, precincts, and annexations
  • Interoperability with W3C standards (ORG, FOAF, GeoSPARQL, OWL-Time)

See artifacts/TOP.md for the complete specification.

Roadmap

  • Define Texas Ontology Protocol (TOP)
  • Implement temporal knowledge graph with FalkorDB
  • Complete chat API implementation with GraphRAG
  • Add AI agent system for live data research
  • Implement GraphRAG query engine with Graphiti
  • Create citizen-friendly web interface
  • Add automated data synchronization with scheduler
  • Extend to support multiple Texas municipalities
  • Add more data sources (county, state integration)
  • Implement real-time event streaming

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature-texas-cyber-awesomeness)
  3. Commit your Changes (git commit -m 'Add sure-texas-cyber-awesomeness')
  4. Push to the Branch (git push origin feature-texas-cyber-awesomeness)
  5. Open a Pull Request

Focus Areas for Contributions:

  • Implementing additional Texas municipality ontologies
  • Enhancing the GraphRAG query engine
  • Adding more data sources and ingestion pipelines
  • Improving entity resolution algorithms
  • Creating visualization tools for the knowledge graph

Top contributors:

contrib.rocks image

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

FWTX DAO - @FWTXDAO - [email protected]

Project Link: https://github.com/FWTX-DAO/fwtx-wiki-engine

Acknowledgments

About

Fort Worth & Tarrant County Wiki

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published