How rezabonyadi/digitalra works
Project type and purpose
• This is a hybrid full-stack research assistant application offering both a Streamlit web UI (app.py + app_pages/…) and a CLI interface (main.py).
• Its goal is to take a short research idea, generate search queries, fetch papers via the Publish & Perish CLI tool (in assets/), score/filter them, and then call OpenAI’s GPT models to summarize/write literature review sections or chat interactively.
File structure
• Top‐level entrypoints:
• app.py — Streamlit app
• main.py — CLI runner
• UI layer:
• app_pages/ — Streamlit “multi-page” modules (hire_page.py, research.py, write_review.py, chat.py, prepare_ra.py)
• Core logic (business layer):
• utils/
– prompts.py (builds GPT prompts)
– llm_connection.py (wraps OpenAI API calls)
– papers_interactions.py (invokes Publish & Perish CLI, parses results)
– operations.py (filters, relevance scoring, sorting)
• Supporting artifacts:
• assets/ — holds the external CLI executables (Publish & Perish)
• digitalRA.ipynb — exploratory notebook
• Config and dependencies:
• requirements.txt
• No persistent database; data flows in memory or via temporary files.
README for additional insights
• Uses OpenAI GPT models for NLP tasks.
• Integrates PubMed, Semantic Scholar, Google Scholar searches through Publish & Perish.
• Offers two modalities: web (Streamlit) and CLI.
• Emphasizes iterative, user-in-the-loop curation at each step.
Main components and their interactions
a. Components
• User (Researcher)
• Frontend
• Streamlit UI (multiple pages)
• CLI interface
• Application Server / Controller
• Orchestrates calls between UI/CLI and core logic
• Core Logic Modules (in utils/)
• Prompt Builder (prompts.py)
• Paper Fetcher (papers_interactions.py)
• Business Rules (operations.py)
• LLM Client (llm_connection.py)
• External Services
• Publish & Perish CLI (executes search queries)
• OpenAI API (for chat, summarization, review generation)
• Assets Folder (where CLI executables reside)
b. Relationships & Data Flow
1. User → UI/CLI: enters research idea & parameters
2. UI/CLI → Controller: invokes core workflow
3. Controller → Prompt Builder: generates search queries
4. Controller → Paper Fetcher: calls Publish & Perish CLI (from assets/), receives raw metadata
5. Controller → Business Rules: relevance scoring, filtering, sorting
6. Controller → LLM Client: passes prompts + selected paper metadata to OpenAI
7. OpenAI → LLM Client → Controller → UI/CLI: returns generated text (chat, section, summary)
c. Architectural patterns & design principles
• Layered separation: Presentation (UI/CLI) → Orchestration → Domain logic (utils) → Integration adapters
• Single-responsibility modules in utils/
• Externalization of third-party CLI tools (assets) and APIs (OpenAI)
• User-in-the-loop iterations at each major step
d. Key technologies/frameworks
• Python 3.x
• Streamlit (web UI)
• Publish & Perish CLI (paper search)
• OpenAI GPT models (via HTTP API)
• Jupyter Notebook for prototyping
Detail
• Streamlit page as a subcomponent of the Frontend.
• CLI tool path separately (it reuses the same utils modules).
• Don’t omit the assets folder; that’s where the Publish & Perish executables live.
• Flow for “chat with RA” versus “automated review generation” branches are visible.