University Organization Pipeline
This repository crawls university organization websites and extracts structured staff, project, news, and keyword information.
Pipeline stages
For one configured entity, the pipeline executes:
- Generate crawl seeds from the accepted hierarchy.
- Crawl all seed URLs and their allowed internal links.
- Store responses as WARC files.
- Build a redirect lookup.
- Upload HTML content to Elasticsearch.
- Load the accepted organization hierarchy.
- Classify crawled URLs with the configured LLM.
- Extract staff, projects, and news.
- Extract focused keywords for extracted content.
The hierarchy under src/data/hierarchies is the authoritative source. The
pipeline must mount that data directory at /data, so accepted hierarchy edits
made by the service are visible to the pipeline container.
Restarting a run
Pipeline data is stored below runs/<entity>/. Use --auto-resume to keep
existing data and continue from the stages recorded in pipeline_state.json.
This also keeps data when the previous run used different limits or was marked
completed. If the state file is missing or invalid, the pipeline keeps the
existing files and reruns the stages because no completed stages can be known.
Use --fresh when you explicitly want to delete the entity's existing run
directory and start over. Without either option, the pipeline creates a new
state file without deleting existing data.
When this pipeline is launched by the background-job runner with
--auto-resume and no persistent_dir is configured, the runner automatically
mounts its named persistent volume at /app/orgminer_pipeline/runs.
The service data volume must also be mounted into the pipeline container at
/data. Use the same named volume in both containers; the default is
smartguide-data, configurable with ORGMINER_DATA_VOLUME. The pipeline mounts
it read-only because the service owns accepted hierarchy updates.
For local development, recreate the service with the shared volume:
docker volume create smartguide-data
docker run ... -v smartguide-data:/data ...
The background-job runner mounts that same volume automatically for OrgMiner
jobs. In CI/CD, create or provision a volume with the same configured name and
mount it at /data when starting the service.
Requirements
- Python environment containing Scrapy, scrapy-warcio, warcio, Elasticsearch, OpenAI client, Trafilatura, YAKE, langdetect, tiktoken, and project dependencies.
- Elasticsearch credentials.
- LLM endpoint and API key.
Create .env in the repository root:
ES_PASSWORD=...
ES_HOST=https://your-elasticsearch-host:443
ES_USERNAME=elastic
llm_api=https://your-llm-api/v1
llm_key=...