EduceLab Herculaneum Graph Database API
This API is considered a work in progress and can change at any moment.
Architecture
Setup Quick Start
For a visual overview of the full setup process (beyond just this repo), see the quick start guide:
For step-by-step server setup instructions, see docs/SERVER_SETUP.md.
Installation
This package supports two install modes:
Client only (lightweight)
For remote machines that only need to call the REST API:
pip install educelab-hercdb
This installs only the requests library. See src/educelab/hercdb/client/README.md for client usage.
Server (full)
For running the REST API server, loading data, or querying Neo4j directly:
pip install educelab-hercdb[server]
This adds fastapi, neo4j, numpy, pandas, prompt-toolkit, and uvicorn.
Development Setup
# Install base dependencies
uv sync
# Or with server extras (fastapi, neo4j, etc.)
uv sync --extra server
# Run commands in the environment
uv run python -c "from educelab.hercdb.client import HercClient"
# Or activate the venv directly
source .venv/bin/activate
Client Library
from educelab.hercdb.client import HercClient
client = HercClient(host="api.example.com", token="my-token")
pherc = client.get_artifact_by_name("211")
See src/educelab/hercdb/client/README.md for the full API reference.
Direct Database Connection
For environments with the server extra installed, you can connect to Neo4j directly:
from educelab import hercdb
uri = "neo4j://localhost:7687"
user = "foo"
password = "bar"
db = hercdb.connect(uri, user, password)
if db.verify_connection():
print("Connected!")
If credentials are not passed directly, the package reads them from ~/.educedb or environment variables. See docs/SERVER_SETUP.md for configuration details.
REST API
A FastAPI-based REST API is available for querying the database over HTTP. All endpoints require Bearer token authentication.
uv run uvicorn educelab.hercdb.rest.server:app --reload
Interactive API docs are available at /docs (Swagger UI) and /redoc (ReDoc) once the server is running.
See src/educelab/hercdb/rest/README.md for endpoint documentation and docs/SERVER_SETUP.md for production deployment.
Loading Data
Data loading is done in two steps using the loader scripts. Both read CSV files from input_data/.
1. Load metadata and UUIDs
uv run python src/educelab/hercdb/loader/metadata_loader.py
Reads (defaults):
input_data/metadata_file.csv- Pre-processed metadata file. (PHerc, Cornice, Pezzo, Disegni nodes and properties.)input_data/uuid_file.csv- Pre-processed uuid file. (all EduceLabID added)
Optional arguments:
uv run python src/educelab/hercdb/loader/metadata_loader.py \
--metadata path/to/metadata.csv \
--uuid path/to/uuid.csv
2. Load scan data
uv run python src/educelab/hercdb/loader/scan_loader.py
Reads (defaults):
input_data/negatives.csv- FlatbedScanDataset nodesinput_data/pgs_datasets_20260601(in).csv- PGSRaw nodesinput_data/spectral_datasets_20260601_reconciled.csv- SpectralRaw nodes
By default (--replace) it deletes all existing PGSRaw/SpectralRaw nodes and reloads from scratch (FlatbedScanDataset is untouched); pass --no-replace to merge into existing data instead. Nodes are keyed on the scan uuid, so re-running is idempotent.
Optional arguments:
uv run python src/educelab/hercdb/loader/scan_loader.py \
--negatives path/to/negatives.csv \
--photogrammetry path/to/pgs.csv \
--spectral path/to/spectral.csv \
--no-replace
Note: Run metadata_loader first since scan data links to EduceLabID nodes.
Reporting Tools
Scan completeness report
el-hercdb-scan-report walks every PHerc and its hierarchy and writes two CSVs that flag artifacts needing first-time scans or re-scans.
# After `uv sync --extra server`, the entry point is on PATH:
uv run el-hercdb-scan-report --out-dir ./tmp
# Equivalent fallback without re-syncing:
uv run python -m educelab.hercdb.cli.scan_completeness --out-dir ./tmp
Outputs (default names):
scan_completeness_full.csv— one row per (artifact, UUID) pair, plus blank-UUID sentinel rows for artifacts that have no EduceLabID assigned. Columns: PHerc, Cornice, Pezzo, UUID, PGS Status, PGS Latest Complete Date, PGS Path, Spectral Status, Spectral Latest Complete Date, Spectral Path, Institution.scan_completeness_issues.csv— same shape, filtered to rows where PGS or Spectral is missing/incomplete, or the artifact has no UUID at all.
Status values are complete / incomplete / missing when the artifact has a UUID, and blank when it does not (so "UUID assigned but no scan" stays distinguishable from "no UUID even assigned"). Files are written with utf-8-sig so Excel opens them with correct character encoding.
The report walks REPLACES relationships between EduceLabIDs, so pre-replacement scans on a retired predecessor UUID still count toward the artifact's coverage.
Temporary Scripts and Notes
The tmp/ directory contains temporary scripts, notes, and other informal resources shared among the team. Contents are version controlled but considered ephemeral — they may be rewritten or deleted at any time and should not be relied upon as stable code.
Delete all data
To clear the database before reloading:
from educelab.hercdb.loader import PhercGraphDatabaseLoader
loader = PhercGraphDatabaseLoader()
loader._delete_all_nodes()
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file educelab_hercdb-0.3.0.tar.gz.
File metadata
- Download URL: educelab_hercdb-0.3.0.tar.gz
- Upload date:
- Size: 52.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
467b9694ba763e1eed602459ff5f05c42de30abc68d983aeb87e9a8518e77f10
|
|
| MD5 |
50ca05ed4fd2ced63b04bd615903c030
|
|
| BLAKE2b-256 |
5ae6ada8f0de438b61031581028811e5a71eb0c22234b59ae1e6fb05a361b9ff
|
Provenance
The following attestation bundles were made for educelab_hercdb-0.3.0.tar.gz:
Publisher:
publish.yml on educelab/educelab-hercdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
educelab_hercdb-0.3.0.tar.gz -
Subject digest:
467b9694ba763e1eed602459ff5f05c42de30abc68d983aeb87e9a8518e77f10 - Sigstore transparency entry: 2192004002
- Sigstore integration time:
-
Permalink:
educelab/educelab-hercdb@5693b482ab83291fd29d251486722115938ff427 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/educelab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5693b482ab83291fd29d251486722115938ff427 -
Trigger Event:
push
-
Statement type:
File details
Details for the file educelab_hercdb-0.3.0-py3-none-any.whl.
File metadata
- Download URL: educelab_hercdb-0.3.0-py3-none-any.whl
- Upload date:
- Size: 55.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2bd9e79db76381f1d1cc5cde0f5861e85089ac63d8502efc2b6a0436c487d8c
|
|
| MD5 |
db929ba71fee4d8c065443aade16091e
|
|
| BLAKE2b-256 |
db61e5c134a577e81003d4941d88cbaf6afbdcba48996e75ecacdb9add165616
|
Provenance
The following attestation bundles were made for educelab_hercdb-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on educelab/educelab-hercdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
educelab_hercdb-0.3.0-py3-none-any.whl -
Subject digest:
f2bd9e79db76381f1d1cc5cde0f5861e85089ac63d8502efc2b6a0436c487d8c - Sigstore transparency entry: 2192004072
- Sigstore integration time:
-
Permalink:
educelab/educelab-hercdb@5693b482ab83291fd29d251486722115938ff427 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/educelab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5693b482ab83291fd29d251486722115938ff427 -
Trigger Event:
push
-
Statement type: