Skip to content

Remove Memgraph: complete removal of graph database code and infrastructure #2

Description

@hammertoe

Summary

Remove all Memgraph (graph database) code and infrastructure from the codebase. The project no longer uses Memgraph and keeping it adds unnecessary complexity and maintenance burden.

Removal Plan

Phase 1: Tests First

  • Add/adjust tests to reflect a Postgres-only system: no Memgraph client initialization, no Memgraph fixtures
  • Update tests/test_database.py - remove Memgraph connection tests
  • Update tests/test_bill_ingestion.py - remove Memgraph integration
  • Update tests/test_bill_ingestor_unit.py - mock only what's needed
  • Update tests/test_advanced_search.py - remove Memgraph mocks/usage
  • Update tests/conftest.py - remove Memgraph from integration marker

Phase 2: Core Library Code

  • Delete lib/db/memgraph_client.py
  • Refactor api/search_api.py - remove Memgraph import, globals, startup, _get_memgraph()
  • Refactor lib/advanced_search_features.py - Postgres-only, remove Memgraph-backed methods
  • Refactor lib/processors/bill_ingestor.py - remove graph writes, Memgraph constructor
  • Update lib/chat_agent.py - fix any call sites for changed signatures
  • Delete lib/knowledge_graph/ingestor.py (Memgraph-only)
  • Update lib/knowledge_graph/__init__.py
  • Remove Memgraph config from lib/utils/config.py

Phase 3: Scripts

  • Delete scripts/kg_sync_memgraph.py
  • Remove Memgraph from scripts/ingest_knowledge_graph.py
  • Remove Memgraph from scripts/migrate_transcripts.py
  • Remove Memgraph from scripts/ingest_bills.py

Phase 4: Infrastructure & Config

  • Remove pymgclient from requirements.txt
  • Remove Memgraph env vars from .env.example
  • Remove Memgraph service/volume from docker-compose.yml
  • Remove Memgraph branches from db.sh

Phase 5: Documentation

  • Remove Memgraph references from docs/KG_PLAN.md
  • Remove Memgraph references from docs/CODE_MAP_AND_REVIEW.md
  • Update frontend/README.md if endpoint behavior changes

Phase 6: Verification

  • rg -ni \"memgraph|pymgclient|MEMGRAPH_\" returns no project references
  • ruff check . passes
  • mypy lib/ passes
  • pytest tests/ -v passes
  • docker-compose up -d starts only Postgres
  • API startup has no Memgraph warnings

Files to Delete

  • lib/db/memgraph_client.py
  • scripts/kg_sync_memgraph.py
  • lib/knowledge_graph/ingestor.py

Files to Modify

  • api/search_api.py
  • lib/advanced_search_features.py
  • lib/processors/bill_ingestor.py
  • lib/chat_agent.py
  • lib/knowledge_graph/__init__.py
  • lib/utils/config.py
  • scripts/ingest_knowledge_graph.py
  • scripts/migrate_transcripts.py
  • scripts/ingest_bills.py
  • tests/test_database.py
  • tests/test_bill_ingestion.py
  • tests/test_bill_ingestor_unit.py
  • tests/test_advanced_search.py
  • tests/conftest.py
  • docker-compose.yml
  • .env.example
  • requirements.txt
  • db.sh
  • docs/KG_PLAN.md
  • docs/CODE_MAP_AND_REVIEW.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions