| --- |
| license: other |
| license_name: copernicus-and-mixed |
| license_link: https://www.copernicus.eu/en/access-data |
| language: [en] |
| pretty_name: Copernicus RAG core (4 stores) |
| --- |
| |
| # copernicus-rag-core |
|
|
| Full processed core of a 3-tier RAG over **all four Copernicus stores** — |
| CMEMS (Marine) · CDS (Climate) · ADS (Atmosphere) · EWDS (Early Warning). |
| Private working dataset: originals as markdown, chunks, ready 768-d embeddings, |
| prebuilt Qdrant indexes, all linkage sidecars, and the complete pipeline |
| scripts to rebuild everything from scratch. No PDFs, no images. |
|
|
| Served by the `copernicus-rag` MCP server (12 tools). |
| Validated 2026-07-23: **50/50 test queries green** across all tiers. |
|
|
| ## Tiers |
|
|
| | tier | collection | points | content | |
| |---|---|---|---| |
| | L1 discover | `copernicus_docs` | 1,418 | dataset cards, all 4 stores | |
| | L2 analyze | `marine_docs` | 29,249 | CMEMS PUM/QUID/SQO (807 docs / 306 products) | |
| | L2 analyze | `cds_docs` | 23,341 | CDS/ADS/EWDS PUG/ATBD (766 docs / 165 datasets) | |
| | L2 analyze | `eqc_qa` | 1,274 | C3S EQC quality reports (74) | |
| | L3 method | `publications` | 430,066 | 12,411 parsed papers, dataset-linked | |
|
|
| ## Layout |
|
|
| ``` |
| originals_md/ cmems/ (813 md) · cds_ads_ewds/ (772) · eqc_reports/ (74) |
| notebooks/ (194) · publications_md.tar.gz (11,209 md, MinerU-VLM |
| parsed — CC-licensed/PD papers only; 1,202 unlicensed-bronze |
| originals removed 2026-07-23, their chunks/embeddings/index |
| points remain untouched) |
| chunks/ per-collection chunks.jsonl + papers.jsonl |
| embeddings/ *.jsonl.gz — gemini-embedding-2-preview, 768d, L2-norm (ready to load) |
| indexes/ 4 prebuilt embedded-Qdrant dirs (tar.gz) — hybrid dense+BM25, |
| publications payloads RELINKED (untar & point the server at them) |
| metadata/ catalog.json · unified_metadata.json (1,436) · notebooks sidecar · |
| links_by_dataset.json (234 datasets / 8,917 papers / 31,190 links) · |
| publications registry (1,199 DOI) · flagships.json |
| scripts/ FULL pipeline, per component (see below) |
| REBUILD.md full from-scratch rebuild / open-LLM swap guide |
| ``` |
|
|
| ## Quickstart — plug the RAG database into Qdrant |
|
|
| Two ways, depending on where you want Qdrant to run. |
|
|
| ### A) Prebuilt embedded indexes (fastest — no re-compute, no server) |
|
|
| The `indexes/*.tar.gz` are ready-to-serve **embedded-Qdrant** storage dirs |
| (this is exactly what the MCP server uses). Each tarball unpacks to a `qdrant_db/`: |
|
|
| ```bash |
| pip install "qdrant-client==1.18.0" |
| hf download dmpantiu/copernicus-rag-core --repo-type dataset \ |
| --include "indexes/*" --local-dir . |
| for n in marine_and_cards cds_docs eqc_qa publications; do |
| mkdir -p rag/$n && tar xzf indexes/qdrant_$n.tar.gz -C rag/$n |
| done |
| ``` |
|
|
| | dir (after untar) | collections inside | points | |
| |---|---|---| |
| | `rag/marine_and_cards/qdrant_db` | `marine_docs` + `copernicus_docs` | 29,249 + 1,418 | |
| | `rag/cds_docs/qdrant_db` | `cds_docs` | 23,341 | |
| | `rag/eqc_qa/qdrant_db` | `eqc_qa` | 1,274 | |
| | `rag/publications/qdrant_db` | `publications` | 430,066 | |
|
|
| ```python |
| from qdrant_client import QdrantClient |
| c = QdrantClient(path="rag/publications/qdrant_db") # embedded/local mode |
| print(c.get_collections()) # -> publications |
| print(c.count("publications")) # -> 430066 |
| ``` |
|
|
| Notes: |
| - Vectors are **named**: `dense` (768-d, cosine, `gemini-embedding-2-preview`, |
| L2-normalized) + `sparse` (BM25, IDF modifier) → hybrid dense+sparse queries work |
| out of the box. BM25 queries need no embedding model at all |
| (`fastembed` `Qdrant/bm25`); dense queries need the same Gemini model |
| (or re-embed — see `REBUILD.md`). |
| - Embedded mode holds a **single-process lock** per dir — one process at a time. |
| - These dirs are **local-mode storage only**; you cannot mount them into a |
| Qdrant docker server. For a server, use option B. |
| - The MCP server (`scripts/marine_rag/rag_server.py`) expects them at |
| `marine_rag/out/qdrant_db`, `deep_docs/qdrant_db`, `eqc_qa/qdrant_db`, |
| `pubs_rag/qdrant_db` relative to the repo root. |
|
|
| ### B) Full Qdrant server (docker / cloud) — see **`server/GUIDE.md`** |
|
|
| The `server/` folder is a complete, tested deployment kit: `docker-compose.yml` |
| (Qdrant v1.18) + `load_all.py`, which downloads the prebuilt indexes and streams |
| all five collections into your server **1:1** — dense + sparse BM25 vectors, |
| relinked payloads, payload indexes; no embedding model or Gemini key needed. |
|
|
| ```bash |
| export HF_TOKEN=hf_... |
| hf download dmpantiu/copernicus-rag-core --repo-type dataset \ |
| --include "server/*" --local-dir . && cd server |
| pip install -r requirements.txt |
| docker compose up -d |
| python load_all.py --url http://localhost:6333 |
| ``` |
|
|
| Full walkthrough (verification, hybrid/filtered query examples, cloud clusters, |
| ops & troubleshooting): **`server/GUIDE.md`**. |
|
|
| Note: `embeddings/*.embedded.jsonl.gz` remain the right starting point when you |
| want to **re-embed with a different model** (see `REBUILD.md`); for a faithful |
| copy of the validated database, `server/load_all.py` is the path — the raw |
| embedding files predate the publication↔dataset relink, the indexes carry it. |
|
|
| ## Rebuild scripts (`scripts/`) |
|
|
| Everything needed to regenerate this dataset from the originals — or re-embed |
| with a different model: |
|
|
| ``` |
| marine_rag/ CMEMS: clean_md → chunk_docs → batch_orchestrator (embed) → |
| load_qdrant · cards: build_cds_cards → embed_cds_batch → |
| load_copernicus_docs · rag_server.py (the MCP server itself) |
| deep_docs/ CDS/ADS/EWDS: fetch_parse → chunk_docs → embed_load |
| eqc_qa/ EQC reports: fetch → parse → chunk → embed → load · |
| extract_code + merge_notebooks (notebook sidecar) |
| pubs_rag/ L3: build_corpus_copernicus → chunk_pubs → embed_orchestrator → |
| load_pubs_qdrant → relink_full → build_links_sidecar |
| meta_harvest/ 01–08: upstream metadata harvest, all 4 stores → unified_metadata |
| publications/ DOI registry + Crossref/OpenAlex/Unpaywall OA-PDF downloaders |
| notebook_harvest/ CMEMS gallery / INSTAC notebook parsers |
| run_test_queries.py the 50-query validation suite (50/50 pass) |
| build_bundle.py · build_rag_tree.sh consolidation helpers |
| ``` |
|
|
| Order for a cold rebuild: `REBUILD.md` step-by-step; or skip embedding entirely — |
| `indexes/*.tar.gz` are ready to serve as-is. |
|
|
| ## Linkage (baked into indexes + sidecars) |
|
|
| - paper↔dataset: 289 via registry (EQC refs) + ~10.4k via flagship-citation map |
| (29 flagship DOIs → verified dataset ids); Qdrant payload `linked_products[]`, |
| `flagship_labels[]`, `link_via[]`, `orphan`; serve-time sidecar |
| `metadata/links_by_dataset.json` (built by `scripts/pubs_rag/build_links_sidecar.py`) |
| - notebooks attach to dataset cards via sidecar (`matched_dataset_id == product_id`) |
| - cards carry `n_linked_publications`, `has_eqc_docs` |
|
|
| ## Notes |
|
|
| - Embeddings: `gemini-embedding-2-preview`, RETRIEVAL_DOCUMENT, 768 dim, L2-normalized. |
| Query side works with the same model or any 768-d swap after re-embed (see REBUILD.md). |
| - Licenses (per-paper audit 2026-07-23, OpenAlex×Unpaywall×publisher whitelist, |
| see `metadata/publication_licenses.json`): of 12,411 papers — 9,813 CC-BY/SA/PD · |
| 1,396 CC-NC/ND · 1,202 no-license/bronze. Full-text originals of the no-license |
| group are NOT stored here (removed; chunks and vectors remain). Copernicus service |
| documents © respective Copernicus services (free use); harvested notebooks retain |
| upstream licenses (incl. some unlicensed training repos). **Keep this repo |
| private** — NC/ND full texts and unlicensed notebooks are for internal use. |
|
|