# Chapter 8: Source Code and Documentation Repository

### 8.1 Overview

A cornerstone of GovBot’s design philosophy is **transparency, reusability, and open collaboration**.

To support replication, localisation, and continuous improvement by other governments and technical partners, the **source code** and **documentation** has been made publicly accessible through open repositories.

Two key repositories make up this open framework:

- <p class="callout info">**Sourcey Code (GitHub):[https://github.com/think-ke/GovBot-Prototype](https://github.com/think-ke/GovBot-Prototype "https://github.com/think-ke/GovBot-Prototype")**</p>
- <p class="callout info">**Documentation Library (Google Drive):** [https://drive.google.com/drive/folders/1mQnF3jLxc-ns3p7BpAD9hphHSEfwCfTi?usp=drive\_link](https://drive.google.com/drive/folders/1mQnF3jLxc-ns3p7BpAD9hphHSEfwCfTi?usp=drive_link)</p>

This ensures that future implementers — such as the Government of Rwanda or other Digital Public Infrastructure (DPI) programmes — can build upon GovBot’s foundations without starting from scratch.

Both repositories are structured for clarity, enabling contributors, developers, and policymakers to find, understand, and extend the system efficiently.

### 8.2 Source Code Repository

<p class="callout info">**GitHub Repository: [https://github.com/think-ke/GovBot-Prototype](https://github.com/think-ke/GovBot-Prototype)**</p>

#### **Purpose**

The GovBot source code repository is a complete, modular implementation of a **Government Conversational AI platform**, aligned with the **GovStack** interoperability framework.

It includes all essential components for API integration, NLP processing, analytics, and DevOps deployment.

#### **Repository Contents**

<table id="bkmrk-folder-%2F-file-purpos"><thead><tr><th>**Folder / File**</th><th>**Purpose and Description**</th></tr></thead><tbody><tr><td>**/.chainlit/**</td><td>Configuration files and assets for the Chainlit-based conversational interface.</td></tr><tr><td>**/agencies-admin-dashboard/**</td><td>Administrative interface for managing connected government agencies, datasets, and collections.</td></tr><tr><td>**/alembic/**</td><td>Database migration scripts using Alembic for PostgreSQL schema updates.</td></tr><tr><td>**/analytics/**</td><td>Analytics and telemetry services, including data collection metrics, usage reports, and dashboard integration.</td></tr><tr><td>**/app/**</td><td>Core GovBot application logic: API endpoints, NLP orchestration, data models, and business logic.</td></tr><tr><td>**/chainlit/**</td><td>Conversation flow configuration for the Chainlit-powered front-end experience.</td></tr><tr><td>**/docker/**</td><td>Docker-related scripts and configuration templates for development and production environments.</td></tr><tr><td>**/docs/**</td><td>Auto-generated API documentation and developer notes for endpoints, models, and services.</td></tr><tr><td>**/examples/**</td><td>Example notebooks and guides demonstrating API usage, SDK integration, and chatbot workflows.</td></tr><tr><td>**/presentations/**</td><td>Presentation slides and materials for GovBot demos, workshops, and stakeholder engagements.</td></tr><tr><td>**/scripts/**</td><td>Utility scripts for database backup, restore, deployment, and system maintenance.</td></tr><tr><td>**/tests/**</td><td>Comprehensive test suites validating API endpoints, NLP models, and collection data integrity.</td></tr><tr><td>**.dockerignore**</td><td>Excludes unnecessary files from Docker image builds.</td></tr><tr><td>**.gitignore**</td><td>Specifies files ignored by Git version control.</td></tr><tr><td>**.python-version**</td><td>Defines the Python version for environment consistency.</td></tr><tr><td>**README.md**</td><td>Primary documentation with setup, environment, and usage instructions.</td></tr><tr><td>**alembic.ini**</td><td>Alembic configuration file for migration environment setup.</td></tr><tr><td>**backup\_and\_clear.sh**</td><td>Script for data backup and environment cleanup before redeployment.</td></tr><tr><td>**delivery\_plan.md**</td><td>Milestone document outlining development phases, delivery targets, and implementation plan.</td></tr><tr><td>**docker-compose.yml / .demo / .dev**</td><td>Docker Compose configurations for different deployment modes (production, demo, development).</td></tr><tr><td>**docker\_inspector.sh**</td><td>Diagnostic script for inspecting Docker container networks and IP addresses.</td></tr><tr><td>**nginx.conf**</td><td>NGINX configuration file for API gateway, load balancing, and SSL termination.</td></tr><tr><td>**package-lock.json**</td><td>Lock file for managing frontend or JavaScript dependencies.</td></tr><tr><td>**pyproject.toml**</td><td>Build and dependency configuration for Python using modern packaging standards.</td></tr><tr><td>**pytest.ini**</td><td>Test configuration file for running automated tests via Pytest.</td></tr><tr><td>**requirements.txt / requirements.md / requirements-uv-generated.txt**</td><td>Dependency lists for environment setup using pip or UV package management.</td></tr><tr><td>**restore\_from\_backup.sh**</td><td>Automated restoration of PostgreSQL databases and file backups.</td></tr><tr><td>**shutdown\_with\_backup.sh**</td><td>Combined backup and shutdown script ensuring data persistence.</td></tr><tr><td>**test\_api.sqlite / test\_list\_documents.py**</td><td>SQLite database and test scripts for validating API responses and database queries.</td></tr><tr><td>**uv.lock**</td><td>Dependency lockfile for UV-managed Python environments.</td></tr></tbody></table>

#### **Key Technologies and Framework**

<table id="bkmrk-layer-technology-sta"><thead><tr><th>**Layer**</th><th>**Technology Stack**</th></tr></thead><tbody><tr><td>**Core Framework**</td><td>Python 3.11+, FastAPI</td></tr><tr><td>**Database**</td><td>PostgreSQL with Alembic migrations</td></tr><tr><td>**Containerisation**</td><td>Docker, Docker Compose</td></tr><tr><td>**NLP &amp; AI**</td><td>Groq speech-to-text service, integrated transformer models</td></tr><tr><td>**Analytics**</td><td>Custom analytics engine under `/analytics`</td></tr><tr><td>**Frontend / Chat Interface**</td><td>Chainlit (Python-based UI framework for conversational AI)</td></tr><tr><td>**DevOps**</td><td>Backup and monitoring scripts with CI/CD support</td></tr><tr><td>**Testing**</td><td>Pytest and integrated SQLite sandbox testing

</td></tr></tbody></table>

#### **Environment Setup**

To run GovBot locally:

<p class="callout success">\# 1. Clone the repository  
git clone https://github.com/think-ke/GovBot-Prototype  
cd GovBot-Prototype</p>

<p class="callout success">\# 2. Build Docker containers  
docker compose up --build</p>

<p class="callout success">\# 3. Run the application  
uvicorn app.main:app --reload</p>

#### **Key Features**

- Open-source under a permissive licence (Digital Public Good compliance)
- Modular architecture allowing governments to add or replace CBots (Common Object Bots)
- Support for multilingual deployments (Kiswahili, English, with extension capability)
- CI/CD pipeline integration for agile deployments
- API-ready for integration with GovStack and national service registries

### 8.3 Documentation Repository

<p class="callout info">**Documentation Drive:** [https://drive.google.com/drive/folders/1mQnF3jLxc-ns3p7BpAD9hphHSEfwCfTi?usp=drive\_link](https://drive.google.com/drive/folders/1mQnF3jLxc-ns3p7BpAD9hphHSEfwCfTi?usp=drive_link)</p>

The **GovBot Documentation Library** provides a comprehensive record of the project’s lifecycle — from conceptualisation and ethical governance to iterative sprint execution and post-deployment evaluations.

It is organised into **two main directories**: **Project Docs** and **Sprint Docs**.

This structure ensures that both the strategic foundations and the continuous improvements of GovBot are transparent and easily navigable for any government or development partner wishing to replicate the system.

#### **8.3.1 Project Docs**

The **Project Docs** directory contains all foundational and governance-related materials that shaped GovBot’s inception and alignment with **Digital Public Infrastructure (DPI)** and **Digital Public Goods (DPG)** standards.

These documents ensure ethical compliance, data protection, and institutional sustainability from day one.

##### **Folder Structure**

<table id="bkmrk-folder-%2F-file-descri"><thead><tr><th>**Folder / File**</th><th>**Description**</th></tr></thead><tbody><tr><td>**Project Slides/**</td><td>Presentation decks used for high-level briefings with ministries, ICT authorities, and donor partners; includes technical overviews and project roadmaps.</td></tr><tr><td>**Eticas Documents/**</td><td>Independent ethical and Responsible AI assessment reports developed by the Eticas Foundation; focus on transparency, fairness, and bias mitigation.</td></tr><tr><td>**DPA Documentation/**</td><td>Data Protection Authority (DPA) compliance materials — Data Protection Impact Assessments (DPIAs), legal alignment reports, and data governance frameworks.</td></tr><tr><td>**GovBot Training Data/**</td><td>NLP training datasets used to develop multilingual intent recognition, entity extraction, and speech processing models.</td></tr><tr><td>**Draft Reports/**</td><td>Early and intermediate project reports summarising progress, pilot feedback, and stakeholder findings prior to final publication.</td></tr><tr><td>**Contracts / WPK Instructions/**</td><td>Contractual and operational materials including work package (WPK) instructions, memoranda of understanding (MoUs), and implementation agreements.</td></tr></tbody></table>

##### **Purpose**

The **Project Docs** directory defines the **governance, ethical, and operational foundation** of GovBot.

It ensures:

- Regulatory alignment with national and international data protection standards
- Documentation of AI transparency and fairness practices
- Accessibility for auditors, reviewers, and policy stakeholders
- A replicable model for new GovBot deployments in other jurisdictions

#### **8.3.2 Sprint Docs**

The **Sprint Docs** directory captures GovBot’s iterative and agile development process — from design sprints and technical architecture updates to training activities and regional collaborations.

It documents continuous learning and provides real-time insight into how the platform evolves.

##### **Folder Structure**

<table id="bkmrk-folder-%2F-file%2A-sprin"><thead><tr><th>*Folder / File*\*</th><th>**Sprint / Description**</th></tr></thead><tbody><tr><td>**Documentation &amp; Foundation Setup/**</td><td>**Sprint 0**: Core project documentation, repository setup, initial guidelines, and foundational frameworks.</td></tr><tr><td>**Kickoff &amp; Agile Setup/**</td><td>**Sprints 1-2**: Agile processes, team onboarding, sprint planning artifacts, and project kickoff notes.</td></tr><tr><td>**Architecture &amp; Model Initiation/**</td><td>**Sprints 3-4**: System architecture diagrams, data flow, initial AI/ML model prototypes, and design considerations.</td></tr><tr><td>**Technical Architecture/**</td><td>**Sprints 3-5**: Architecture updates, API specifications, and infrastructure blueprints supporting model initiation and MVP build.</td></tr><tr><td>**Design &amp; Development/**</td><td>**Sprints 3-5**: User journey maps, wireframes, prototypes, and design sprint outputs used during model initiation and MVP development.</td></tr><tr><td>**MVP Build (Text, Voice &amp; Integration)**</td><td>**Sprint 5**: Development of minimum viable product including text &amp; voice interfaces, core functionalities, and integration testing.</td></tr><tr><td>**Beta Demo Launch/**</td><td>**Sprint 6**: Beta release documentation, demo scripts, feedback collection, and sprint retrospectives.</td></tr><tr><td>**Alpha Testing &amp; GovStack Integration/**</td><td>**Sprints 7-8**: Alpha testing reports, GovStack API integration guides, bug tracking, and iteration updates.</td></tr><tr><td>**Governance &amp; Compliance/**</td><td>**Sprints 7-10**: Compliance trackers, audit documentation, and policy alignment records during testing, integration, and governance readiness.</td></tr><tr><td>**Community &amp; Governance Readiness/**</td><td>**Sprints 9-10**: Governance documentation, compliance checklists, stakeholder engagement outputs, and community preparation materials.</td></tr><tr><td>**Training &amp; Workshops/**</td><td>**Sprints 9-12**: Materials from capacity-building sessions with ministries, MDAs, and developers, used during community engagement and support readiness.</td></tr><tr><td>**Public Testing &amp; Support Readiness/**</td><td>**Sprints 11-12**: User testing results, support manuals, admin onboarding documentation, and user feedback analysis.</td></tr><tr><td>**Model Cards/**</td><td>**Sprints 11-12**: Standardized AI model documentation including intended use, performance metrics, retraining logs, and bias evaluations for public testing.</td></tr><tr><td>**Risk Registers &amp; Audits/**</td><td>**Sprints 5-12**: Records of identified risks, mitigation strategies, and audit results during MVP, testing, and support phases.</td></tr><tr><td>**User Stories &amp; Use Cases/**</td><td>**Sprints 5-12**: Real-world scenarios and conversational examples from pilot deployments used for validation, testing, and public readiness.</td></tr><tr><td>**Community Engagements/**</td><td>**Sprints 9-12**: NLP community collaborations, peer-learning outcomes, and event summaries during governance and public readiness.</td></tr><tr><td>**Soft Launch/**</td><td>**Sprints 13-14**: Launch planning, release notes, communication materials, and early user metrics.</td></tr><tr><td>**Scaling &amp; Sustainability Plans/**</td><td>**Sprints 13-14**: Strategic documents outlining pathways for scaling GovBot nationally and regionally, with funding and partnership frameworks.</td></tr><tr><td>**Stabilization, Handover &amp; Final Reporting/**</td><td>**Sprints 15-16**: Final bug fixes, system stabilization, handover guides, final reporting, and lessons learned.</td></tr><tr><td>**Knowledge Base &amp; FAQs/**</td><td>**Sprints 15-16**: Guides, quick references, troubleshooting manuals, and onboarding documentation for administrators and developers.

</td></tr></tbody></table>

##### **Purpose**

The **Sprint Docs** directory functions as GovBot’s **living delivery record**, maintaining visibility and continuity across the agile workflow.

It provides:

- Full traceability of technical and governance iterations
- A knowledge base for new team members and external reviewers
- Institutional memory supporting long-term sustainability

##### **Accessibility and Usage** 

- All documents are in open formats (PDF, DOCX, XLSX, Markdown) for re-use.
- Governments can duplicate the structure for their own chatbot documentation.
- Updated quarterly to reflect new features, compliance reports, and pilot results.
- Serves as a **single source of truth** for implementers seeking alignment with GovStack and DPI frameworks.

### 8.4 Contribution Guidelines

To maintain quality and traceability of community input, both repositories follow a defined contribution protocol:

1. Fork and Branch: Create a new branch for each feature or improvement.
2. Document Changes: Update corresponding design documents or README files.
3. Pull Request Review: Submissions are reviewed by maintainers at THiNK and relevant government ICT teams.
4. Merge and Publish: Approved contributions are merged and reflected in quarterly updates.

> <span style="color: rgb(53, 152, 219);">**All contributors are recognised within the THiNK Community of Practice (CoP) and invited to join the Our developer network for continued collaboration.**</span>

### 8.5 Integration with Human-Centred Design

Both the codebase and documentation reflect the **Human-Centred Design (HCD)** methodology underpinning GovBot.

Each iteration and repository update follows the principles of:

- **Transparency:** Every decision and model update is documented.
- **Inclusivity:** Local languages and user feedback shape development priorities.
- **Co-creation:** Developers, civil servants, and citizens collaborate openly.
- **Scalability:** The architecture and documentation are reusable across borders.

> ##### <span style="color: rgb(230, 126, 35);">**Outcomes**</span>
> 
> <span style="color: rgb(230, 126, 35);">**Together, the GitHub and Drive repositories form a living knowledge system — enabling any government, research institution, or civic technology community to deploy, adapt, and expand GovBot as part of their national digital transformation journey.**</span>

---