P2MC extracts metadata, tables, narratives, links, and implementation details from scientific papers, mainly Knowledge Graph Embedding papers, and generates JSON-LD ModelCards.
The recommended runtime flow is:
- The Streamlit frontend submits an arXiv URL to the FastAPI backend.
- FastAPI creates a file-backed job under
backend/data/jobs/and publishes it to RabbitMQ. - The worker consumes the job, downloads the PDF, runs GROBID/SciPDF and LightOCR, then builds the ModelCard.
- Generated artifacts are written under
backend/data/and exposed through the backend API.
Main services:
p2mc-frontend: Streamlit UI for launching jobs and browsing generated outputs.p2mc-backend: FastAPI API for job launch, job status, job listing, and viewing generated XML/OCR outputs.p2mc-worker: RabbitMQ consumer that runs the PDF processing pipeline.rabbitmq: queue between API and worker.grobid: XML extraction service used by the SciPDF parser.ollamaandollama-init: local LLM runtime and model bootstrap.
Docker and Docker Compose are the primary way to run the project. Python 3.11 and Poetry are only needed for local development or direct pipeline execution.
Copy .env.example to .env and configure the model names and HF_TOKEN before running the real worker.
Copy-Item .env.example .env
docker build -t p2mc-backend ./backend
docker compose up -d --buildOpen:
- Frontend: http://localhost:5678
- Backend docs: http://localhost:8000/docs
Useful commands:
docker compose logs -f p2mc-worker
docker compose logs -f p2mc-backend
docker compose logs -f p2mc-frontend
docker compose downFrom the frontend:
- Open
http://localhost:5678. - Use the
Generatepage to submit an arXiv URL. - Use the
Jobspage to refresh status and inspect generated XML/OCR outputs.
From the API:
POST /job/launch-jobGET /job/jobsGET /job/job-status/{job_id}GET /job/{job_id}/artifacts/{artifact_name}forxmlandlightocr_jsoncontent previews.
Direct local pipeline execution is also available for development:
cd backend
poetry install
poetry run python run_full_iteration.pyrun_full_iteration.py runs the pipeline for a fixed paper URL and writes outputs under backend/data/.
.
|-- backend/
| |-- app/
| | |-- main.py # FastAPI app and CORS setup
| | |-- routers/jobs.py # Job launch, listing, status, and artifact routes
| | `-- schemas/jobs.py # API request/response schemas
| |-- data/ # Runtime data mounted into containers
| | |-- jobs/ # Job status files
| | |-- raw/pdfs/ # Downloaded PDFs
| | |-- interim/scipdf_xml/ # GROBID/SciPDF XML outputs
| | |-- interim/lightocr_json/ # LightOCR table outputs
| | `-- processed/modelcards/ # Generated JSON-LD ModelCards
| |-- extractors/ # LLM, dataset, metric, task, and category extractors
| |-- parsers/ # SciPDF/GROBID and LightOCR parser wrappers
| |-- rabbitmq/ # RabbitMQ connection and publishing helpers
| |-- resources/ # Taxonomy classifier, task resources, figures
| |-- templates/ # JSON-LD templates used by the generator
| |-- testing_data/ # Committed sample XML/OCR/reference data
| |-- utils/ # URI, XML, matching, mapping, and evaluation helpers
| |-- Dockerfile
| |-- model_card_generation_pipeline.py
| |-- pdf_handler.py # Pipeline orchestrator
| |-- run_full_iteration.py # Direct local execution script
| `-- worker.py # RabbitMQ worker entrypoint
|-- frontend/
| |-- app.py # Streamlit navigation entrypoint
| |-- assets/ # Demo images and example JSON/XML assets
| |-- components/job_status.py # Shared job status/artifact UI
| |-- pages/main_page.py # Generate page
| |-- pages/jobs_page.py # Jobs browser page
| |-- services/p2mc_api.py # Frontend HTTP client for the FastAPI API
| `-- Dockerfile
|-- rabbitmq/rabbitmq.conf # RabbitMQ runtime configuration
|-- docker-compose.yml # Local service topology
|-- .env.example # Environment variable template
|-- CHANGELOG.md # Short change history
`-- README.md
- Compose mounts
./backend/datainto backend and worker containers, so generated artifacts persist on the host. - The worker can run in dummy mode for smoke tests with
P2MC_USE_DUMMY_WORKER=true; the real pipeline requires GROBID, Ollama models, and Hugging Face access. - LightOCR memory use is controlled by
P2MC_LIGHTOCR_TARGET_LONGESTandP2MC_LIGHTOCR_MAX_NEW_TOKENSin.env.example. - If a job fails after generating intermediate files, rerunning can reuse existing PDF/XML/OCR artifacts.
- Use
CHANGELOG.mdfor recent project changes.

