Chronos is an end-to-end prototype that connects historical observations with modern studies to generate scientific hypotheses.
Chronos consists of two main components:
-
Backend: A FastAPI application with Neo4j and Redis, providing endpoints for searching PubMed articles, OCR processing, graph operations, and hypothesis generation.
-
Frontend: A Next.js application with TailwindCSS and Shadcn/UI, providing a user interface for interacting with the backend services.
- Docker and Docker Compose (for the backend)
- Node.js (v18+) and npm (for the frontend)
- Python 3.10+ (if running the backend without Docker)
- Tesseract OCR (already included in the Docker image)
-
Navigate to the backend directory:
cd chronos/backend -
Copy the environment template and fill in the required variables:
cp .env.template .env
-
Edit the
.envfile with your API keys and credentials:- PUBMED_API_KEY (optional but recommended)
- GROQ_API_KEY (required for hypothesis generation)
- NEO4J_PASSWORD (change if needed)
-
Build and start the backend services:
docker-compose up --build
This will start the FastAPI server, Neo4j database, and Redis cache.
-
Navigate to the frontend directory:
cd chronos/frontend -
Install dependencies:
npm install
-
Create a
.env.localfile:echo "NEXT_PUBLIC_API_URL=http://localhost:8000" > .env.local
-
Start the development server:
npm run dev
-
Access the application at http://localhost:3000
-
Backend API Testing:
- The API documentation is available at http://localhost:8000/docs
- You can use this interactive interface to test all endpoints
-
Frontend Workflow:
- Search Articles: Enter a query in the search box to find PubMed articles
- OCR: Upload an image to extract text and ingest it as a historical observation
- Generate Hypothesis: Once you have selected both a historical observation and a modern study, use the hypothesis generator to create a testable hypothesis
GET /api/v1/spine-articles/search?q=<>&page=<>&per_page=<>: Search for PubMed articlesPOST /api/v1/ocr: Process an image with OCR to extract textPOST /api/v1/graph/ingest-historical: Create a historical observation nodePOST /api/v1/graph/ingest-modern: Create a modern study nodePOST /api/v1/hypothesis: Generate a hypothesis by connecting historical and modern nodesPOST /api/v1/dkg/write-stub: Echo/log a JSON stub for OriginTrail DKG integration
- The backend uses FastAPI for its performance and ease of use
- Neo4j is used as the graph database to store and query relationships
- Redis is used for caching PubMed API responses to improve performance
- All services are containerized for easy deployment
- The frontend uses Next.js with App Router for modern React features
- TailwindCSS with Shadcn/UI provides a clean and responsive user interface
- The interface is organized into components that match the backend functionality
- If the backend fails to connect to Neo4j, ensure the Neo4j container is running and check the credentials in your
.envfile - If the frontend cannot connect to the backend, ensure the backend is running and the
NEXT_PUBLIC_API_URLis correctly set - For OCR issues, make sure your images are clear and legible for Tesseract to process
- Implement proper XML parsing for PubMed results
- Add user authentication for secure access
- Enhance the graph visualization component
- Implement pagination for search results
- Add more advanced filtering options for articles