Upload verified UDE OrgMiner persons
Run from the repository root:
python service/scripts/upload_orgminer_verified_persons_ude/upload_orgminer_verified_persons_ude.py
The script reads ude_organization_content_august_2025_draft, applies the
OrgMiner collaboration-graph verification rule, and upserts one document per
verified OpenAlex person and organization into orgminer_verified_persons_ude
on the INSE Elasticsearch cluster.
For the background-job image and persistent checkpoint setup, see
../jobs-image/README.md.
INSE credentials must be available as ELASTICSEARCH_INSE_URL and
ELASTICSEARCH_INSE_API_KEY for reading/writing OrgMiner data. NES credentials
must also be available as ELASTICSEARCH_URL and ELASTICSEARCH_API_KEY for
OpenAlex author resolution during verification. They can be set in the
environment or the service .env file.
The default checkpoint is orgminer_verified_persons_ude_progress.json next to
the script. It records completed source organization document IDs and the last
completed organization URI. On restart the scan resumes from that URI, skips
completed organizations, and safely retries upserts if an interrupted request did
not get checkpointed. Use --progress-file PATH to keep the checkpoint elsewhere.
Each document also exposes the organization context explicitly:
faculty: root hierarchy node, for exampleChemieorganization_type: immediate parent label, for exampleLehrstühleorInstitutenorganization_level: hierarchy node type code (leaf,chairs,institutes,faculty)
Each person document also carries the person's OpenAlex organizations, loaded
from openalex-authors:
oa_organization_ids: deduplicated short OpenAlex organization IDs (I62318514), used for filtering and joinsoa_organization: deduplicated OpenAlex organization objects withid,openalex_url,display_name,ror,country_code,type,lineage,years, andlast_known
last_known_institutions and affiliations are merged by institution ID;
affiliation years are unioned and institutions without an OpenAlex ID are
skipped. Missing author documents do not drop the person; the document is written
with empty institution fields and a warning is logged.
The script processes one organization at a time, so a run needs no concurrency flags.
Useful options:
# Run verification without writing to Elasticsearch or changing the checkpoint
python service/scripts/upload_orgminer_verified_persons_ude/upload_orgminer_verified_persons_ude.py --dry-run
# Smoke-test a limited number of pending organizations
python service/scripts/upload_orgminer_verified_persons_ude/upload_orgminer_verified_persons_ude.py --limit 5
# Delete the checkpoint and scan from the first organization again
python service/scripts/upload_orgminer_verified_persons_ude/upload_orgminer_verified_persons_ude.py --fresh
Verification requests only the collaboration weights towards the organization's
other staff candidates. It does not materialize every co-author pair, which is
unbounded for works with hundreds or thousands of authors. The progress log ends
each line with the process's peak rss so memory growth is visible.
--fresh removes the selected checkpoint and its temporary atomic-write file,
but does not clear the output index. Existing person/organization IDs are
upserted; output documents that are no longer produced are left in the index.
When configured on a background-job task, --fresh applies on every run, so the
task always restarts from the first source organization. If the checkpoint
directory is not a mounted volume, a warning is logged because progress cannot
survive the container.
Rebuilding after a mapping change
The script creates the output index with its mapping only when the index does not exist. After changing the document fields, delete the old index first and then run a full upload:
curl -X DELETE "$ELASTICSEARCH_INSE_URL/orgminer_verified_persons_ude" \
-H "Authorization: ApiKey $ELASTICSEARCH_INSE_API_KEY"
python service/scripts/upload_orgminer_verified_persons_ude/upload_orgminer_verified_persons_ude.py --fresh
--fresh also removes the checkpoint so every source organization is processed
again.