Compare commits
93
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00f54d117d | ||
|
|
d90bf9b837 | ||
|
|
ea5e3ca942 | ||
|
|
722f95fad1 | ||
|
|
eb2fa92225 | ||
|
|
e2be1fc57d | ||
|
|
e9a72f88c1 | ||
|
|
48a10dbca3 | ||
|
|
dc79d16dfb | ||
|
|
d1827cf86b | ||
|
|
728d8c9646 | ||
|
|
d60c17abf4 | ||
|
|
6b6a5c7cff | ||
|
|
41cc3a7ac6 | ||
|
|
a1317810c9 | ||
|
|
22997f6a16 | ||
|
|
8322fea036 | ||
|
|
492987100c | ||
|
|
cb4e7465b1 | ||
|
|
ef6df95b54 | ||
|
|
a9e7a0f3ab | ||
|
|
23b112beb9 | ||
|
|
739669021b | ||
|
|
4c39933b8d | ||
|
|
e6e8d192cc | ||
|
|
9535bfedf5 | ||
|
|
faa22e0a8f | ||
|
|
83e0bc3e01 | ||
|
|
30eea4aa22 | ||
|
|
8b374681c2 | ||
|
|
e984372259 | ||
|
|
8c45c29fc6 | ||
|
|
0775f3efc7 | ||
|
|
5153e5876d | ||
|
|
90c6fa56c8 | ||
|
|
e63f2e99d8 | ||
|
|
34c0235112 | ||
|
|
50350fcc12 | ||
|
|
4d869e99bb | ||
|
|
a5291842ab | ||
|
|
9e5276fcea | ||
|
|
159f121d7f | ||
|
|
eed5ac1e78 | ||
|
|
1be21640ca | ||
|
|
e4a5b6b40c | ||
|
|
654fece731 | ||
|
|
2cefe513c4 | ||
|
|
f92e3ecc71 | ||
|
|
3a898a6dc1 | ||
|
|
e1aafefb07 | ||
|
|
75a353125c | ||
|
|
22c0d1f83d | ||
|
|
35b9f8fca1 | ||
|
|
0cffb1403e | ||
|
|
16aa8de709 | ||
|
|
6c3665623d | ||
|
|
fc6c621418 | ||
|
|
57092aed99 | ||
|
|
07c026340c | ||
|
|
9e20186df3 | ||
|
|
2a541180a9 | ||
|
|
bf1e1bbfef | ||
|
|
3619a930b2 | ||
|
|
336d502106 | ||
|
|
29dbf62233 | ||
|
|
ec1d891d8d | ||
|
|
0bab32de74 | ||
|
|
72daa3f2e8 | ||
|
|
2367bfeb59 | ||
|
|
517657fa76 | ||
|
|
db55910857 | ||
|
|
b72e719cb7 | ||
|
|
3e99c698e6 | ||
|
|
05ae62dc1d | ||
|
|
8a4d5bf840 | ||
|
|
972239d2e4 | ||
|
|
804ce69df9 | ||
|
|
32ad139038 | ||
|
|
fdea28266f | ||
|
|
d08db10f01 | ||
|
|
ba3cacfddb | ||
|
|
8cdb2ef78d | ||
|
|
0a84560027 | ||
|
|
3313ea733e | ||
|
|
20ee636a91 | ||
|
|
8f05155fab | ||
|
|
58d0fc1d9e | ||
|
|
0f70022a16 | ||
|
|
f9fee59b25 | ||
|
|
751badad13 | ||
|
|
4298d5bf1c | ||
|
|
0d6f48e49b | ||
|
|
bc4193316f |
@@ -1,3 +1,4 @@
|
|||||||
|
# Root-context job images only need service code, never the webapp or repo data.
|
||||||
*
|
*
|
||||||
!background-jobs
|
!background-jobs
|
||||||
!service
|
!service
|
||||||
@@ -7,6 +8,11 @@ service/*
|
|||||||
# Keyword extraction contract, shared with background-jobs/app/llm/client.py.
|
# Keyword extraction contract, shared with background-jobs/app/llm/client.py.
|
||||||
!service/src/main/inse/news/keyword_extraction.py
|
!service/src/main/inse/news/keyword_extraction.py
|
||||||
|
|
||||||
|
# UDE verified-persons job image imports the full service package and one
|
||||||
|
# institution hierarchy, so these are the only extra paths it needs.
|
||||||
|
!service/src/main/inse
|
||||||
|
!service/src/data/hierarchies/I62318514/hierarchy.json
|
||||||
|
|
||||||
# Data-only folders that do not belong in the job image.
|
# Data-only folders that do not belong in the job image.
|
||||||
service/scripts/multipliers
|
service/scripts/multipliers
|
||||||
|
|
||||||
@@ -16,3 +22,8 @@ service/scripts/multipliers
|
|||||||
**/.env
|
**/.env
|
||||||
**/.env.*
|
**/.env.*
|
||||||
**/out
|
**/out
|
||||||
|
.git
|
||||||
|
|
||||||
|
# Ignore the LLM cache, which can be large and is not needed in the job image.
|
||||||
|
**/.llm_cache
|
||||||
|
service/scripts/jobs-image/orgminer_pipeline/
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ src/python/account/
|
|||||||
.env
|
.env
|
||||||
|
|
||||||
*.pyc
|
*.pyc
|
||||||
|
.env
|
||||||
|
|
||||||
node_modules/
|
node_modules/
|
||||||
angular-app/.angular
|
angular-app/.angular
|
||||||
@@ -25,3 +26,6 @@ service/sentence_transformer/models/
|
|||||||
llm_evaluations/bio_generation/.venv
|
llm_evaluations/bio_generation/.venv
|
||||||
|
|
||||||
.devcontainer
|
.devcontainer
|
||||||
|
# Runtime checkpoint for the UDE OrgMiner verified-person uploader.
|
||||||
|
service/scripts/upload_orgminer_verified_persons_ude/orgminer_verified_persons_ude_progress.json
|
||||||
|
service/scripts/upload_orgminer_verified_persons_ude/orgminer_verified_persons_ude_progress.json.tmp
|
||||||
|
|||||||
Vendored
+2
@@ -70,10 +70,12 @@ pipeline {
|
|||||||
-o StrictHostKeyChecking=no \
|
-o StrictHostKeyChecking=no \
|
||||||
${DEPLOY_HOST} "
|
${DEPLOY_HOST} "
|
||||||
docker load < ~/tmp/app-image.tar.gz &&
|
docker load < ~/tmp/app-image.tar.gz &&
|
||||||
|
docker volume create smartguide-data &&
|
||||||
docker stop inse-app || true &&
|
docker stop inse-app || true &&
|
||||||
docker rm inse-app || true &&
|
docker rm inse-app || true &&
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name inse-app \
|
--name inse-app \
|
||||||
|
-v smartguide-data:/data \
|
||||||
-p 8080:8000 \
|
-p 8080:8000 \
|
||||||
${IMAGE_PREFIX}-app:${IMAGE_VERSION} run
|
${IMAGE_PREFIX}-app:${IMAGE_VERSION} run
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ RUN pip install --root-user-action=ignore --no-cache-dir --disable-pip-version-c
|
|||||||
|
|
||||||
COPY [ "src/main", "/home" ]
|
COPY [ "src/main", "/home" ]
|
||||||
COPY [ "src/data", "/data" ]
|
COPY [ "src/data", "/data" ]
|
||||||
|
COPY [ "src/data", "/seed-data" ]
|
||||||
EXPOSE 8000/tcp
|
EXPOSE 8000/tcp
|
||||||
VOLUME [ "/home", "/mnt", "/data" ]
|
VOLUME [ "/home", "/mnt", "/data" ]
|
||||||
ENTRYPOINT [ "/home/entrypoint.sh" ]
|
ENTRYPOINT [ "/home/entrypoint.sh" ]
|
||||||
|
|||||||
+28
-3
@@ -31,7 +31,6 @@ task createImage(type: Exec) {
|
|||||||
commandLine 'docker', 'build', '--platform', "${targetPlatform}", '-t', "${imagePrefix}-service:${imageVersion}", '.'
|
commandLine 'docker', 'build', '--platform', "${targetPlatform}", '-t', "${imagePrefix}-service:${imageVersion}", '.'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task test(type: Exec) {
|
task test(type: Exec) {
|
||||||
dependsOn createImage
|
dependsOn createImage
|
||||||
def envFile = System.getenv('INSE_ENV_FILE')
|
def envFile = System.getenv('INSE_ENV_FILE')
|
||||||
@@ -62,12 +61,38 @@ task exportOpenApiSpec(type: Exec) {
|
|||||||
'-c',
|
'-c',
|
||||||
"import json; from inse.main import app; open('/mnt/openapi/inse-service.openapi.json', 'w').write(json.dumps(app.openapi(), indent=2))"
|
"import json; from inse.main import app; open('/mnt/openapi/inse-service.openapi.json', 'w').write(json.dumps(app.openapi(), indent=2))"
|
||||||
}
|
}
|
||||||
|
task createDataVolume(type: Exec) {
|
||||||
|
commandLine 'docker', 'volume', 'create', 'smartguide-data'
|
||||||
|
}
|
||||||
|
|
||||||
|
task initializeDataVolume(type: Exec) {
|
||||||
|
dependsOn createDataVolume
|
||||||
|
|
||||||
|
commandLine 'docker', 'run', '--rm',
|
||||||
|
'-v', 'smartguide-data:/data',
|
||||||
|
'-v', "${projectDir}/src/data:/seed-data:ro",
|
||||||
|
'alpine',
|
||||||
|
'sh', '-c',
|
||||||
|
'if [ ! -d /data/hierarchies ] || [ -z "$(find /data/hierarchies -mindepth 1 -maxdepth 1 -type d -print -quit)" ]; then cp -a /seed-data/. /data/; fi'
|
||||||
|
}
|
||||||
|
|
||||||
task runServeContainer(type: Exec) {
|
task runServeContainer(type: Exec) {
|
||||||
dependsOn createImage
|
dependsOn createImage
|
||||||
commandLine 'docker', 'run', '--rm', '-v', "${projectDir}/src/main:/home", '-v', "${projectDir}/src/data:/data", '-v', '/var/run/docker.sock:/var/run/docker.sock', '-p', '8000:8000', '-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'", '-e', "INSE_AUTH_STANDALONE=true", '-e', 'INSE_OPENALEX_WORKS_API_KEY', '--name', "${imageName}-service-serve", '--detach', "${imagePrefix}-service:${imageVersion}", 'run', '--reload', '--reload-dir', './inse'
|
dependsOn initializeDataVolume
|
||||||
}
|
|
||||||
|
|
||||||
|
commandLine 'docker', 'run', '--rm',
|
||||||
|
'-v', "${projectDir}/src/main:/home",
|
||||||
|
'-v', 'smartguide-data:/data',
|
||||||
|
'-v', '/var/run/docker.sock:/var/run/docker.sock',
|
||||||
|
'-p', '8000:8000',
|
||||||
|
'-e', "DOCKER_DEFAULT_PLATFORM=${targetPlatform}",
|
||||||
|
'-e', 'INSE_AUTH_STANDALONE=true',
|
||||||
|
'-e', 'INSE_OPENALEX_WORKS_API_KEY',
|
||||||
|
'--name', "${imageName}-service-serve",
|
||||||
|
'--detach',
|
||||||
|
"${imagePrefix}-service:${imageVersion}",
|
||||||
|
'run', '--reload', '--reload-dir', './inse'
|
||||||
|
}
|
||||||
task stopServeContainer(type: Exec) {
|
task stopServeContainer(type: Exec) {
|
||||||
commandLine 'docker', 'stop', "${imageName}-service-serve"
|
commandLine 'docker', 'stop', "${imageName}-service-serve"
|
||||||
ignoreExitValue true
|
ignoreExitValue true
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ differ only by their `command`.
|
|||||||
| Project-Topic-Mapping | `jobs/project-topics` | `map_project_topics --output-index docker-job_test` | reads projects_bund_v1; needs host backend |
|
| Project-Topic-Mapping | `jobs/project-topics` | `map_project_topics --output-index docker-job_test` | reads projects_bund_v1; needs host backend |
|
||||||
| News-Topic-Mapping | `jobs/news-topics` | `map_news_topics --output-index aktuell_openalex_topics` | bundles both topic_mapper pkgs; needs host backend |
|
| News-Topic-Mapping | `jobs/news-topics` | `map_news_topics --output-index aktuell_openalex_topics` | bundles both topic_mapper pkgs; needs host backend |
|
||||||
| News-Keyword-Extraction | `jobs/news-keywords` | `sync.py --update-keywords --target-index docker-job_test` | ES + LLM creds; writes to test index |
|
| News-Keyword-Extraction | `jobs/news-keywords` | `sync.py --update-keywords --target-index docker-job_test` | ES + LLM creds; writes to test index |
|
||||||
|
| UDE OrgMiner Verified Persons | `jobs/orgminer-verified-persons-ude` | `upload_orgminer_verified_persons_ude.py --progress-file /state/orgminer_verified_persons_ude_progress.json` | Writes `orgminer_verified_persons_ude`; image-scoped NES creds; persistent checkpoint |
|
||||||
| Demo-Job A / B / C | `jobs/demo` | `demo.py` (seconds via command: `20` / `25` / `30`) | no dependencies; one image, three job rows |
|
| Demo-Job A / B / C | `jobs/demo` | `demo.py` (seconds via command: `20` / `25` / `30`) | no dependencies; one image, three job rows |
|
||||||
|
|
||||||
Each image is its own repository under the `jobs/` path namespace, prefixed
|
Each image is its own repository under the `jobs/` path namespace, prefixed
|
||||||
@@ -106,6 +107,30 @@ docker push docker.nes.uni-due.de/inse/jobs/news-crawl:latest
|
|||||||
|
|
||||||
Each image's Dockerfile header lists its own build command.
|
Each image's Dockerfile header lists its own build command.
|
||||||
|
|
||||||
|
### UDE OrgMiner verified persons
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -f service/scripts/jobs-image/orgminer-verified-persons-ude/Dockerfile \
|
||||||
|
-t docker.nes.uni-due.de/inse/jobs/orgminer-verified-persons-ude:latest .
|
||||||
|
docker push docker.nes.uni-due.de/inse/jobs/orgminer-verified-persons-ude:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a manual-only job in the Jobs UI with this image and set **Persistent
|
||||||
|
directory** to `/state`. The image's entrypoint writes its JSON checkpoint to
|
||||||
|
`/state/orgminer_verified_persons_ude_progress.json`; the runner mounts a task-specific Docker volume there so
|
||||||
|
separate runs resume. Keep the job definition if you need to keep its checkpoint
|
||||||
|
(deleting the definition also removes its volume). Leave **Command** empty for a
|
||||||
|
full resumable run, or set it to `--limit 5` for a small first run. Set **Command**
|
||||||
|
to `--fresh` if every invocation should delete the checkpoint and start at the
|
||||||
|
first organization. Organizations are processed sequentially; no concurrency
|
||||||
|
flags exist. The target index is `orgminer_verified_persons_ude`.
|
||||||
|
|
||||||
|
If the run stops without a `Finished:` line and reports exit `137`, the
|
||||||
|
container was killed (usually by the host's out-of-memory killer) and no Python
|
||||||
|
traceback exists. The run log then gets a `[system] ... ran out of memory ...`
|
||||||
|
note from the runner. A job without a **Persistent directory** always starts
|
||||||
|
from the first organization, which makes such a restart look identical.
|
||||||
|
|
||||||
## Running locally without pushing
|
## Running locally without pushing
|
||||||
|
|
||||||
Before each run the backend pulls the job's image from the registry when it is a
|
Before each run the backend pulls the job's image from the registry when it is a
|
||||||
@@ -127,6 +152,10 @@ is enough for local runs.
|
|||||||
Because every tag lives under the `docker.nes.uni-due.de` registry host, the
|
Because every tag lives under the `docker.nes.uni-due.de` registry host, the
|
||||||
backend treats these as registry images and injects the INSE Elasticsearch / LLM
|
backend treats these as registry images and injects the INSE Elasticsearch / LLM
|
||||||
credentials automatically (plus any per-job `env`).
|
credentials automatically (plus any per-job `env`).
|
||||||
|
The `orgminer-verified-persons-ude` image also receives `ELASTICSEARCH_URL` and
|
||||||
|
`ELASTICSEARCH_API_KEY` from backend settings, and only that exact repository
|
||||||
|
gets those NES credentials. Other job images continue to receive INSE/LLM
|
||||||
|
credentials only.
|
||||||
|
|
||||||
Most images write to the test index by default: the crawlers upload into the
|
Most images write to the test index by default: the crawlers upload into the
|
||||||
index named by `NEWS_UPLOAD_INDEX` / `BUND_UPLOAD_INDEX` (both baked to
|
index named by `NEWS_UPLOAD_INDEX` / `BUND_UPLOAD_INDEX` (both baked to
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# UDE OrgMiner staff verification using the collaboration graph.
|
||||||
|
# Build from the repository root:
|
||||||
|
# docker build -f service/scripts/jobs-image/orgminer-verified-persons-ude/Dockerfile \
|
||||||
|
# -t docker.nes.uni-due.de/inse/jobs/orgminer-verified-persons-ude:latest .
|
||||||
|
#
|
||||||
|
# The runner injects INSE credentials for registry images and NES credentials
|
||||||
|
# only for this image. The persistent /state volume holds the JSON checkpoint.
|
||||||
|
FROM python:3.13-slim
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONPATH=/app/service/src/main
|
||||||
|
|
||||||
|
COPY service/scripts/jobs-image/orgminer-verified-persons-ude/requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY service/src/main/inse/ ./service/src/main/inse/
|
||||||
|
COPY service/src/data/hierarchies/I62318514/hierarchy.json \
|
||||||
|
./service/src/data/hierarchies/I62318514/hierarchy.json
|
||||||
|
COPY service/scripts/upload_orgminer_verified_persons_ude/ \
|
||||||
|
./service/scripts/upload_orgminer_verified_persons_ude/
|
||||||
|
|
||||||
|
# Fail the image build if the service verification code is missing a dependency.
|
||||||
|
RUN python -c "import inse.orgminer.logic"
|
||||||
|
|
||||||
|
ENTRYPOINT ["python", "/app/service/scripts/upload_orgminer_verified_persons_ude/upload_orgminer_verified_persons_ude.py", \
|
||||||
|
"--progress-file", "/state/orgminer_verified_persons_ude_progress.json"]
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fastapi~=0.115.0
|
||||||
|
httpx~=0.27.0
|
||||||
|
pydantic-settings~=2.2.1
|
||||||
|
python-dotenv~=1.0
|
||||||
|
sqlmodel~=0.0.33
|
||||||
@@ -472,7 +472,7 @@ One doc per focal author, `_id = <institution>_<author>` (same scheme as scores)
|
|||||||
|
|
||||||
| field | content |
|
| field | content |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `nodes[]` | `{id, name, role, inst, active_years, suspicious}`; role ∈ ego / mentee / cohort / industry / external |
|
| `nodes[]` | `{id, name, role, inst, active_years, suspicious, company_insts?}`; role ∈ ego / mentee / cohort / industry / external. **`industry` is tie-level**: assigned only when a company affiliation of the neighbour appears on a work *shared with the ego* (matching what `industry_coauthor_share` counts), and `company_insts` names the triggering companies — a lifetime-flag version painted predominantly-academic people orange over a single old dual affiliation. `inst` is the author's most frequent institution. |
|
||||||
| `edges[]` | `{a, b, w, n_works, cross, first_year, last_year}` — `w` = decayed tie strength, `cross` = mostly cross-institution |
|
| `edges[]` | `{a, b, w, n_works, cross, first_year, last_year}` — `w` = decayed tie strength, `cross` = mostly cross-institution |
|
||||||
| `ego{}` | header duplicate (bucket, tags, sub_scores, max_sub_score) so a network endpoint renders standalone |
|
| `ego{}` | header duplicate (bucket, tags, sub_scores, max_sub_score) so a network endpoint renders standalone |
|
||||||
| totals | `total_coauthors`, `cohort_coauthors`, `mentee_count`, `shown`, `shown_mentees` |
|
| totals | `total_coauthors`, `cohort_coauthors`, `mentee_count`, `shown`, `shown_mentees` |
|
||||||
|
|||||||
@@ -82,24 +82,42 @@ def main() -> None:
|
|||||||
f"({timings['load_cache_s']}s)")
|
f"({timings['load_cache_s']}s)")
|
||||||
|
|
||||||
# ---- single pass over works before they are freed: DOIs per focal author
|
# ---- single pass over works before they are freed: DOIs per focal author
|
||||||
# (CORDIS join) + per-author institution label and company flag (network docs)
|
# (CORDIS join), per-author institution counts (modal label), and per-WORK
|
||||||
|
# company affiliations (tie-level industry roles in the network docs)
|
||||||
focal_short_ids = {short_id(a) for a in focal_ids}
|
focal_short_ids = {short_id(a) for a in focal_ids}
|
||||||
|
max_authors = int(config["extraction"]["max_authors_per_work"])
|
||||||
dois_by_author: dict[str, set[str]] = {}
|
dois_by_author: dict[str, set[str]] = {}
|
||||||
inst_by_author: dict[str, str] = {}
|
inst_counts: dict[str, dict[str, int]] = {}
|
||||||
company_authors: set[str] = set()
|
company_by_author_work: dict[str, dict[str, list[str]]] = {}
|
||||||
|
company_work_authors: dict[str, set[str]] = {}
|
||||||
for w in works:
|
for w in works:
|
||||||
doi = normalize_doi(w.get("doi"))
|
doi = normalize_doi(w.get("doi"))
|
||||||
|
wid = short_id(w.get("id"))
|
||||||
|
work_authors: set[str] = set()
|
||||||
|
work_companies: dict[str, list[str]] = {}
|
||||||
for a in w.get("authorships") or []:
|
for a in w.get("authorships") or []:
|
||||||
aid = short_id((a.get("author") or {}).get("id"))
|
aid = short_id((a.get("author") or {}).get("id"))
|
||||||
if not aid:
|
if not aid:
|
||||||
continue
|
continue
|
||||||
|
work_authors.add(aid)
|
||||||
if doi and aid in focal_short_ids:
|
if doi and aid in focal_short_ids:
|
||||||
dois_by_author.setdefault(aid, set()).add(doi)
|
dois_by_author.setdefault(aid, set()).add(doi)
|
||||||
for inst in a.get("institutions") or []:
|
for inst in a.get("institutions") or []:
|
||||||
if aid not in inst_by_author and inst.get("display_name"):
|
name = inst.get("display_name")
|
||||||
inst_by_author[aid] = inst["display_name"]
|
if name:
|
||||||
if inst.get("type") == "company":
|
counts = inst_counts.setdefault(aid, {})
|
||||||
company_authors.add(aid)
|
counts[name] = counts.get(name, 0) + 1
|
||||||
|
if inst.get("type") == "company":
|
||||||
|
work_companies.setdefault(aid, []).append(name)
|
||||||
|
# company evidence only for works that also enter the graph (same cap)
|
||||||
|
if wid and work_companies and 2 <= len(work_authors) <= max_authors:
|
||||||
|
company_work_authors[wid] = work_authors
|
||||||
|
for aid, names in work_companies.items():
|
||||||
|
company_by_author_work.setdefault(aid, {})[wid] = names
|
||||||
|
inst_by_author = {
|
||||||
|
aid: max(counts, key=counts.get) for aid, counts in inst_counts.items()
|
||||||
|
}
|
||||||
|
del inst_counts
|
||||||
|
|
||||||
# ---- graph ----
|
# ---- graph ----
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
@@ -196,7 +214,8 @@ def main() -> None:
|
|||||||
scored,
|
scored,
|
||||||
incident_edges(graph),
|
incident_edges(graph),
|
||||||
inst_by_author,
|
inst_by_author,
|
||||||
company_authors,
|
company_by_author_work,
|
||||||
|
company_work_authors,
|
||||||
max_nodes=int(network_cfg.get("max_nodes", 42)),
|
max_nodes=int(network_cfg.get("max_nodes", 42)),
|
||||||
max_forced_mentees=int(network_cfg.get("max_forced_mentees", 14)),
|
max_forced_mentees=int(network_cfg.get("max_forced_mentees", 14)),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ def build_network_docs(
|
|||||||
scored_rows: list[dict[str, Any]],
|
scored_rows: list[dict[str, Any]],
|
||||||
incident: dict[str, list],
|
incident: dict[str, list],
|
||||||
inst_by_author: dict[str, str],
|
inst_by_author: dict[str, str],
|
||||||
company_authors: set[str],
|
company_by_author_work: dict[str, dict[str, list[str]]],
|
||||||
|
company_work_authors: dict[str, set[str]],
|
||||||
max_nodes: int = 42,
|
max_nodes: int = 42,
|
||||||
max_forced_mentees: int = 14,
|
max_forced_mentees: int = 14,
|
||||||
) -> list[dict[str, Any]]:
|
) -> list[dict[str, Any]]:
|
||||||
@@ -49,6 +50,16 @@ def build_network_docs(
|
|||||||
|
|
||||||
metric_rows must still carry the FULL `junior_ids` (pre-scoring; the scored
|
metric_rows must still carry the FULL `junior_ids` (pre-scoring; the scored
|
||||||
rows' evidence list is capped). scored_rows supply the ego header fields.
|
rows' evidence list is capped). scored_rows supply the ego header fields.
|
||||||
|
|
||||||
|
Industry roles are TIE-LEVEL, not lifetime: a neighbour is marked `industry`
|
||||||
|
only if a company affiliation of theirs appears on a work SHARED with the ego
|
||||||
|
— matching what `industry_coauthor_share` counts. (The first version flagged
|
||||||
|
anyone who ever had a company affiliation anywhere in the corpus, which
|
||||||
|
painted predominantly-academic people orange over one dual affiliation from
|
||||||
|
years ago, with a university name in the tooltip contradicting the colour.)
|
||||||
|
The triggering company names ship on the node as `company_insts`, and
|
||||||
|
`inst_by_author` should be the author's MOST FREQUENT institution so the
|
||||||
|
default label matches reality.
|
||||||
"""
|
"""
|
||||||
scored_by_id = {r["author_id"]: r for r in scored_rows}
|
scored_by_id = {r["author_id"]: r for r in scored_rows}
|
||||||
docs: list[dict[str, Any]] = []
|
docs: list[dict[str, Any]] = []
|
||||||
@@ -71,26 +82,34 @@ def build_network_docs(
|
|||||||
nodes = []
|
nodes = []
|
||||||
for nid in selected:
|
for nid in selected:
|
||||||
node = graph.nodes[nid]
|
node = graph.nodes[nid]
|
||||||
|
# company evidence ON WORKS SHARED WITH THE EGO only
|
||||||
|
shared_companies: set[str] = set()
|
||||||
|
for wid, names in (company_by_author_work.get(nid) or {}).items():
|
||||||
|
if ego_id in company_work_authors.get(wid, ()):
|
||||||
|
shared_companies.update(names)
|
||||||
if nid == ego_id:
|
if nid == ego_id:
|
||||||
role = "ego"
|
role = "ego"
|
||||||
elif nid in mentees:
|
elif nid in mentees:
|
||||||
role = "mentee"
|
role = "mentee"
|
||||||
elif nid in company_authors and not node.is_focal:
|
elif shared_companies and not node.is_focal:
|
||||||
role = "industry"
|
role = "industry"
|
||||||
elif node.is_focal:
|
elif node.is_focal:
|
||||||
role = "cohort"
|
role = "cohort"
|
||||||
else:
|
else:
|
||||||
role = "external"
|
role = "external"
|
||||||
nodes.append(
|
entry = {
|
||||||
{
|
"id": nid,
|
||||||
"id": nid,
|
"name": node.display_name,
|
||||||
"name": node.display_name,
|
"role": role,
|
||||||
"role": role,
|
"inst": inst_by_author.get(nid, ""),
|
||||||
"inst": inst_by_author.get(nid, ""),
|
"active_years": len(node.publication_years),
|
||||||
"active_years": len(node.publication_years),
|
"suspicious": is_suspicious_profile(node.publication_years),
|
||||||
"suspicious": is_suspicious_profile(node.publication_years),
|
}
|
||||||
}
|
if shared_companies:
|
||||||
)
|
# the receipts for the industry colour (also kept on cohort/
|
||||||
|
# mentee nodes so tooltips can show the industry link)
|
||||||
|
entry["company_insts"] = sorted(shared_companies)
|
||||||
|
nodes.append(entry)
|
||||||
|
|
||||||
# all corpus edges among the selected nodes — pair lookups against the
|
# all corpus edges among the selected nodes — pair lookups against the
|
||||||
# edge dict (~900 per ego), NOT a scan of the 5.8M-edge dict per ego
|
# edge dict (~900 per ego), NOT a scan of the 5.8M-edge dict per ego
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import warcio
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import json
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||||
|
from pipeline_utils import load_config, get_entity, out_path, add_common_args
|
||||||
|
|
||||||
|
redirect_lookup = {}
|
||||||
|
|
||||||
|
|
||||||
|
def process_file(filename):
|
||||||
|
print("Searching file", filename)
|
||||||
|
with open(filename, 'rb') as stream:
|
||||||
|
for record in warcio.ArchiveIterator(stream):
|
||||||
|
if record.rec_type == 'response':
|
||||||
|
status = int(record.http_headers.get_statuscode())
|
||||||
|
# get all redirected responses
|
||||||
|
if 300 <= status < 400:
|
||||||
|
location = record.http_headers.get_header('Location')
|
||||||
|
uri = record.rec_headers.get_header('WARC-Target-URI')
|
||||||
|
if location:
|
||||||
|
print(location)
|
||||||
|
redirect_lookup.setdefault(location, []).append(uri)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(description="Build a redirection lookup table from WARC files.")
|
||||||
|
parser.add_argument("warc_dir", help="Directory containing WARC files to scan")
|
||||||
|
add_common_args(parser)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
config = load_config(args.config)
|
||||||
|
get_entity(config, args.entity) # validates the entity exists, fails fast otherwise
|
||||||
|
output_file = out_path(config, args.entity, "redirections_file")
|
||||||
|
|
||||||
|
print(f"Building redirection lookup from the WARC files for entity '{args.entity}'")
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
|
for directory, subdirectories, files in os.walk(args.warc_dir):
|
||||||
|
for file in files:
|
||||||
|
full_file_dir = os.path.join(directory, file)
|
||||||
|
print("+++++++DIR: ", full_file_dir)
|
||||||
|
process_file(full_file_dir)
|
||||||
|
|
||||||
|
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
||||||
|
with open(output_file, 'w') as rl:
|
||||||
|
json.dump(redirect_lookup, rl)
|
||||||
|
print(redirect_lookup)
|
||||||
|
|
||||||
|
runtime_hours = (time.time() - start_time) / 3600
|
||||||
|
print(f"Runtime: {runtime_hours:.2f} hours")
|
||||||
|
print(f"Created redirection lookup file: {output_file}")
|
||||||
@@ -0,0 +1,250 @@
|
|||||||
|
import warcio
|
||||||
|
import sys
|
||||||
|
import langdetect
|
||||||
|
import trafilatura
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
import datetime
|
||||||
|
import html
|
||||||
|
import argparse
|
||||||
|
import yake
|
||||||
|
import tldextract
|
||||||
|
import hashlib
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||||
|
from pipeline_utils import load_config, get_entity, entity_input_path, out_path, get_es_client, add_common_args
|
||||||
|
|
||||||
|
date_time = datetime.datetime.now()
|
||||||
|
unix_timestamp = round(time.mktime(date_time.timetuple()))
|
||||||
|
|
||||||
|
|
||||||
|
def check_elastic_status():
|
||||||
|
try:
|
||||||
|
info = es.info()
|
||||||
|
except Exception as error:
|
||||||
|
print(f"Elasticsearch connection failed: {error}", file=sys.stderr)
|
||||||
|
return False
|
||||||
|
print(
|
||||||
|
"Connected to Elasticsearch"
|
||||||
|
+ (f" {info.get('version', {}).get('number')}" if info else "")
|
||||||
|
)
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
"analysis": {
|
||||||
|
"analyzer": {
|
||||||
|
"customanalyzer": {
|
||||||
|
"type": "custom",
|
||||||
|
"tokenizer": "standard",
|
||||||
|
"filter": ["lowercase", "asciifolding"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mappings = {
|
||||||
|
"properties": {
|
||||||
|
"uri": {"type": "text", "fields": {"keyword": {"type": "keyword"}}},
|
||||||
|
"scheme": {"type": "keyword"},
|
||||||
|
"domain": {"type": "keyword"},
|
||||||
|
"subdomain": {"type": "keyword"},
|
||||||
|
"path": {"type": "text", "fields": {"keyword": {"type": "keyword"}}},
|
||||||
|
"query": {"type": "text", "fields": {"keyword": {"type": "keyword"}}},
|
||||||
|
"hostname": {"type": "keyword"},
|
||||||
|
"body": {
|
||||||
|
"type": "text",
|
||||||
|
"analyzer": "customanalyzer",
|
||||||
|
"search_analyzer": "customanalyzer"
|
||||||
|
},
|
||||||
|
"lang": {"type": "keyword"},
|
||||||
|
"tags": {
|
||||||
|
"type": "nested",
|
||||||
|
"properties": {
|
||||||
|
"value": {"type": "keyword"},
|
||||||
|
"score": {"type": "double"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"redirected_by": {"type": "keyword"},
|
||||||
|
"timestamp_created": {"type": "date", "format": "epoch_second"},
|
||||||
|
"timestamp_updated": {"type": "date", "format": "epoch_second"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
if not es.indices.exists(index=index_name):
|
||||||
|
es.indices.create(index=index_name, mappings=mappings, settings=settings)
|
||||||
|
print(f"INDEX {index_name} created...")
|
||||||
|
else:
|
||||||
|
print(f"INDEX {index_name} already exists...")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print("failed to create index mapping")
|
||||||
|
print(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def process_file(filename, uploaded_so_far, limit=None):
|
||||||
|
"""Process one WARC file. Stops as soon as `limit` total uploads (across
|
||||||
|
all files, tracked via uploaded_so_far) have succeeded, if a limit is set."""
|
||||||
|
print("Searching file", filename)
|
||||||
|
records = 0
|
||||||
|
successes = 0
|
||||||
|
with open(filename, 'rb') as stream:
|
||||||
|
for record in warcio.ArchiveIterator(stream):
|
||||||
|
if limit is not None and uploaded_so_far + successes >= limit:
|
||||||
|
print(f"Reached upload limit of {limit}. Stopping.")
|
||||||
|
break
|
||||||
|
|
||||||
|
if record.rec_type == 'response':
|
||||||
|
records += 1
|
||||||
|
status = int(record.http_headers.get_statuscode())
|
||||||
|
# Handle 300,600-level statuses
|
||||||
|
if 300 <= status < 600:
|
||||||
|
print(f"Invalid Status ({status}) of the page. Skipped.")
|
||||||
|
continue # Skip further processing of redirected content
|
||||||
|
content_type = record.http_headers.get_header('Content-Type')
|
||||||
|
if not bool(content_type):
|
||||||
|
continue
|
||||||
|
if 'text/html' in content_type.lower():
|
||||||
|
tokens = content_type.split(";")
|
||||||
|
encoding = "iso-8859-1"
|
||||||
|
for token in tokens:
|
||||||
|
trimmed = token.strip()
|
||||||
|
if trimmed.startswith("charset="):
|
||||||
|
encoding = trimmed[8:].lower()
|
||||||
|
|
||||||
|
try:
|
||||||
|
decoded = record.content_stream().read().decode(encoding)
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
|
||||||
|
text = trafilatura.extract(decoded, output_format="txt")
|
||||||
|
if not text:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
lang = langdetect.detect(text)
|
||||||
|
except Exception:
|
||||||
|
lang = ''
|
||||||
|
try:
|
||||||
|
title = html.unescape(re.search(r"<title>(.*?)<\/title>", decoded).group(1))
|
||||||
|
except Exception:
|
||||||
|
title = ''
|
||||||
|
keywords = []
|
||||||
|
if lang == "de":
|
||||||
|
keyword_extractor = yake.KeywordExtractor(dedupFunc="seqm", dedupLim=0.9, top=15, lan="de")
|
||||||
|
yake_keywords = keyword_extractor.extract_keywords(text)
|
||||||
|
else:
|
||||||
|
keyword_extractor = yake.KeywordExtractor(dedupFunc="seqm", dedupLim=0.9, top=15, lan="en")
|
||||||
|
yake_keywords = keyword_extractor.extract_keywords(text)
|
||||||
|
keywords = [{'value': x[0], 'score': x[1]} for x in yake_keywords]
|
||||||
|
if lang == "en" or lang == 'de':
|
||||||
|
print("#######################################")
|
||||||
|
|
||||||
|
lower = text.lower()
|
||||||
|
uri = record.rec_headers.get_header('WARC-Target-URI')
|
||||||
|
|
||||||
|
extracted = tldextract.extract(uri)
|
||||||
|
subdomain = extracted.subdomain.replace('www', '')
|
||||||
|
domain = extracted.domain
|
||||||
|
|
||||||
|
parsed = urlparse(uri)
|
||||||
|
scheme = parsed.scheme
|
||||||
|
path = parsed.path
|
||||||
|
query = parsed.query
|
||||||
|
hostname = parsed.hostname
|
||||||
|
|
||||||
|
lower = lower.replace('\r', '')
|
||||||
|
lower = lower.rstrip()
|
||||||
|
|
||||||
|
print("persisting...")
|
||||||
|
|
||||||
|
element = {}
|
||||||
|
element['uri'] = uri
|
||||||
|
element['scheme'] = scheme
|
||||||
|
element['host'] = hostname
|
||||||
|
element['subdomain'] = subdomain
|
||||||
|
element['domain'] = domain
|
||||||
|
element['path'] = path
|
||||||
|
element['query'] = query
|
||||||
|
element['title'] = title
|
||||||
|
element['body'] = lower
|
||||||
|
element['lang'] = lang
|
||||||
|
element['keywords'] = keywords
|
||||||
|
element['timestamp_created'] = unix_timestamp
|
||||||
|
element['timestamp_updated'] = -1
|
||||||
|
element['redirected_by'] = []
|
||||||
|
|
||||||
|
if uri in redirections:
|
||||||
|
element['redirected_by'] = redirections[uri]
|
||||||
|
|
||||||
|
doc_id = hashlib.sha256(uri.encode("utf-8")).hexdigest()
|
||||||
|
try:
|
||||||
|
es.index(index=index_name, id=doc_id, document=element)
|
||||||
|
successes += 1
|
||||||
|
except Exception as e:
|
||||||
|
print("upload failed....")
|
||||||
|
print(e)
|
||||||
|
continue
|
||||||
|
|
||||||
|
else:
|
||||||
|
print(f"Skipping non-HTML content type: {content_type}")
|
||||||
|
return successes, records
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(description="Upload extracted WARC page content to Elasticsearch.")
|
||||||
|
parser.add_argument("warc_dir", help="Directory containing WARC files to scan")
|
||||||
|
parser.add_argument("redirections_file", nargs="?", default=None,
|
||||||
|
help="Override path to redirections_lookup.json (default: this entity's run output)")
|
||||||
|
add_common_args(parser)
|
||||||
|
parser.add_argument("--limit", type=int, default=None,
|
||||||
|
help="Only upload the first N successfully processed entries, then stop "
|
||||||
|
"(useful for a quick smoke test before running the full crawl upload)")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
print("Starting WARC file processing and upload to Elasticsearch")
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
|
config = load_config(args.config)
|
||||||
|
entity = get_entity(config, args.entity)
|
||||||
|
|
||||||
|
es = get_es_client(config)
|
||||||
|
|
||||||
|
index_name = entity["elasticsearch"]["raw_index"]
|
||||||
|
|
||||||
|
redirections_file = args.redirections_file or out_path(config, args.entity, "redirections_file")
|
||||||
|
|
||||||
|
if check_elastic_status():
|
||||||
|
with open(redirections_file, 'r') as reds:
|
||||||
|
redirections = json.load(reds)
|
||||||
|
|
||||||
|
total_records = 0
|
||||||
|
total_successes = 0
|
||||||
|
limit_hit = False
|
||||||
|
|
||||||
|
for directory, subdirectories, files in os.walk(args.warc_dir):
|
||||||
|
if limit_hit:
|
||||||
|
break
|
||||||
|
for file in files:
|
||||||
|
if args.limit is not None and total_successes >= args.limit:
|
||||||
|
limit_hit = True
|
||||||
|
break
|
||||||
|
|
||||||
|
full_file_dir = os.path.join(directory, file)
|
||||||
|
print("+++++++DIR: ", full_file_dir)
|
||||||
|
successes, records = process_file(full_file_dir, uploaded_so_far=total_successes, limit=args.limit)
|
||||||
|
total_successes += successes
|
||||||
|
total_records += records
|
||||||
|
|
||||||
|
print(f"Total successes: {total_successes} of {total_records}")
|
||||||
|
if args.limit is not None:
|
||||||
|
print(f"(Upload was capped at --limit {args.limit})")
|
||||||
|
else:
|
||||||
|
print("Failed to connect to Elasticsearch")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
runtime_hours = (time.time() - start_time) / 3600
|
||||||
|
print(f"Runtime: {runtime_hours:.2f} hours")
|
||||||
|
print("Finished processing WARC files and uploading to Elasticsearch")
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||||
|
from pipeline_utils import (
|
||||||
|
add_common_args,
|
||||||
|
entity_input_path,
|
||||||
|
hierarchy_path,
|
||||||
|
get_entity,
|
||||||
|
load_config,
|
||||||
|
out_path,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def writeToFile(data, filename):
|
||||||
|
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
||||||
|
with open(filename, 'w', encoding="utf-8") as f:
|
||||||
|
json.dump(data, f, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
|
def clean_uri(uri):
|
||||||
|
parts = uri.rstrip('/').split('/')
|
||||||
|
if 'index' in parts[-1]:
|
||||||
|
parts = parts[:-1]
|
||||||
|
new_uri = '/'.join(parts)
|
||||||
|
|
||||||
|
return new_uri[:-1] if new_uri.endswith('/') else new_uri
|
||||||
|
|
||||||
|
|
||||||
|
def filter_parents(parents, problem_orgs):
|
||||||
|
if problem_orgs:
|
||||||
|
for parent in parents:
|
||||||
|
if parent['link'] in problem_orgs:
|
||||||
|
parent['link'] = problem_orgs[parent['link']]
|
||||||
|
for child in parent['children']:
|
||||||
|
if child['link'] in problem_orgs:
|
||||||
|
child['link'] = problem_orgs[child['link']]
|
||||||
|
return parents
|
||||||
|
|
||||||
|
|
||||||
|
def filter_children(children, problem_orgs):
|
||||||
|
if problem_orgs:
|
||||||
|
for child in children:
|
||||||
|
if child['link'] in problem_orgs:
|
||||||
|
child['link'] = problem_orgs[child['link']]
|
||||||
|
return children
|
||||||
|
|
||||||
|
|
||||||
|
def collect_analysis_links(hierarchy, problem_orgs):
|
||||||
|
parent_leafs = []
|
||||||
|
child_leafs = []
|
||||||
|
unique_links = set()
|
||||||
|
|
||||||
|
def visit(node):
|
||||||
|
link = node.get("link_de") or node.get("link_en")
|
||||||
|
children = [
|
||||||
|
child
|
||||||
|
for group in node.get("children") or []
|
||||||
|
for child in group.get("children") or []
|
||||||
|
]
|
||||||
|
if link and children:
|
||||||
|
parent = {"link": clean_uri(link), "children": []}
|
||||||
|
for child in children:
|
||||||
|
child_link = child.get("link_de") or child.get("link_en")
|
||||||
|
if child_link:
|
||||||
|
normalized_link = clean_uri(child_link)
|
||||||
|
parent["children"].append({"link": normalized_link})
|
||||||
|
unique_links.add(normalized_link)
|
||||||
|
if parent["children"]:
|
||||||
|
parent_leafs.append(parent)
|
||||||
|
elif link:
|
||||||
|
normalized_link = clean_uri(link)
|
||||||
|
if normalized_link not in unique_links:
|
||||||
|
child_leafs.append({"link": normalized_link})
|
||||||
|
unique_links.add(normalized_link)
|
||||||
|
for child in children:
|
||||||
|
visit(child)
|
||||||
|
|
||||||
|
for faculty in hierarchy:
|
||||||
|
visit(faculty)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"parent_leafs": filter_parents(parent_leafs, problem_orgs),
|
||||||
|
"child_leafs": filter_children(child_leafs, problem_orgs),
|
||||||
|
}, unique_links
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Use the accepted hierarchy as the pipeline hierarchy."
|
||||||
|
)
|
||||||
|
add_common_args(parser)
|
||||||
|
parser.add_argument("--problem-orgs", default=None,
|
||||||
|
help="Override the problem_orgs_file configured for this entity")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
config = load_config(args.config)
|
||||||
|
entity = get_entity(config, args.entity)
|
||||||
|
|
||||||
|
print(f"Starting to create hierarchy for entity '{args.entity}'")
|
||||||
|
|
||||||
|
path_to_problem_orgs = args.problem_orgs or (
|
||||||
|
entity_input_path(config, args.entity, "problem_orgs_file")
|
||||||
|
if entity.get("problem_orgs_file")
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
|
||||||
|
problem_orgs = None
|
||||||
|
if path_to_problem_orgs:
|
||||||
|
try:
|
||||||
|
with open(path_to_problem_orgs, encoding="utf-8") as file:
|
||||||
|
problem_orgs = json.load(file)
|
||||||
|
except Exception:
|
||||||
|
print(f'Could not open the problem_orgs file at {path_to_problem_orgs}.')
|
||||||
|
|
||||||
|
with open(hierarchy_path(config, args.entity), encoding="utf-8") as json_file:
|
||||||
|
hierarchy = json.load(json_file)
|
||||||
|
|
||||||
|
if not isinstance(hierarchy, list):
|
||||||
|
raise SystemExit("The accepted hierarchy must be a JSON array of faculties.")
|
||||||
|
|
||||||
|
linksToAnalyze, uniqueLinks = collect_analysis_links(hierarchy, problem_orgs)
|
||||||
|
|
||||||
|
links_to_analyze_file = out_path(config, args.entity, 'links_to_analyze_file')
|
||||||
|
hierarchy_file = out_path(config, args.entity, 'hierarchy_file')
|
||||||
|
|
||||||
|
writeToFile(linksToAnalyze, links_to_analyze_file)
|
||||||
|
writeToFile(hierarchy, hierarchy_file)
|
||||||
|
print(f"Finished creating {hierarchy_file} and {links_to_analyze_file}")
|
||||||
|
print("Number of unique links to analyze:", len(uniqueLinks))
|
||||||
@@ -0,0 +1,531 @@
|
|||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
import re
|
||||||
|
import hashlib
|
||||||
|
import argparse
|
||||||
|
from enum import Enum
|
||||||
|
from json import JSONDecodeError
|
||||||
|
from elasticsearch import helpers
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||||
|
from pipeline_utils import load_config, get_entity, entity_input_path, out_path, get_es_client, get_llm_client, add_common_args
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
uniqueUrls = {}
|
||||||
|
total_urls = 0
|
||||||
|
total_updates = 0
|
||||||
|
failures = 0
|
||||||
|
|
||||||
|
|
||||||
|
def make_id_from_url(url):
|
||||||
|
return hashlib.sha256(url.encode("utf-8")).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def getParentsChildrenUrlCount(parents, children):
|
||||||
|
print('Counting total url number...\n')
|
||||||
|
url_counter = 0
|
||||||
|
for i, parent in enumerate(parents):
|
||||||
|
for child in parent['children']:
|
||||||
|
child['sublinks'] = getSubLinks(child['link'])
|
||||||
|
url_counter += len(child['sublinks'])
|
||||||
|
|
||||||
|
for i, child in enumerate(children):
|
||||||
|
child['sublinks'] = getSubLinks(child['link'])
|
||||||
|
url_counter += len(child['sublinks'])
|
||||||
|
print(f'Total URLs: {url_counter}')
|
||||||
|
return parents, children, url_counter
|
||||||
|
|
||||||
|
|
||||||
|
def clean_uri(uri):
|
||||||
|
parts = uri.rstrip('/').split('/')
|
||||||
|
if 'index' in parts[-1]:
|
||||||
|
parts = parts[:-1]
|
||||||
|
new_uri = '/'.join(parts).replace(" ", "")
|
||||||
|
|
||||||
|
return new_uri[:-1] if new_uri.endswith('/') else new_uri
|
||||||
|
|
||||||
|
|
||||||
|
def get_direct_links(link):
|
||||||
|
body = {
|
||||||
|
"size": 10000,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"match_phrase": {"uri": link}}
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"collapse": {
|
||||||
|
"field": "uri.keyword"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = es.search(index=raw_index, body=body)['hits']['hits']
|
||||||
|
result = add_sources(result, link)
|
||||||
|
print(f'Found {len(result)} by direct search.')
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def get_links_from_redirects(link):
|
||||||
|
total_result = []
|
||||||
|
link2 = link[:-1] if link.endswith('/') else link + '/'
|
||||||
|
body = {
|
||||||
|
"size": 10000,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"match_phrase": {"redirected_by": link}},
|
||||||
|
{"match_phrase": {"redirected_by": link2}}
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"collapse": {
|
||||||
|
"field": "uri.keyword"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = es.search(index=raw_index, body=body)['hits']['hits']
|
||||||
|
redirects = [r['_source']['uri'] for r in result]
|
||||||
|
|
||||||
|
# get corresponded sublinks from redirections
|
||||||
|
if len(redirects) > 0:
|
||||||
|
for url in redirects:
|
||||||
|
print(link + '->' + url)
|
||||||
|
body = {
|
||||||
|
"size": 10000,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"match_phrase": {"uri": url}}
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"collapse": {
|
||||||
|
"field": "uri.keyword"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = es.search(index=raw_index, body=body)['hits']['hits']
|
||||||
|
total_result += add_sources(result, url)
|
||||||
|
print(f'Found {len(total_result)} from redirects.')
|
||||||
|
return total_result
|
||||||
|
|
||||||
|
|
||||||
|
def get_links_by_hostname(link, hostname):
|
||||||
|
parsed = urlparse(link)
|
||||||
|
scheme = parsed.scheme
|
||||||
|
body = {
|
||||||
|
"size": 10000,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"match_phrase": {"uri": scheme + "://" + hostname}}
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"collapse": {
|
||||||
|
"field": "uri.keyword"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = es.search(index=raw_index, body=body)['hits']['hits']
|
||||||
|
result = add_sources(result, scheme + "://" + hostname)
|
||||||
|
print(f'Found {len(result)} by hostname search.')
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def toggle_www(url):
|
||||||
|
scheme_match = re.match(r'^(https?://)', url, re.IGNORECASE)
|
||||||
|
|
||||||
|
if scheme_match:
|
||||||
|
scheme = scheme_match.group(0)
|
||||||
|
rest_of_url = url[len(scheme):]
|
||||||
|
else:
|
||||||
|
if url.startswith("www."):
|
||||||
|
return "http://" + url
|
||||||
|
return "http://www." + url
|
||||||
|
|
||||||
|
if rest_of_url.startswith("www."):
|
||||||
|
return scheme + rest_of_url[4:]
|
||||||
|
else:
|
||||||
|
return scheme + "www." + rest_of_url
|
||||||
|
|
||||||
|
|
||||||
|
def getSubLinks(link):
|
||||||
|
updated_sublinks = [] # only collect new/changed docs in this call
|
||||||
|
total_results = []
|
||||||
|
total_toggle_results = []
|
||||||
|
|
||||||
|
parsed = urlparse(link)
|
||||||
|
hostname = parsed.hostname
|
||||||
|
print('\n' + '[ORIGINAL] Working on ' + link + '\n')
|
||||||
|
total_results += get_direct_links(link)
|
||||||
|
|
||||||
|
if hostname not in BANNED_HOSTNAMES:
|
||||||
|
total_results += get_links_by_hostname(link, hostname)
|
||||||
|
|
||||||
|
total_results += get_links_from_redirects(link)
|
||||||
|
|
||||||
|
total_results = add_sources(total_results, link)
|
||||||
|
|
||||||
|
# TOGGLED links
|
||||||
|
toggled_link = toggle_www(link)
|
||||||
|
toggle_parsed = urlparse(toggled_link)
|
||||||
|
toggle_hostname = toggle_parsed.hostname
|
||||||
|
print('\n' + '[TOGGLED] Working on ' + toggled_link + '\n')
|
||||||
|
total_results += get_direct_links(toggled_link)
|
||||||
|
|
||||||
|
if toggle_hostname not in BANNED_HOSTNAMES:
|
||||||
|
total_toggle_results += get_links_by_hostname(toggled_link, toggle_hostname)
|
||||||
|
|
||||||
|
total_toggle_results += get_links_from_redirects(toggled_link)
|
||||||
|
total_toggle_results = add_sources(total_toggle_results, toggled_link)
|
||||||
|
|
||||||
|
# Merge into global dict but only return changed ones
|
||||||
|
for hit in (total_results + total_toggle_results):
|
||||||
|
hit['_source']['uri'] = clean_uri(hit['_source']['uri'])
|
||||||
|
uri = hit['_source']['uri']
|
||||||
|
|
||||||
|
if uri not in uniqueUrls:
|
||||||
|
uniqueUrls[uri] = hit['_source']
|
||||||
|
updated_sublinks.append(uniqueUrls[uri]) # NEW urls
|
||||||
|
else:
|
||||||
|
existing = uniqueUrls[uri]
|
||||||
|
new_sources = hit['_source'].get('sources', [])
|
||||||
|
added = False
|
||||||
|
for src in new_sources:
|
||||||
|
if src not in existing['sources']:
|
||||||
|
existing['sources'].append(src)
|
||||||
|
added = True
|
||||||
|
if added:
|
||||||
|
updated_sublinks.append(existing) # UPDATED
|
||||||
|
|
||||||
|
return updated_sublinks
|
||||||
|
|
||||||
|
|
||||||
|
def add_sources(chunk, url):
|
||||||
|
for page in chunk:
|
||||||
|
if 'sources' not in page['_source']:
|
||||||
|
page['_source']['sources'] = []
|
||||||
|
if url not in page['_source']['sources']:
|
||||||
|
page['_source']['sources'].append(url)
|
||||||
|
if problem_orgs: # add missing sources from problem_orgs.json
|
||||||
|
for key, value in problem_orgs.items():
|
||||||
|
if value == url:
|
||||||
|
if key not in page['_source']['sources']:
|
||||||
|
page['_source']['sources'].append(key)
|
||||||
|
|
||||||
|
return chunk
|
||||||
|
|
||||||
|
|
||||||
|
def check_elastic_status(index_name):
|
||||||
|
if not es.ping():
|
||||||
|
print("Elasticsearch connection not found")
|
||||||
|
return False
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
"analysis": {
|
||||||
|
"analyzer": {
|
||||||
|
"customanalyzer": {
|
||||||
|
"type": "custom",
|
||||||
|
"tokenizer": "standard",
|
||||||
|
"filter": [
|
||||||
|
"lowercase",
|
||||||
|
"asciifolding"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mappings = {
|
||||||
|
"properties": {
|
||||||
|
"uri": {
|
||||||
|
"type": "text",
|
||||||
|
"fields": {
|
||||||
|
"keyword": {"type": "keyword"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain": {"type": "keyword"},
|
||||||
|
"subdomain": {"type": "keyword"},
|
||||||
|
"path": {
|
||||||
|
"type": "text",
|
||||||
|
"fields": {
|
||||||
|
"keyword": {"type": "keyword"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": {
|
||||||
|
"type": "text",
|
||||||
|
"fields": {
|
||||||
|
"keyword": {"type": "keyword"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"host": {"type": "keyword"},
|
||||||
|
"category": {
|
||||||
|
"type": "keyword",
|
||||||
|
"null_value": "NULL"
|
||||||
|
},
|
||||||
|
"body": {
|
||||||
|
"type": "text",
|
||||||
|
"analyzer": "customanalyzer",
|
||||||
|
"search_analyzer": "customanalyzer"
|
||||||
|
},
|
||||||
|
"lang": {"type": "keyword"},
|
||||||
|
"tags": {
|
||||||
|
"type": "nested",
|
||||||
|
"properties": {
|
||||||
|
"value": {"type": "keyword"},
|
||||||
|
"score": {"type": "double"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sources": {"type": "keyword"},
|
||||||
|
"timestamp_created": {
|
||||||
|
"type": "date",
|
||||||
|
"format": "epoch_second"
|
||||||
|
},
|
||||||
|
"timestamp_updated": {
|
||||||
|
"type": "date",
|
||||||
|
"format": "epoch_second"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
if not es.indices.exists(index=index_name):
|
||||||
|
es.indices.create(index=index_name, mappings=mappings, settings=settings)
|
||||||
|
print(f"INDEX {index_name} created...")
|
||||||
|
else:
|
||||||
|
print(f"INDEX {index_name} already exists...")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print("failed to create index mapping")
|
||||||
|
print(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def getCleanUri(uri):
|
||||||
|
pos = uri.find('?')
|
||||||
|
return uri[:pos] if pos > 0 else uri
|
||||||
|
|
||||||
|
|
||||||
|
def startCategorizing(links_array, index_name, max_rate=30, max_retries=5):
|
||||||
|
print(f"Starting to categorize {len(links_array)} urls with max_rate={max_rate} and max_retries={max_retries}")
|
||||||
|
success_counter = 0
|
||||||
|
fail_counter = 0
|
||||||
|
response_schema = {
|
||||||
|
"name": "classified_url",
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"category": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"Teaching",
|
||||||
|
"Research",
|
||||||
|
"Projects",
|
||||||
|
"Staff",
|
||||||
|
"News",
|
||||||
|
"Other",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["category"],
|
||||||
|
"additionalProperties": False,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt = ("You are a URL classifier for university-related URLs."
|
||||||
|
f"The allowed categories are: {', '.join(CATEGORIES)}. "
|
||||||
|
"You will receive a URL. Respond ONLY with a valid JSON object, which contains "
|
||||||
|
'assigned category to the URL in this exact format: {"category": CATEGORY}. '
|
||||||
|
"Do not include any other text. Use only the provided categories. "
|
||||||
|
"Important:1) The URL must be assigned to a category. "
|
||||||
|
'2) If you are not sure enough if the category is right, assign the URL to "Other" category')
|
||||||
|
|
||||||
|
for i in range(0, len(links_array), max_rate):
|
||||||
|
chunk = links_array[i:i + max_rate]
|
||||||
|
|
||||||
|
chunk_to_feed = []
|
||||||
|
chunk_to_skip = []
|
||||||
|
for link in chunk:
|
||||||
|
clean = getCleanUri(link['uri'])
|
||||||
|
if clean in categorizedUrls:
|
||||||
|
link['category'] = categorizedUrls[clean]
|
||||||
|
chunk_to_skip.append(link)
|
||||||
|
else:
|
||||||
|
chunk_to_feed.append(link)
|
||||||
|
|
||||||
|
print(f'Number of NEW urls:{len(chunk_to_feed)}\nNumber of already categorized urls: {len(chunk_to_skip)}')
|
||||||
|
|
||||||
|
if chunk_to_feed:
|
||||||
|
for link in chunk_to_feed:
|
||||||
|
tries = 0
|
||||||
|
while True:
|
||||||
|
if tries > max_retries:
|
||||||
|
print(f"Couldnt categorize URL: {link['uri']} ... Skipping it...")
|
||||||
|
break
|
||||||
|
try:
|
||||||
|
messages = [
|
||||||
|
{"role": "system", "content": prompt},
|
||||||
|
{"role": "user", "content": link['uri']}
|
||||||
|
]
|
||||||
|
|
||||||
|
chat_completion = llm_client.chat.completions.create(
|
||||||
|
messages=messages,
|
||||||
|
model=MODEL_NAME,
|
||||||
|
response_format={
|
||||||
|
"type": "json_schema",
|
||||||
|
"json_schema": response_schema,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
content = chat_completion.choices[0].message.content
|
||||||
|
print(f"Response from LLM: {content}")
|
||||||
|
|
||||||
|
try:
|
||||||
|
category_obj = json.loads(content)
|
||||||
|
except JSONDecodeError:
|
||||||
|
print("Invalid JSON format. Retrying...")
|
||||||
|
time.sleep(1)
|
||||||
|
continue
|
||||||
|
category = category_obj.get('category')
|
||||||
|
if category and category in CATEGORIES:
|
||||||
|
link['category'] = category
|
||||||
|
clean = getCleanUri(link['uri'])
|
||||||
|
categorizedUrls[clean] = link['category']
|
||||||
|
else:
|
||||||
|
print(f"Invalid category... Retrying... {content, link['uri']}")
|
||||||
|
tries += 1
|
||||||
|
time.sleep(1)
|
||||||
|
continue
|
||||||
|
|
||||||
|
break # break on success
|
||||||
|
except Exception:
|
||||||
|
print(f"Exception occurred: {traceback.format_exc()}. Retrying...")
|
||||||
|
time.sleep(1)
|
||||||
|
for link in (chunk_to_skip + chunk_to_feed):
|
||||||
|
print(f"Uploading {link['uri']} with category: {link.get('category')} ")
|
||||||
|
try:
|
||||||
|
chunk_to_upload = [
|
||||||
|
{"_index": index_name, "_id": make_id_from_url(link['uri']), "_source": link}
|
||||||
|
for link in (chunk_to_skip + chunk_to_feed)
|
||||||
|
]
|
||||||
|
success, failed = helpers.bulk(es, chunk_to_upload, raise_on_error=False)
|
||||||
|
print(f"Success:{success}, Failed:{len(failed)}")
|
||||||
|
|
||||||
|
for f in failed:
|
||||||
|
print(json.dumps(f, indent=2))
|
||||||
|
success_counter += success
|
||||||
|
fail_counter += len(failed)
|
||||||
|
except Exception as e:
|
||||||
|
print("Error during bulk upload:", e)
|
||||||
|
|
||||||
|
print(f"{success_counter} successfully uploaded. Failed: {fail_counter}\n")
|
||||||
|
return success_counter, fail_counter
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(description="Classify extracted links into content categories via an LLM.")
|
||||||
|
add_common_args(parser)
|
||||||
|
parser.add_argument("links_to_analyze_file", nargs="?", default=None,
|
||||||
|
help="Override path to links_to_analyze.json (default: this entity's run output)")
|
||||||
|
parser.add_argument("--problem-orgs", default=None,
|
||||||
|
help="Override the problem_orgs_file configured for this entity")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
start_time = time.time()
|
||||||
|
print("Starting to categorize URLs")
|
||||||
|
|
||||||
|
config = load_config(args.config)
|
||||||
|
entity = get_entity(config, args.entity)
|
||||||
|
|
||||||
|
# entity-driven settings that used to be hardcoded at module level
|
||||||
|
es = get_es_client(config)
|
||||||
|
llm_client, MODEL_NAME = get_llm_client(config)
|
||||||
|
print(f"Using LLM model: {MODEL_NAME}, {config['llm']}")
|
||||||
|
raw_index = entity["elasticsearch"]["raw_index"]
|
||||||
|
index_name = entity["elasticsearch"]["categorized_index"]
|
||||||
|
BANNED_HOSTNAMES = entity.get(
|
||||||
|
"classifier_banned_hostnames",
|
||||||
|
entity.get("banned_hostnames", []),
|
||||||
|
)
|
||||||
|
CATEGORIES = config.get("default_categories", ["Teaching", "Research", "Projects", "Staff", "News", "Other"])
|
||||||
|
|
||||||
|
links_file = args.links_to_analyze_file or out_path(config, args.entity, "links_to_analyze_file")
|
||||||
|
with open(links_file, 'r') as json_stream:
|
||||||
|
links_total = json.load(json_stream)
|
||||||
|
|
||||||
|
log_filename = out_path(config, args.entity, "classifier_log")
|
||||||
|
if os.path.exists(log_filename):
|
||||||
|
with open(log_filename, 'r') as f:
|
||||||
|
try:
|
||||||
|
categorizedUrls = json.load(f)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
categorizedUrls = {}
|
||||||
|
else:
|
||||||
|
categorizedUrls = {}
|
||||||
|
|
||||||
|
# get problem orgs file to add missing sources
|
||||||
|
problem_orgs = {}
|
||||||
|
path_to_problem_orgs = args.problem_orgs or (
|
||||||
|
entity_input_path(config, args.entity, "problem_orgs_file") if entity.get("problem_orgs_file") else None
|
||||||
|
)
|
||||||
|
if path_to_problem_orgs:
|
||||||
|
try:
|
||||||
|
with open(path_to_problem_orgs, 'r') as file:
|
||||||
|
problem_orgs = json.load(file)
|
||||||
|
except Exception:
|
||||||
|
print(f'Could not open the problem_orgs file at {path_to_problem_orgs}.')
|
||||||
|
|
||||||
|
parents = links_total['parent_leafs']
|
||||||
|
children = links_total['child_leafs']
|
||||||
|
|
||||||
|
parents_to_analyse, children_to_analyse, total_urls = getParentsChildrenUrlCount(parents=parents, children=children)
|
||||||
|
|
||||||
|
if not check_elastic_status(index_name):
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
for i, parent in enumerate(parents_to_analyse):
|
||||||
|
for j, child in enumerate(parent['children']):
|
||||||
|
print(f'Parent {i + 1} of {len(parents_to_analyse)}: Child {j + 1} of {len(parent["children"])} \n')
|
||||||
|
|
||||||
|
if problem_orgs: # categorize actual orgs and not aggregators from problem_orgs.json
|
||||||
|
for key, value in problem_orgs.items():
|
||||||
|
if value == child['link']:
|
||||||
|
child['link'] = key
|
||||||
|
|
||||||
|
categorizedUrls[child['link']] = "Entity"
|
||||||
|
successes, fails = startCategorizing(child['sublinks'], index_name)
|
||||||
|
total_updates += successes
|
||||||
|
failures += fails
|
||||||
|
with open(log_filename, 'w') as f:
|
||||||
|
json.dump(categorizedUrls, f)
|
||||||
|
print(f'Total: {total_updates} of {total_urls}. Failed: {failures}\n')
|
||||||
|
|
||||||
|
for i, child in enumerate(children_to_analyse):
|
||||||
|
print(f'child {i + 1} of {len(children_to_analyse)}\n')
|
||||||
|
|
||||||
|
if problem_orgs: # categorize actual orgs and not aggregators from problem_orgs.json
|
||||||
|
for key, value in problem_orgs.items():
|
||||||
|
if value == child['link']:
|
||||||
|
child['link'] = key
|
||||||
|
|
||||||
|
categorizedUrls[child['link']] = "Entity"
|
||||||
|
|
||||||
|
successes, fails = startCategorizing(child['sublinks'], index_name, max_rate=30)
|
||||||
|
total_updates += successes
|
||||||
|
failures += fails
|
||||||
|
with open(log_filename, 'w') as f:
|
||||||
|
json.dump(categorizedUrls, f)
|
||||||
|
print(f'Total: {total_updates} of {total_urls}. Failed: {failures}\n')
|
||||||
|
print(f'updated {total_updates} of {total_urls}\n')
|
||||||
|
|
||||||
|
runtime_hours = (time.time() - start_time) / 3600
|
||||||
|
print(f"Runtime: {runtime_hours:.2f} hours")
|
||||||
|
print("finished categorizing URLs")
|
||||||
+1065
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,309 @@
|
|||||||
|
import time
|
||||||
|
import json
|
||||||
|
from json import JSONDecodeError
|
||||||
|
import tiktoken
|
||||||
|
import traceback
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import argparse
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||||
|
from pipeline_utils import load_config, get_entity, out_path, get_es_client, get_llm_client, add_common_args
|
||||||
|
|
||||||
|
MAX_KEYWORDS = 30
|
||||||
|
|
||||||
|
failed_extractions = {}
|
||||||
|
failed_organizations = []
|
||||||
|
|
||||||
|
|
||||||
|
class Keywords(BaseModel):
|
||||||
|
items: List[str]
|
||||||
|
|
||||||
|
|
||||||
|
def count_tokens(content):
|
||||||
|
enc = tiktoken.encoding_for_model("gpt-4o")
|
||||||
|
tokens = enc.encode(content)
|
||||||
|
return len(tokens)
|
||||||
|
|
||||||
|
|
||||||
|
def filter_scores(data, threshold=0.30): # threshold = % of highest
|
||||||
|
if not data or not data[0].get('_score'):
|
||||||
|
return []
|
||||||
|
|
||||||
|
highest_score = data[0]['_score']
|
||||||
|
|
||||||
|
return [
|
||||||
|
item for item in data
|
||||||
|
if (highest_score - item['_score']) / highest_score < threshold
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def get_unique_keywords(string_array):
|
||||||
|
unique_set = set(s.lower() for s in string_array)
|
||||||
|
return list(dict.fromkeys(s for s in string_array if s.lower() in unique_set))
|
||||||
|
|
||||||
|
|
||||||
|
def extract_keywords(prompt, bodies, org_uri, entity_title, source_links, max_retries=5):
|
||||||
|
time.sleep(1)
|
||||||
|
total_keywords = []
|
||||||
|
for idx, body in enumerate(bodies):
|
||||||
|
retries = 0
|
||||||
|
tokens_count = count_tokens(body)
|
||||||
|
print(f'Extracting body. ({idx + 1} of {len(bodies)}) with {tokens_count} ')
|
||||||
|
while True:
|
||||||
|
if retries > max_retries:
|
||||||
|
keywords = {'items': []}
|
||||||
|
print(f"Couldnt extract keywords for {entity_title}... Number of retries exceeded. Skipping it...")
|
||||||
|
if org_uri in failed_extractions:
|
||||||
|
failed_extractions[org_uri]['entities'].append(entity_title)
|
||||||
|
failed_extractions[org_uri]['pages'].append(source_links[idx])
|
||||||
|
else:
|
||||||
|
failed_extractions[org_uri] = {}
|
||||||
|
failed_extractions[org_uri]['entities'] = [entity_title]
|
||||||
|
failed_extractions[org_uri]['pages'] = [source_links[idx]]
|
||||||
|
with open(fails_log_filename, 'w') as f:
|
||||||
|
json.dump(failed_extractions, f)
|
||||||
|
break
|
||||||
|
try:
|
||||||
|
messages = [
|
||||||
|
{"role": "system", "content": prompt},
|
||||||
|
{"role": "user", "content": body}
|
||||||
|
]
|
||||||
|
|
||||||
|
chat_completion = client.chat.completions.create(
|
||||||
|
messages=messages,
|
||||||
|
model=MODEL_NAME,
|
||||||
|
)
|
||||||
|
content = chat_completion.choices[0].message.content
|
||||||
|
try:
|
||||||
|
if content.startswith("```json"):
|
||||||
|
response_array = json.loads(content[7:-3])
|
||||||
|
else:
|
||||||
|
response_array = json.loads(content)
|
||||||
|
except JSONDecodeError:
|
||||||
|
retries += 1
|
||||||
|
print(f"Invalid JSON format. Retrying...{content}")
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
keywords = Keywords(items=response_array)
|
||||||
|
keywords = keywords.model_dump()
|
||||||
|
except ValueError:
|
||||||
|
retries += 1
|
||||||
|
print(f"Content is formatted wrong. Retrying...{response_array}")
|
||||||
|
continue
|
||||||
|
except Exception:
|
||||||
|
print(f"Exception occurred.{traceback.format_exc()} Retrying...")
|
||||||
|
time.sleep(1)
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
total_keywords += keywords['items']
|
||||||
|
return get_unique_keywords(total_keywords)[:MAX_KEYWORDS]
|
||||||
|
|
||||||
|
|
||||||
|
def check_elastic_status():
|
||||||
|
if not es.ping():
|
||||||
|
print("Elasticsearch connection not found")
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def update_organization(index_name, org):
|
||||||
|
doc_id = org['_id']
|
||||||
|
update_body = {
|
||||||
|
"doc": {
|
||||||
|
"staff": org['_source']['staff'],
|
||||||
|
"projects": org['_source']['projects'],
|
||||||
|
"news": org['_source']['news'],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response = es.update(index=index_name, id=doc_id, body=update_body)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def update_staff(prompt, org):
|
||||||
|
org_uri = org['_source']['uri']
|
||||||
|
staff = org['_source']['staff']
|
||||||
|
for idx, staff_entry in enumerate(staff):
|
||||||
|
name = staff_entry['name']
|
||||||
|
query = {
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
{"match_phrase": {"sources": org_uri}},
|
||||||
|
{"match": {"body": {"query": name.lower(), "operator": "AND"}}}
|
||||||
|
],
|
||||||
|
"should": [
|
||||||
|
{"match": {"uri": {"query": name.lower(), "boost": 5}}},
|
||||||
|
{"match": {"uri": {"query": "staff", "boost": 2}}},
|
||||||
|
{"match": {"uri": {"query": "mitarbeiter", "boost": 2}}},
|
||||||
|
{"match": {"uri": {"query": "team", "boost": 2}}},
|
||||||
|
{"match": {"uri": {"query": "member", "boost": 2}}},
|
||||||
|
{"match": {"uri": {"query": "person", "boost": 2}}},
|
||||||
|
{"match": {"body": {"query": "staff", "boost": 1.5}}},
|
||||||
|
{"match": {"body": {"query": "mitarbeiter", "boost": 1.5}}},
|
||||||
|
{"match": {"body": {"query": "member", "boost": 1.5}}},
|
||||||
|
{"match": {"body": {"query": "person", "boost": 1.5}}},
|
||||||
|
{"match": {"body": {"query": "team", "boost": 1.5}}}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"size": 5
|
||||||
|
}
|
||||||
|
|
||||||
|
print(f'Extracting keywords of {name}: {idx + 1} of {len(staff)}')
|
||||||
|
staff[idx] = update_content_entity(query=query, prompt=prompt.replace('{name}', name), entity=staff_entry, entity_title=name, org_uri=org_uri)
|
||||||
|
|
||||||
|
|
||||||
|
def update_projects(prompt, org):
|
||||||
|
org_uri = org['_source']['uri']
|
||||||
|
projects = org['_source']['projects']
|
||||||
|
for idx, project_entry in enumerate(projects):
|
||||||
|
title = project_entry['title']
|
||||||
|
query = {
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
{"match_phrase": {"sources": org_uri}},
|
||||||
|
{"match": {"body": title.lower()}}
|
||||||
|
],
|
||||||
|
"should": [
|
||||||
|
{"match": {"uri": {"query": title.lower(), "boost": 5}}},
|
||||||
|
{"match": {"uri": {"query": "projects", "boost": 2}}},
|
||||||
|
{"match": {"uri": {"query": "projekte", "boost": 2}}},
|
||||||
|
{"match": {"body": {"query": "projects", "boost": 1.5}}},
|
||||||
|
{"match": {"body": {"query": "projekte", "boost": 1.5}}}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"size": 5
|
||||||
|
}
|
||||||
|
|
||||||
|
print(f'Extracting keywords of {title}: {idx + 1} of {len(projects)}')
|
||||||
|
projects[idx] = update_content_entity(query=query, prompt=prompt.replace('{project}', title), entity=project_entry, entity_title=title, org_uri=org_uri)
|
||||||
|
|
||||||
|
|
||||||
|
def update_news(prompt, org):
|
||||||
|
org_uri = org['_source']['uri']
|
||||||
|
news = org['_source']['news']
|
||||||
|
for idx, news_item in enumerate(news):
|
||||||
|
title = news_item['title']
|
||||||
|
query = {
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
{"match_phrase": {"sources": org_uri}},
|
||||||
|
{"match": {"body": title.lower()}}
|
||||||
|
],
|
||||||
|
"should": [
|
||||||
|
{"match": {"uri": {"query": title.lower(), "boost": 5}}},
|
||||||
|
{"match": {"uri": {"query": "news", "boost": 2}}},
|
||||||
|
{"match": {"uri": {"query": "neuigkeit", "boost": 2}}},
|
||||||
|
{"match": {"body": {"query": "news", "boost": 1.5}}},
|
||||||
|
{"match": {"body": {"query": "neuigkeit", "boost": 1.5}}}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"size": 5
|
||||||
|
}
|
||||||
|
|
||||||
|
print(f'Extracting keywords of {title}: {idx + 1} of {len(news)}')
|
||||||
|
news[idx] = update_content_entity(query=query, prompt=prompt.replace('{news_item}', title), entity=news_item, entity_title=title, org_uri=org_uri)
|
||||||
|
|
||||||
|
|
||||||
|
def update_content_entity(query, prompt, entity, entity_title, org_uri):
|
||||||
|
entity_pages = filter_scores(es.search(index=categorized_index, body=query)['hits']['hits'])
|
||||||
|
entity_pages_bodys = []
|
||||||
|
source_links = []
|
||||||
|
for page in entity_pages:
|
||||||
|
entity_pages_bodys.append(page['_source']['body'])
|
||||||
|
source_links.append(page['_source']['uri'])
|
||||||
|
|
||||||
|
keywords = extract_keywords(prompt=prompt, bodies=entity_pages_bodys, entity_title=entity_title, source_links=source_links, org_uri=org_uri)
|
||||||
|
entity['keywords'] = keywords
|
||||||
|
entity['links'] = source_links
|
||||||
|
return entity
|
||||||
|
|
||||||
|
|
||||||
|
def get_all_orgs():
|
||||||
|
body = {
|
||||||
|
"size": 10000,
|
||||||
|
"query": {"bool": {"must": {"match_all": {}}}},
|
||||||
|
"collapse": {"field": "uri.keyword"}
|
||||||
|
}
|
||||||
|
|
||||||
|
all_organizations = es.search(index=content_index, body=body)['hits']['hits']
|
||||||
|
return all_organizations
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(description="Mine keywords from previously extracted staff/projects/news content.")
|
||||||
|
add_common_args(parser)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
print("Starting mining content keywords from extracted content")
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
|
config = load_config(args.config)
|
||||||
|
entity = get_entity(config, args.entity)
|
||||||
|
|
||||||
|
es = get_es_client(config)
|
||||||
|
client, MODEL_NAME = get_llm_client(config)
|
||||||
|
categorized_index = entity["elasticsearch"]["categorized_index"]
|
||||||
|
content_index = entity["elasticsearch"]["content_index"]
|
||||||
|
|
||||||
|
prompt_staff = """Extract as a big as possible set of unique and narrowly focused keywords from the following text that reflect {name}'s specific research interests and areas of expertise. Avoid general or broad terms. Focus only on concrete topics, methods, technologies. Return only a JSON-formatted array of keywords as a string.If no keywods can be extracted output an empty array. Do not include any explanations or additional text."""
|
||||||
|
prompt_projects = """Extract as a big as possible set of unique and narrowly focused keywords from the project "{project}" that reflect its specific topics, methods, technologies, or application domains. Avoid general or vague terms. If no meaningful keywords can be extracted, return an empty JSON array. Output only a JSON-formatted array of keywords as a string. Do not include any explanations or additional text."""
|
||||||
|
prompt_news = """Extract as a big as possible set of unique and narrowly focused keywords from the given news title "{news_item}" that capture its specific topic, event, technology, or issue. Avoid general terms or overly broad concepts. If no meaningful keywords can be extracted, return an empty JSON array. Output only a JSON-formatted array of keywords as a string. Do not include any explanations or additional text."""
|
||||||
|
|
||||||
|
if check_elastic_status():
|
||||||
|
log_filename = out_path(config, args.entity, "keywords_updated_log")
|
||||||
|
fails_log_filename = out_path(config, args.entity, "keywords_failed_log")
|
||||||
|
|
||||||
|
if os.path.exists(log_filename):
|
||||||
|
with open(log_filename, 'r') as f:
|
||||||
|
try:
|
||||||
|
uploaded_orgs = json.load(f)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
uploaded_orgs = []
|
||||||
|
else:
|
||||||
|
uploaded_orgs = []
|
||||||
|
|
||||||
|
uploaded_urls = [org['uri'] for org in uploaded_orgs]
|
||||||
|
|
||||||
|
print('Uploaded orgs:', uploaded_urls)
|
||||||
|
all_organizations = get_all_orgs()
|
||||||
|
organizations = [org for org in all_organizations if org['_source']['uri'] not in uploaded_urls]
|
||||||
|
if len(organizations) > 0:
|
||||||
|
for idx, org in enumerate(organizations):
|
||||||
|
print(f'Extracting organization: {idx + 1} of {len(organizations)}: {org["_source"]["uri"]}')
|
||||||
|
update_staff(prompt=prompt_staff, org=org)
|
||||||
|
update_projects(prompt=prompt_projects, org=org)
|
||||||
|
update_news(prompt=prompt_news, org=org)
|
||||||
|
|
||||||
|
response = update_organization(index_name=content_index, org=org)
|
||||||
|
if response and response['_shards']['failed'] == 0:
|
||||||
|
print(f"{org['_source']['uri']} successfully updated.")
|
||||||
|
uploaded_orgs.append({"uri": org['_source']['uri']})
|
||||||
|
with open(log_filename, 'w') as f:
|
||||||
|
json.dump(uploaded_orgs, f)
|
||||||
|
else:
|
||||||
|
print(f"Update failed for {org['_source']['uri']}")
|
||||||
|
failed_organizations.append(org['_source']['uri'])
|
||||||
|
|
||||||
|
if not failed_organizations:
|
||||||
|
print('All Organizations were updated.')
|
||||||
|
else:
|
||||||
|
print('Couldnt update the following organizations:', failed_organizations)
|
||||||
|
|
||||||
|
if failed_extractions:
|
||||||
|
print('Failed extractions', failed_extractions)
|
||||||
|
else:
|
||||||
|
print("All Extractions were successfull.")
|
||||||
|
else:
|
||||||
|
print(f"Nothing to update. Delete {log_filename} first.")
|
||||||
|
|
||||||
|
runtime_hours = (time.time() - start_time) / 3600
|
||||||
|
print(f"Runtime: {runtime_hours:.2f} hours")
|
||||||
|
print("Finished mining content keywords from extracted content")
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# Orgminer pipeline image. Build from the repo root:
|
||||||
|
# docker build -f service/scripts/orgminer_pipeline/Dockerfile \
|
||||||
|
# -t docker.nes.uni-due.de/inse/jobs/orgminer_pipeline:latest .
|
||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PIP_NO_CACHE_DIR=1 \
|
||||||
|
HF_HOME=/opt/hf-cache
|
||||||
|
|
||||||
|
# libmagic1: needed by python-magic. tini: forwards SIGTERM and reaps child processes.
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends libmagic1 tini \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app/orgminer_pipeline
|
||||||
|
|
||||||
|
|
||||||
|
RUN pip install torch==2.9.1
|
||||||
|
|
||||||
|
COPY service/scripts/orgminer_pipeline/requirements.txt .
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
COPY service/scripts/orgminer_pipeline/ ./
|
||||||
|
|
||||||
|
# Pipeline state (WARCs, crawl state, checkpoints). Mounted as a volume by the job runner.
|
||||||
|
RUN mkdir -p /app/orgminer_pipeline/runs
|
||||||
|
|
||||||
|
ENTRYPOINT ["tini", "--"]
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
# 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:
|
||||||
|
|
||||||
|
1. Generate crawl seeds from the accepted hierarchy.
|
||||||
|
2. Crawl all seed URLs and their allowed internal links.
|
||||||
|
3. Store responses as WARC files.
|
||||||
|
4. Build a redirect lookup.
|
||||||
|
5. Upload HTML content to Elasticsearch.
|
||||||
|
6. Load the accepted organization hierarchy.
|
||||||
|
7. Classify crawled URLs with the configured LLM.
|
||||||
|
8. Extract staff, projects, and news.
|
||||||
|
9. 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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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:
|
||||||
|
|
||||||
|
```env
|
||||||
|
ES_PASSWORD=...
|
||||||
|
ES_HOST=https://your-elasticsearch-host:443
|
||||||
|
ES_USERNAME=elastic
|
||||||
|
|
||||||
|
llm_api=https://your-llm-api/v1
|
||||||
|
llm_key=...
|
||||||
|
```
|
||||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
|||||||
|
# Define here the models for your scraped items
|
||||||
|
#
|
||||||
|
# See documentation in:
|
||||||
|
# https://docs.scrapy.org/en/latest/topics/items.html
|
||||||
|
|
||||||
|
import scrapy
|
||||||
|
|
||||||
|
|
||||||
|
class CrawlerItem(scrapy.Item):
|
||||||
|
# define the fields for your item here like:
|
||||||
|
# name = scrapy.Field()
|
||||||
|
pass
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
# Define here the models for your spider middleware
|
||||||
|
#
|
||||||
|
# See documentation in:
|
||||||
|
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
|
||||||
|
|
||||||
|
from scrapy import signals
|
||||||
|
|
||||||
|
# useful for handling different item types with a single interface
|
||||||
|
from itemadapter import is_item, ItemAdapter
|
||||||
|
|
||||||
|
import scrapy_warcio
|
||||||
|
|
||||||
|
class CrawlerSpiderMiddleware:
|
||||||
|
# Not all methods need to be defined. If a method is not defined,
|
||||||
|
# scrapy acts as if the spider middleware does not modify the
|
||||||
|
# passed objects.
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_crawler(cls, crawler):
|
||||||
|
# This method is used by Scrapy to create your spiders.
|
||||||
|
s = cls()
|
||||||
|
crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def process_spider_input(self, response, spider):
|
||||||
|
# Called for each response that goes through the spider
|
||||||
|
# middleware and into the spider.
|
||||||
|
|
||||||
|
# Should return None or raise an exception.
|
||||||
|
return None
|
||||||
|
|
||||||
|
def process_spider_output(self, response, result, spider):
|
||||||
|
# Called with the results returned from the Spider, after
|
||||||
|
# it has processed the response.
|
||||||
|
|
||||||
|
# Must return an iterable of Request, or item objects.
|
||||||
|
for i in result:
|
||||||
|
yield i
|
||||||
|
|
||||||
|
def process_spider_exception(self, response, exception, spider):
|
||||||
|
# Called when a spider or process_spider_input() method
|
||||||
|
# (from other spider middleware) raises an exception.
|
||||||
|
|
||||||
|
# Should return either None or an iterable of Request or item objects.
|
||||||
|
pass
|
||||||
|
|
||||||
|
def process_start_requests(self, start_requests, spider):
|
||||||
|
# Called with the start requests of the spider, and works
|
||||||
|
# similarly to the process_spider_output() method, except
|
||||||
|
# that it doesn’t have a response associated.
|
||||||
|
|
||||||
|
# Must return only requests (not items).
|
||||||
|
for r in start_requests:
|
||||||
|
yield r
|
||||||
|
|
||||||
|
def spider_opened(self, spider):
|
||||||
|
spider.logger.info("Spider opened: %s" % spider.name)
|
||||||
|
|
||||||
|
|
||||||
|
class CrawlerDownloaderMiddleware:
|
||||||
|
# Not all methods need to be defined. If a method is not defined,
|
||||||
|
# scrapy acts as if the downloader middleware does not modify the
|
||||||
|
# passed objects.
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_crawler(cls, crawler):
|
||||||
|
# This method is used by Scrapy to create your spiders.
|
||||||
|
s = cls()
|
||||||
|
crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
|
||||||
|
return s
|
||||||
|
|
||||||
|
def process_request(self, request, spider):
|
||||||
|
# Called for each request that goes through the downloader
|
||||||
|
# middleware.
|
||||||
|
|
||||||
|
# Must either:
|
||||||
|
# - return None: continue processing this request
|
||||||
|
# - or return a Response object
|
||||||
|
# - or return a Request object
|
||||||
|
# - or raise IgnoreRequest: process_exception() methods of
|
||||||
|
# installed downloader middleware will be called
|
||||||
|
return None
|
||||||
|
|
||||||
|
def process_response(self, request, response, spider):
|
||||||
|
# Called with the response returned from the downloader.
|
||||||
|
|
||||||
|
# Must either;
|
||||||
|
# - return a Response object
|
||||||
|
# - return a Request object
|
||||||
|
# - or raise IgnoreRequest
|
||||||
|
return response
|
||||||
|
|
||||||
|
def process_exception(self, request, exception, spider):
|
||||||
|
# Called when a download handler or a process_request()
|
||||||
|
# (from other downloader middleware) raises an exception.
|
||||||
|
|
||||||
|
# Must either:
|
||||||
|
# - return None: continue processing this exception
|
||||||
|
# - return a Response object: stops process_exception() chain
|
||||||
|
# - return a Request object: stops process_exception() chain
|
||||||
|
pass
|
||||||
|
|
||||||
|
def spider_opened(self, spider):
|
||||||
|
spider.logger.info("Spider opened: %s" % spider.name)
|
||||||
|
|
||||||
|
|
||||||
|
# Warc IO downloader middleware
|
||||||
|
class WarcioDownloaderMiddleware:
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.warcio = scrapy_warcio.ScrapyWarcIo()
|
||||||
|
|
||||||
|
def process_request(self, request, spider):
|
||||||
|
request.meta['WARC-Date'] = scrapy_warcio.warc_date()
|
||||||
|
return None
|
||||||
|
|
||||||
|
def process_response(self, request, response, spider):
|
||||||
|
request.meta["WARC-Record-Depth"] = str(request.meta.get("depth", 0))
|
||||||
|
self.warcio.write(response, request)
|
||||||
|
return response
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Define your item pipelines here
|
||||||
|
#
|
||||||
|
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
|
||||||
|
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
|
||||||
|
|
||||||
|
|
||||||
|
# useful for handling different item types with a single interface
|
||||||
|
from itemadapter import ItemAdapter
|
||||||
|
|
||||||
|
|
||||||
|
class CrawlerPipeline:
|
||||||
|
def process_item(self, item, spider):
|
||||||
|
return item
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
# Scrapy settings for crawler project
|
||||||
|
#
|
||||||
|
# For simplicity, this file contains only settings considered important or
|
||||||
|
# commonly used. You can find more settings consulting the documentation:
|
||||||
|
#
|
||||||
|
# https://docs.scrapy.org/en/latest/topics/settings.html
|
||||||
|
# https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
|
||||||
|
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
BOT_NAME = "crawler"
|
||||||
|
|
||||||
|
SPIDER_MODULES = ["crawler.spiders"]
|
||||||
|
NEWSPIDER_MODULE = "crawler.spiders"
|
||||||
|
|
||||||
|
|
||||||
|
# Crawl responsibly by identifying yourself (and your website) on the user-agent
|
||||||
|
USER_AGENT = "inse-crawler (+https://www.nes.uni-due.de)"
|
||||||
|
|
||||||
|
# Obey robots.txt rules
|
||||||
|
ROBOTSTXT_OBEY = True
|
||||||
|
|
||||||
|
# Configure maximum concurrent requests performed by Scrapy (default: 16)
|
||||||
|
CONCURRENT_REQUESTS = 16
|
||||||
|
|
||||||
|
# Configure a delay for requests for the same website (default: 0)
|
||||||
|
# See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
|
||||||
|
# See also autothrottle settings and docs
|
||||||
|
DOWNLOAD_DELAY = 2
|
||||||
|
# The download delay setting will honor only one of:
|
||||||
|
CONCURRENT_REQUESTS_PER_DOMAIN = 16
|
||||||
|
# CONCURRENT_REQUESTS_PER_IP = 16
|
||||||
|
|
||||||
|
# Disable cookies (enabled by default)
|
||||||
|
#COOKIES_ENABLED = False
|
||||||
|
|
||||||
|
# Disable Telnet Console (enabled by default)
|
||||||
|
#TELNETCONSOLE_ENABLED = False
|
||||||
|
|
||||||
|
# Override the default request headers:
|
||||||
|
#DEFAULT_REQUEST_HEADERS = {
|
||||||
|
# "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||||
|
# "Accept-Language": "en",
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Enable or disable spider middlewares
|
||||||
|
# See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
|
||||||
|
#SPIDER_MIDDLEWARES = {
|
||||||
|
# "crawler.middlewares.CrawlerSpiderMiddleware": 543,
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Enable or disable downloader middlewares
|
||||||
|
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
|
||||||
|
#DOWNLOADER_MIDDLEWARES = {
|
||||||
|
# "crawler.middlewares.CrawlerDownloaderMiddleware": 543,
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Enable or disable extensions
|
||||||
|
# See https://docs.scrapy.org/en/latest/topics/extensions.html
|
||||||
|
#EXTENSIONS = {
|
||||||
|
# "scrapy.extensions.telnet.TelnetConsole": None,
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Configure item pipelines
|
||||||
|
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
|
||||||
|
#ITEM_PIPELINES = {
|
||||||
|
# "crawler.pipelines.CrawlerPipeline": 300,
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Enable and configure the AutoThrottle extension (disabled by default)
|
||||||
|
# See https://docs.scrapy.org/en/latest/topics/autothrottle.html
|
||||||
|
#AUTOTHROTTLE_ENABLED = True
|
||||||
|
# The initial download delay
|
||||||
|
#AUTOTHROTTLE_START_DELAY = 5
|
||||||
|
# The maximum download delay to be set in case of high latencies
|
||||||
|
#AUTOTHROTTLE_MAX_DELAY = 60
|
||||||
|
# The average number of requests Scrapy should be sending in parallel to
|
||||||
|
# each remote server
|
||||||
|
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
|
||||||
|
# Enable showing throttling stats for every response received:
|
||||||
|
#AUTOTHROTTLE_DEBUG = False
|
||||||
|
|
||||||
|
# Enable and configure HTTP caching (disabled by default)
|
||||||
|
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
|
||||||
|
#HTTPCACHE_ENABLED = True
|
||||||
|
#HTTPCACHE_EXPIRATION_SECS = 0
|
||||||
|
#HTTPCACHE_DIR = "httpcache"
|
||||||
|
#HTTPCACHE_IGNORE_HTTP_CODES = []
|
||||||
|
#HTTPCACHE_STORAGE = "scrapy.extensions.httpcache.FilesystemCacheStorage"
|
||||||
|
|
||||||
|
# Set settings whose default value is deprecated to a future-proof value
|
||||||
|
REQUEST_FINGERPRINTER_IMPLEMENTATION = "2.7"
|
||||||
|
TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
|
||||||
|
FEED_EXPORT_ENCODING = "utf-8"
|
||||||
|
|
||||||
|
# Add the warcio downloader middleware
|
||||||
|
os.environ.setdefault("SCRAPY_WARCIO_SETTINGS", "warc.yml")
|
||||||
|
|
||||||
|
DOWNLOAD_DELAY = 2
|
||||||
|
CONCURRENT_REQUESTS = 16
|
||||||
|
CONCURRENT_REQUESTS_PER_DOMAIN = 16
|
||||||
|
DOWNLOAD_TIMEOUT = 40
|
||||||
|
|
||||||
|
DOWNLOADER_MIDDLEWARES = {
|
||||||
|
# swap the order of redirect and compression middleware to inject warcio at the right place
|
||||||
|
"scrapy.downloadermiddlewares.redirect.RedirectMiddleware": 590,
|
||||||
|
"crawler.middlewares.WarcioDownloaderMiddleware": 595,
|
||||||
|
"scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware": 600,
|
||||||
|
}
|
||||||
|
|
||||||
|
# # Use true breadth first search to crawl the websites
|
||||||
|
# DEPTH_LIMIT = 6
|
||||||
|
# DEPTH_STATS_VERBOSE = True
|
||||||
|
DEPTH_PRIORITY = 1
|
||||||
|
SCHEDULER_DISK_QUEUE = "scrapy.squeues.PickleFifoDiskQueue"
|
||||||
|
SCHEDULER_MEMORY_QUEUE = "scrapy.squeues.FifoMemoryQueue"
|
||||||
|
|
||||||
|
#DFS
|
||||||
|
# DEPTH_PRIORITY = 1
|
||||||
|
# SCHEDULER_DISK_QUEUE = 'scrapy.squeues.LifoDiskQueue'
|
||||||
|
# SCHEDULER_MEMORY_QUEUE = 'scrapy.squeues.LifoMemoryQueue'
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# This package will contain the spiders of your Scrapy project
|
||||||
|
#
|
||||||
|
# Please refer to the documentation for information on how to create and manage
|
||||||
|
# your spiders.
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
import json
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from urllib.parse import urlsplit
|
||||||
|
|
||||||
|
import scrapy
|
||||||
|
from scrapy.linkextractors import LinkExtractor
|
||||||
|
from scrapy.spiders import CrawlSpider, Rule
|
||||||
|
|
||||||
|
|
||||||
|
REPOSITORY_ROOT = os.path.abspath(
|
||||||
|
os.path.join(os.path.dirname(__file__), "..", "..", "..")
|
||||||
|
)
|
||||||
|
if REPOSITORY_ROOT not in sys.path:
|
||||||
|
sys.path.insert(0, REPOSITORY_ROOT)
|
||||||
|
|
||||||
|
from pipeline_utils import generated_entities_path, get_entity, load_config
|
||||||
|
|
||||||
|
|
||||||
|
class OrganizationSpider(CrawlSpider):
|
||||||
|
"""
|
||||||
|
Generic entity-driven university crawler.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
scrapy crawl organization -a entity=ude -a config=/path/pipeline_config.json
|
||||||
|
"""
|
||||||
|
|
||||||
|
name = "organization"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_crawler(cls, crawler, *args, **kwargs):
|
||||||
|
entity = kwargs.get("entity")
|
||||||
|
config = kwargs.get("config")
|
||||||
|
if entity and config:
|
||||||
|
pipeline_config = load_config(config)
|
||||||
|
entity_config = get_entity(pipeline_config, entity)
|
||||||
|
crawl_config = entity_config.get("crawl", {})
|
||||||
|
print ("CRAWL CONFIG: ", crawl_config)
|
||||||
|
crawler.settings.set(
|
||||||
|
"DEPTH_LIMIT", int(crawl_config.get("depth_limit", 6)), priority="spider"
|
||||||
|
)
|
||||||
|
crawler.settings.set(
|
||||||
|
"DOWNLOAD_DELAY", float(crawl_config.get("download_delay", 2)), priority="spider"
|
||||||
|
)
|
||||||
|
crawler.settings.set(
|
||||||
|
"CONCURRENT_REQUESTS",
|
||||||
|
int(crawl_config.get("concurrent_requests", 16)),
|
||||||
|
priority="spider",
|
||||||
|
)
|
||||||
|
crawler.settings.set(
|
||||||
|
"CONCURRENT_REQUESTS_PER_DOMAIN",
|
||||||
|
int(crawl_config.get("concurrent_requests_per_domain", 16)),
|
||||||
|
priority="spider",
|
||||||
|
)
|
||||||
|
crawler.settings.set(
|
||||||
|
"DOWNLOAD_TIMEOUT", int(crawl_config.get("download_timeout", 40)), priority="spider"
|
||||||
|
)
|
||||||
|
crawler.settings.set(
|
||||||
|
"USER_AGENT", crawl_config.get("user_agent", "inse-crawler"), priority="spider"
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
f"Starting crawler with maximum depth: "
|
||||||
|
f"{crawler.settings.getint('DEPTH_LIMIT')}"
|
||||||
|
)
|
||||||
|
return super().from_crawler(crawler, *args, **kwargs)
|
||||||
|
|
||||||
|
def __init__(self, entity=None, config=None, *args, **kwargs):
|
||||||
|
if not entity:
|
||||||
|
raise ValueError("Missing required Scrapy argument: -a entity=<entity>")
|
||||||
|
|
||||||
|
self.entity_name = entity
|
||||||
|
self.config_path = config
|
||||||
|
|
||||||
|
pipeline_config = load_config(config)
|
||||||
|
entity_config = get_entity(pipeline_config, entity)
|
||||||
|
crawl_config = entity_config.get("crawl", {})
|
||||||
|
|
||||||
|
self.allowed_domains = crawl_config.get("allowed_domains", [])
|
||||||
|
self.banned_hostnames = {
|
||||||
|
host.lower().rstrip(".")
|
||||||
|
for host in crawl_config.get("banned_hostnames", [])
|
||||||
|
}
|
||||||
|
self.deny_patterns = crawl_config.get("deny_url_patterns", [])
|
||||||
|
|
||||||
|
if not self.allowed_domains:
|
||||||
|
raise ValueError(
|
||||||
|
f"Entity '{entity}' has no configured crawl.allowed_domains."
|
||||||
|
)
|
||||||
|
|
||||||
|
seeds_path = generated_entities_path(pipeline_config, entity)
|
||||||
|
if not os.path.exists(seeds_path):
|
||||||
|
raise ValueError(
|
||||||
|
f"Generated seed file does not exist: {seeds_path}. "
|
||||||
|
"Run generate_entities.py first."
|
||||||
|
)
|
||||||
|
|
||||||
|
with open(seeds_path, encoding="utf-8") as handle:
|
||||||
|
seed_data = json.load(handle)
|
||||||
|
|
||||||
|
self.start_urls = [seed["url"] for seed in seed_data.get("seeds", [])]
|
||||||
|
if not self.start_urls:
|
||||||
|
raise ValueError(
|
||||||
|
f"No valid seeds available in {seeds_path}; refusing to crawl."
|
||||||
|
)
|
||||||
|
|
||||||
|
self.rules = (
|
||||||
|
Rule(
|
||||||
|
LinkExtractor(allow_domains=self.allowed_domains, deny=self.deny_patterns),
|
||||||
|
follow=True,
|
||||||
|
callback="parse_page",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def hostname_is_banned(self, url):
|
||||||
|
hostname = (urlsplit(url).hostname or "").lower().rstrip(".")
|
||||||
|
return any(
|
||||||
|
hostname == banned or hostname.endswith("." + banned)
|
||||||
|
for banned in self.banned_hostnames
|
||||||
|
)
|
||||||
|
|
||||||
|
def start_requests(self):
|
||||||
|
for request in super().start_requests():
|
||||||
|
if not self.hostname_is_banned(request.url):
|
||||||
|
yield request
|
||||||
|
|
||||||
|
def _requests_to_follow(self, response):
|
||||||
|
for request in super()._requests_to_follow(response):
|
||||||
|
if not self.hostname_is_banned(request.url):
|
||||||
|
yield request
|
||||||
|
|
||||||
|
def parse_start_url(self, response):
|
||||||
|
print(f"[SEED] depth {response.meta.get('depth', 0)}: {response.url}")
|
||||||
|
self.crawler.stats.inc_value("organization/pages_visited")
|
||||||
|
return []
|
||||||
|
|
||||||
|
def parse_page(self, response):
|
||||||
|
print(f"[LINK] depth {response.meta.get('depth', 0)}: {response.url}")
|
||||||
|
self.crawler.stats.inc_value("organization/pages_visited")
|
||||||
|
return []
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import scrapy
|
||||||
|
import scrapy.spiders
|
||||||
|
import scrapy.linkextractors
|
||||||
|
|
||||||
|
class TudSpider(scrapy.spiders.CrawlSpider):
|
||||||
|
name = "tud"
|
||||||
|
allowed_domains = ["https://www.tu-dortmund.de/" ]
|
||||||
|
start_urls = [ "https://www.tu-dortmund.de/" ]
|
||||||
|
skip_urls = []
|
||||||
|
rules = (scrapy.spiders.Rule(scrapy.linkextractors.LinkExtractor(deny=skip_urls), follow=True),)
|
||||||
|
|
||||||
|
def parse(self, response):
|
||||||
|
# parse item here
|
||||||
|
self.state["items_count"] = self.state.get("items_count", 0) + 1
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import scrapy
|
||||||
|
import scrapy.spiders
|
||||||
|
import scrapy.linkextractors
|
||||||
|
import logging
|
||||||
|
import pickle
|
||||||
|
|
||||||
|
class UdeSpider(scrapy.spiders.CrawlSpider):
|
||||||
|
name = "ude"
|
||||||
|
allowed_domains = [ "uni-due.de", "uk-essen.de"]
|
||||||
|
|
||||||
|
# start_urls = [ "https://www.uni-due.de" ]
|
||||||
|
|
||||||
|
with open("entities", 'rb') as f:
|
||||||
|
start_urls = pickle.load(f)[:1]
|
||||||
|
|
||||||
|
skip_urls = [
|
||||||
|
r"(campus|webmailer|webmail|git|moodle|primo|shop|lehramtswiki)\.(uni-duisburg-essen|uni-due)\.de",
|
||||||
|
r"belegung\.uni-due\.de",
|
||||||
|
r"belegung\.uni-due\.de/lsf",
|
||||||
|
r"uni-due\.de/ub",
|
||||||
|
r"uni-due\.digibib\.net",
|
||||||
|
r"uni-due\.zoom\.us",
|
||||||
|
r"uni-due\.de/myude/",
|
||||||
|
r"uni-due\.de/en/deadlines\.php",
|
||||||
|
r"uni-due\.de/verwaltung",
|
||||||
|
r"uni-due\.de/zim",
|
||||||
|
r"uni-due\.de/aktuell",
|
||||||
|
r"duepublico2\.uni-due\.de",
|
||||||
|
r"uni-due\.de/person",
|
||||||
|
r"uni-due\.de/de/presse",
|
||||||
|
r"uni-due\.de/de/campusaktuell",
|
||||||
|
r"uni-due\.de/de/intranet",
|
||||||
|
r"uni-due\.de/de/veranstaltungen",
|
||||||
|
r"uni-due\.de/de/presse/meldung\.php",
|
||||||
|
r"\.bib$"
|
||||||
|
]
|
||||||
|
rules = (scrapy.spiders.Rule(scrapy.linkextractors.LinkExtractor(deny=skip_urls), follow=True),)
|
||||||
|
|
||||||
|
# def start_requests(self):
|
||||||
|
# yield scrapy.Request(url=self.start_urls, callback=self.parse)
|
||||||
|
|
||||||
|
|
||||||
|
def parse(self, response):
|
||||||
|
self.state["items_count"] = self.state.get("items_count", 0) + 1
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# export SCRAPY_WARCIO_SETTINGS='/path/to/settings.yml'
|
||||||
|
|
||||||
|
---
|
||||||
|
warc_spec: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.0/
|
||||||
|
max_warc_size: 5000000000 # 5GB
|
||||||
|
|
||||||
|
collection: UDE # collection name
|
||||||
|
description: A crawl of the websites of the UDE # collection description
|
||||||
|
operator: arman.arzani@uni-due.de # operator email address
|
||||||
|
robots: obey # robots policy
|
||||||
|
user_agent: ude-crawler # your user-agent
|
||||||
|
warc_prefix: ude # WARC filename prefix
|
||||||
|
warc_dest: ./warc # WARC files destination
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
import json
|
||||||
|
import os
|
||||||
|
import model
|
||||||
|
import typing
|
||||||
|
import selenium
|
||||||
|
import selenium.webdriver
|
||||||
|
import selenium.webdriver.chrome.service
|
||||||
|
import webdriver_manager.chrome
|
||||||
|
import time
|
||||||
|
|
||||||
|
class Browser:
|
||||||
|
chrome: selenium.webdriver.Chrome
|
||||||
|
def __init__(self):
|
||||||
|
self.__create_chrome()
|
||||||
|
|
||||||
|
def __create_chrome(self):
|
||||||
|
''' Creates a headless chrome browser that does not download files. '''
|
||||||
|
options = selenium.webdriver.ChromeOptions()
|
||||||
|
options.add_argument('--headless') # if headless not working correctly use '--headless=new' or '--headless=old'
|
||||||
|
options.add_argument('--window-size=1920,1080')
|
||||||
|
options.add_argument("--disable-cache")
|
||||||
|
options.add_argument("--disk-cache-size=0")
|
||||||
|
os.makedirs("downloads", exist_ok=True)
|
||||||
|
options.add_experimental_option("prefs", { "download_restrictions" : 3, "download.default_directory": "downloads" })
|
||||||
|
options.page_load_strategy = 'normal'
|
||||||
|
self.chrome = selenium.webdriver.Chrome(service=selenium.webdriver.chrome.service.Service(webdriver_manager.chrome.ChromeDriverManager().install()), options=options)
|
||||||
|
self.chrome.execute_cdp_cmd("Network.setCacheDisabled", {"cacheDisabled":True})
|
||||||
|
|
||||||
|
def __download(self, url: str, pagedepth: int = 0, link_text: str = '') -> model.Page:
|
||||||
|
''' Downloads a page using a headless browser and extracts all links. '''
|
||||||
|
self.chrome.get(url)
|
||||||
|
time.sleep(0.5)
|
||||||
|
page_source = self.chrome.page_source
|
||||||
|
page_links = json.loads(self.chrome.execute_script(
|
||||||
|
'''
|
||||||
|
var elements = document.getElementsByTagName('a');
|
||||||
|
var results = [];
|
||||||
|
for (var i = 0; i < elements.length; i++) {
|
||||||
|
if (typeof elements[i].href === 'string' || elements[i].href instanceof String){
|
||||||
|
results.push({
|
||||||
|
url: "" + elements[i].href,
|
||||||
|
text: "" + elements[i].innerText,
|
||||||
|
wrapper: elements[i].querySelector('a') != null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return JSON.stringify(results);
|
||||||
|
'''
|
||||||
|
))
|
||||||
|
|
||||||
|
if link_text == '':
|
||||||
|
found_link_text_flag = False
|
||||||
|
elif link_text in page_source:
|
||||||
|
found_link_text_flag = True
|
||||||
|
else:
|
||||||
|
found_link_text_flag = False
|
||||||
|
|
||||||
|
links: typing.List[model.Link] = []
|
||||||
|
for page_link in page_links:
|
||||||
|
u = page_link['url']
|
||||||
|
while u.endswith("/"):
|
||||||
|
u = u[:-1]
|
||||||
|
link = model.Link(url = page_link['url'], pagedepth = pagedepth + 1, text = page_link['text'], wrapper = page_link['wrapper'])
|
||||||
|
links.append(link)
|
||||||
|
|
||||||
|
browser_url = self.chrome.current_url
|
||||||
|
if browser_url.endswith("/"):
|
||||||
|
browser_url = browser_url[:-1]
|
||||||
|
return model.Page(url = browser_url, pagedepth = pagedepth, text = page_source, links = links, found_link_text_flag = found_link_text_flag)
|
||||||
|
|
||||||
|
def normalize(self, url: str) -> str:
|
||||||
|
return url.strip()
|
||||||
|
|
||||||
|
def download(self, url: str, pagedepth: int = 0, link_text: str = '') -> model.Page:
|
||||||
|
''' Downloads a page and handles crashes by restarting chrome once. '''
|
||||||
|
url = self.normalize(url)
|
||||||
|
try:
|
||||||
|
return self.__download(url, pagedepth, link_text)
|
||||||
|
except Exception as e:
|
||||||
|
self.__create_chrome()
|
||||||
|
try:
|
||||||
|
return self.__download(url, pagedepth, link_text)
|
||||||
|
except Exception as e:
|
||||||
|
print("Failed to download", url, "due to", e)
|
||||||
|
return model.Page(url = url, pagedepth = pagedepth, text = '', links = [], found_link_text_flag = False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,301 @@
|
|||||||
|
import typing
|
||||||
|
import json
|
||||||
|
import model
|
||||||
|
# from . import model
|
||||||
|
import browser
|
||||||
|
# import algorithm
|
||||||
|
|
||||||
|
def read_truth(file_path: str, browser: typing.Optional[browser.Browser] = None) -> typing.List[model.FacultyEntity]:
|
||||||
|
''' Reads the truth from a json file. '''
|
||||||
|
data = dict()
|
||||||
|
with open(file_path, 'r') as file:
|
||||||
|
data = json.load(file)
|
||||||
|
result = []
|
||||||
|
for f_data in data["faculties"]:
|
||||||
|
faculty = _parse_truth(model.FacultyEntity, f_data, browser)
|
||||||
|
if faculty is not None:
|
||||||
|
result.append(faculty)
|
||||||
|
for i_data in f_data["institutes"]:
|
||||||
|
institute = _parse_truth(model.InsituteEntity, i_data, browser)
|
||||||
|
if institute is not None:
|
||||||
|
faculty.institutes.append(institute)
|
||||||
|
for c_data in i_data["chairs"]:
|
||||||
|
chair = _parse_truth(model.ChairEntity, c_data, browser)
|
||||||
|
if chair is not None:
|
||||||
|
faculty.chairs.append(chair)
|
||||||
|
for c_data in f_data["chairs"]:
|
||||||
|
chair = _parse_truth(model.ChairEntity, c_data, browser)
|
||||||
|
if chair is not None:
|
||||||
|
faculty.chairs.append(chair)
|
||||||
|
faculty.institutes = _deduplicate(faculty.institutes)
|
||||||
|
faculty.chairs = _deduplicate(faculty.chairs)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def _parse_truth(cls: type, data: dict, browser: typing.Optional[browser.Browser]) -> typing.Optional[model.Entity]:
|
||||||
|
links = [ ]
|
||||||
|
if data['link_en'] != 'None':
|
||||||
|
links.append(data['link_en'])
|
||||||
|
# links.append(data['link_en'] + "/")
|
||||||
|
|
||||||
|
if 'link_en_2' in data:
|
||||||
|
if data['link_en_2'] != 'None' and data['link_en_2'] not in links:
|
||||||
|
links.append(data['link_en_2'])
|
||||||
|
# links.append(data['link_en_2'] + "/")
|
||||||
|
if 'link_en_3' in data:
|
||||||
|
if data['link_en_3'] != 'None' and data['link_en_3'] not in links:
|
||||||
|
links.append(data['link_en_3'])
|
||||||
|
# links.append(data['link_en_3'] + "/")
|
||||||
|
|
||||||
|
if data['link_de'] != 'None' and data['link_de'] not in links:
|
||||||
|
links.append(data['link_de'])
|
||||||
|
# links.append(data['link_de'] + "/")
|
||||||
|
|
||||||
|
if 'link_de_2' in data:
|
||||||
|
if data['link_de_2'] != 'None' and data['link_de_2'] not in links:
|
||||||
|
links.append(data['link_de_2'])
|
||||||
|
# links.append(data['link_de_2'] + "/")
|
||||||
|
if 'link_de_3' in data:
|
||||||
|
if data['link_de_3'] != 'None' and data['link_de_3'] not in links:
|
||||||
|
links.append(data['link_de_3'])
|
||||||
|
# links.append(data['link_de_3'] + "/")
|
||||||
|
|
||||||
|
if len(links) == 0:
|
||||||
|
return None
|
||||||
|
name = ""
|
||||||
|
if data["name_de"] != '':
|
||||||
|
name = data["name_de"]
|
||||||
|
elif data["name_en"] != '':
|
||||||
|
name = data["name_en"]
|
||||||
|
return cls.create(name=name, targets=_create_targets(links, browser))
|
||||||
|
|
||||||
|
|
||||||
|
def read_prediction(file_path: str, browser: typing.Optional[browser.Browser] = None) -> typing.List[model.FacultyEntity]:
|
||||||
|
''' Reads a json file with predictions. '''
|
||||||
|
aggregators = _read_aggregators(file_path)
|
||||||
|
faculties = _create_faculties(aggregators, browser)
|
||||||
|
aggregators_by_url = { aggregator.url: aggregator for aggregator in aggregators }
|
||||||
|
for aggregator in aggregators:
|
||||||
|
if aggregator.concept.type == model.ConceptType.FACULTY:
|
||||||
|
continue
|
||||||
|
faculty = None
|
||||||
|
current = aggregator
|
||||||
|
while True:
|
||||||
|
search = current.parent_link
|
||||||
|
faculty = _find_facultiy(search, faculties)
|
||||||
|
if current.parent == '' or faculty != None:
|
||||||
|
break
|
||||||
|
current = aggregators_by_url[current.parent]
|
||||||
|
if faculty == None:
|
||||||
|
# continue
|
||||||
|
raise Exception("Could not find faculty for " + aggregator.url + " with parent " + aggregator.parent + " and parent link " + aggregator.parent_link)
|
||||||
|
if aggregator.concept.type == model.ConceptType.CHAIR:
|
||||||
|
faculty.chairs.extend(_create_chairs(aggregator.children, browser))
|
||||||
|
elif aggregator.concept.type == model.ConceptType.INSTITUTE:
|
||||||
|
faculty.institutes.extend(_create_institutes(aggregator.children, browser))
|
||||||
|
for faculty in faculties:
|
||||||
|
faculty.chairs = _deduplicate(faculty.chairs)
|
||||||
|
faculty.institutes = _deduplicate(faculty.institutes)
|
||||||
|
return faculties
|
||||||
|
|
||||||
|
def _read_aggregators(file_path: str) -> typing.List[model.AggregatorPage]:
|
||||||
|
''' Reads a json file with aggregators. '''
|
||||||
|
lines = []
|
||||||
|
with open(file_path, "r") as f:
|
||||||
|
lines = f.readlines()
|
||||||
|
aggregators = []
|
||||||
|
for line in lines:
|
||||||
|
data = json.loads(line)
|
||||||
|
data['text'] = ''
|
||||||
|
aggregator = model.AggregatorPage.model_validate(data)
|
||||||
|
aggregators.append(aggregator)
|
||||||
|
return aggregators
|
||||||
|
|
||||||
|
def _deduplicate(entities: typing.List[model.Entity]) -> typing.List[model.Entity]:
|
||||||
|
''' Deduplicates a list of entities. '''
|
||||||
|
results = []
|
||||||
|
for entity in entities:
|
||||||
|
duplicate = False
|
||||||
|
for result in results:
|
||||||
|
if entity.equals(result):
|
||||||
|
duplicate = True
|
||||||
|
break
|
||||||
|
if not duplicate:
|
||||||
|
results.append(entity)
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
def _find_facultiy(url: str, faculties: typing.List[model.FacultyEntity]) -> typing.Optional[model.FacultyEntity]:
|
||||||
|
''' Finds a faculty with the specified url. '''
|
||||||
|
for faculty in faculties:
|
||||||
|
for target in faculty.targets:
|
||||||
|
if target.url == url:
|
||||||
|
return faculty
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _create_chairs(links: typing.List[model.Link], browser: typing.Optional[browser.Browser]) -> typing.List[model.ChairEntity]:
|
||||||
|
''' Creates chairs from a list of links. '''
|
||||||
|
chairs = []
|
||||||
|
for link in links:
|
||||||
|
chairs.append(model.ChairEntity.create(name=link.text, targets=_create_targets([link.url], browser, link.pagedepth, link.text)))
|
||||||
|
return chairs
|
||||||
|
|
||||||
|
def _create_institutes(links: typing.List[model.Link], browser: typing.Optional[browser.Browser]) -> typing.List[model.InsituteEntity]:
|
||||||
|
''' Creates institutes from a list of links. '''
|
||||||
|
institutes = []
|
||||||
|
for link in links:
|
||||||
|
institutes.append(model.InsituteEntity.create(name=link.text, targets=_create_targets([link.url], browser, link.pagedepth, link.text)))
|
||||||
|
return institutes
|
||||||
|
|
||||||
|
def _create_faculties(aggregators: typing.List[model.AggregatorPage], browser: typing.Optional[browser.Browser]) -> typing.List[model.FacultyEntity]:
|
||||||
|
''' Creates faculties from a list of aggregators. '''
|
||||||
|
faculty_links = []
|
||||||
|
for aggregator in aggregators:
|
||||||
|
if aggregator.concept.type == model.ConceptType.FACULTY:
|
||||||
|
aggregator_url = aggregator.url
|
||||||
|
if aggregator_url.endswith("/"):
|
||||||
|
aggregator_url[:-1]
|
||||||
|
for link in aggregator.children:
|
||||||
|
link_url = link.url
|
||||||
|
if link_url.endswith("/"):
|
||||||
|
link_url[:-1]
|
||||||
|
if aggregator_url == link_url:
|
||||||
|
continue
|
||||||
|
if not algorithm.contains_resource(faculty_links, link.url):
|
||||||
|
faculty_links.append(link)
|
||||||
|
faculties = []
|
||||||
|
for link in faculty_links:
|
||||||
|
faculties.append(model.FacultyEntity.create(name=link.text, targets=_create_targets([link.url], browser, link.pagedepth, link.text)))
|
||||||
|
return faculties
|
||||||
|
|
||||||
|
def _create_targets(urls: typing.List[str], browser: typing.Optional[browser.Browser], pagedepth: int = 0, link_text: str = '' ) -> typing.List[model.Target]:
|
||||||
|
''' Creates a target from a list of URLs. '''
|
||||||
|
contents = []
|
||||||
|
pagedepths = []
|
||||||
|
for url in urls:
|
||||||
|
if browser == None:
|
||||||
|
contents.append(url)
|
||||||
|
pagedepths.append(pagedepth)
|
||||||
|
else:
|
||||||
|
page = browser.download(url, pagedepth=pagedepth, link_text=link_text)
|
||||||
|
if page.text != '':
|
||||||
|
contents.append(page.text)
|
||||||
|
pagedepths.append(page.pagedepth)
|
||||||
|
else:
|
||||||
|
contents.append(url)
|
||||||
|
pagedepths.append(page.pagedepth)
|
||||||
|
return [ model.Target.create(url, content, pagedepth_inner) for url, content, pagedepth_inner in zip(urls, contents, pagedepths) ]
|
||||||
|
|
||||||
|
|
||||||
|
def print_faculties(faculties: typing.List[model.FacultyEntity]) -> None:
|
||||||
|
''' Prints a list of faculties. '''
|
||||||
|
for f in faculties:
|
||||||
|
print (f.name, f.targets[0].url)
|
||||||
|
for i in f.institutes:
|
||||||
|
print(" I ", i.name, i.targets[0].url)
|
||||||
|
for c in f.chairs:
|
||||||
|
print(" C ", c.name, c.targets[0].url)
|
||||||
|
|
||||||
|
def print_evaluation_flat(truth: typing.List[model.FacultyEntity], prediction: typing.List[model.FacultyEntity]):
|
||||||
|
''' Evaluates a prediction against the truth. '''
|
||||||
|
prediction_flat = _flatten(prediction)
|
||||||
|
truth_flat = _flatten(truth)
|
||||||
|
for key in prediction_flat.keys():
|
||||||
|
print("Evaluating", key)
|
||||||
|
print(" Predictions", len(prediction_flat[key]), "Truth", len(truth_flat[key]))
|
||||||
|
_print_evaluation(truth_flat[key], prediction_flat[key])
|
||||||
|
|
||||||
|
def print_evaluation_hierarchy(truth: typing.List[model.FacultyEntity], prediction: typing.List[model.FacultyEntity]):
|
||||||
|
''' Evaluates a prediction against the truth following the hierarchy. '''
|
||||||
|
mapping = { }
|
||||||
|
counts = { }
|
||||||
|
for p in range(len(prediction)):
|
||||||
|
counts[p] = 0
|
||||||
|
for t in range(len(truth)):
|
||||||
|
mapping[t] = []
|
||||||
|
for p in range(len(prediction)):
|
||||||
|
if truth[t].matches(prediction[p]):
|
||||||
|
counts[p] += 1
|
||||||
|
mapping[t].append(p)
|
||||||
|
for p, count in counts.items():
|
||||||
|
if count == 0:
|
||||||
|
raise Exception("Could not find matching faculty for ", prediction[p].name, prediction[p].targets[0].url, "in truth.")
|
||||||
|
if count > 1:
|
||||||
|
raise Exception("Found", count, "matches for faculty", prediction[p].name, prediction[p].targets[0].url, " in truth.")
|
||||||
|
for tx, px in mapping.items():
|
||||||
|
if len(px) != 1:
|
||||||
|
raise Exception("Found", len(px), "matches for faculty", truth[tx].name, truth[tx].targets[0].url, " in prediction.")
|
||||||
|
t = truth[tx]
|
||||||
|
p = prediction[px[0]]
|
||||||
|
print("Evaluating", t.name, p.name)
|
||||||
|
print(" Institutes")
|
||||||
|
_print_evaluation(t.institutes, p.institutes)
|
||||||
|
print(" Chairs")
|
||||||
|
_print_evaluation(t.chairs, p.chairs)
|
||||||
|
|
||||||
|
|
||||||
|
def _print_evaluation(ts: typing.List[model.Entity], ps: typing.List[model.Entity]):
|
||||||
|
''' Prints the evalution for a list of entities. '''
|
||||||
|
ps = _reset(ps)
|
||||||
|
ts = _reset(ts)
|
||||||
|
for p in ps:
|
||||||
|
found = False
|
||||||
|
for t in ts:
|
||||||
|
if p.matches(t):
|
||||||
|
found = True
|
||||||
|
t.found = True
|
||||||
|
p.found = not found
|
||||||
|
tp = [x for x in ts if x.found == True]
|
||||||
|
fp = [x for x in ps if x.found == True]
|
||||||
|
fn = [x for x in ts if x.found == False]
|
||||||
|
for f in fp:
|
||||||
|
print(" FP", f.name, f.targets[0].url)
|
||||||
|
# for f in fn:
|
||||||
|
# print(" FN", f.name, f.targets[0].url)
|
||||||
|
score = _score(len(tp), len(fp), len(fn))
|
||||||
|
print(" TP", len(tp), "FP", len(fp), "FN", len(fn))
|
||||||
|
print(" P", score[0], "R", score[1], "F1", score[2])
|
||||||
|
|
||||||
|
def _score(tp_val: int, fp_val: int, fn_val: int) -> typing.Tuple[float, float, float]:
|
||||||
|
precision = tp_val / (tp_val + fp_val) if (tp_val + fp_val) > 0 else 0
|
||||||
|
recall = tp_val / (tp_val + fn_val) if (tp_val + fn_val) > 0 else 0
|
||||||
|
f1_score = 2 * (precision * recall) / (precision + recall) if (precision + recall) > 0 else 0
|
||||||
|
return precision, recall, f1_score
|
||||||
|
|
||||||
|
def _reset(entities: typing.List[model.Entity]) -> typing.List[model.Entity]:
|
||||||
|
''' Resets the found flag of all entities. '''
|
||||||
|
for entity in entities:
|
||||||
|
entity.found = False
|
||||||
|
return entities
|
||||||
|
|
||||||
|
def _flatten(faculties: typing.List[model.FacultyEntity]) -> typing.Dict[model.ConceptType, typing.List[model.Entity]]:
|
||||||
|
''' Flattens a list of faculties. '''
|
||||||
|
result = { model.ConceptType.FACULTY: [], model.ConceptType.INSTITUTE: [], model.ConceptType.CHAIR: [] }
|
||||||
|
for faculty in faculties:
|
||||||
|
result[model.ConceptType.FACULTY].append(faculty)
|
||||||
|
for institute in faculty.institutes:
|
||||||
|
result[model.ConceptType.INSTITUTE].append(institute)
|
||||||
|
for chair in faculty.chairs:
|
||||||
|
result[model.ConceptType.CHAIR].append(chair)
|
||||||
|
for key in result.keys():
|
||||||
|
result[key] = _deduplicate(result[key])
|
||||||
|
return result
|
||||||
|
|
||||||
|
def filter_urls(faculties: typing.List[model.FacultyEntity], filter: typing.Callable[[str], bool]):
|
||||||
|
''' Filters the targets of faculties, chairs and institutes by url. '''
|
||||||
|
for faculty in faculties:
|
||||||
|
for target in [ t for t in faculty.targets]:
|
||||||
|
if filter(target.url):
|
||||||
|
faculty.targets.remove(target)
|
||||||
|
for institute in [t for t in faculty.institutes]:
|
||||||
|
for target in [ t for t in institute.targets]:
|
||||||
|
if filter(target.url):
|
||||||
|
institute.targets.remove(target)
|
||||||
|
if len(institute.targets) == 0:
|
||||||
|
faculty.institutes.remove(institute)
|
||||||
|
for chair in [t for t in faculty.chairs]:
|
||||||
|
for target in [ t for t in chair.targets]:
|
||||||
|
if filter(target.url):
|
||||||
|
chair.targets.remove(target)
|
||||||
|
if len(chair.targets) == 0:
|
||||||
|
faculty.chairs.remove(chair)
|
||||||
|
return faculties
|
||||||
@@ -0,0 +1,838 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"id": "a0651f51",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import evalutation2\n",
|
||||||
|
"import pickle"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"id": "a1dc4ee7",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"truth = evalutation2.read_truth(\"ude_truth.json\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"id": "dcc109bd",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"faculties = []\n",
|
||||||
|
"institutes = []\n",
|
||||||
|
"chairs = []\n",
|
||||||
|
"for f in truth:\n",
|
||||||
|
" for target in f.targets:\n",
|
||||||
|
" faculties.append(target.url)\n",
|
||||||
|
" for targets in f.institutes:\n",
|
||||||
|
" for institute in targets.targets:\n",
|
||||||
|
" institutes.append(institute.url)\n",
|
||||||
|
" for targets in f.chairs:\n",
|
||||||
|
" for chair in targets.targets:\n",
|
||||||
|
" chairs.append(chair.url) \n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"entities = institutes + chairs\n",
|
||||||
|
"with open(\"entities\", 'wb') as f:\n",
|
||||||
|
" pickle.dump(entities, f)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"id": "12de5855",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"with open(\"entities\", 'rb') as f:\n",
|
||||||
|
" my_list = pickle.load(f)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"id": "8408ecf6",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"['https://www.uni-due.de/cgcr/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/cgcr/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/anglistik',\n",
|
||||||
|
" 'https://www.uni-due.de/daz-daf/index-en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/daz-daf',\n",
|
||||||
|
" 'https://www.uni-due.de/humanities/geography/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/geographie',\n",
|
||||||
|
" 'https://www.uni-due.de/humanities/german_studies',\n",
|
||||||
|
" 'https://www.uni-due.de/germanistik',\n",
|
||||||
|
" 'https://www.uni-due.de/humanities/history/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/geschichte',\n",
|
||||||
|
" 'https://www.uni-due.de/geschichte/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/kowi/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/kowi',\n",
|
||||||
|
" 'https://www.uni-due.de/kowi/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/kunst-kuwiss/kuk_home.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/germanistik/niederlandistik',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie',\n",
|
||||||
|
" 'https://www.uni-due.de/humanities/romance_studies',\n",
|
||||||
|
" 'https://www.uni-due.de/romanistik',\n",
|
||||||
|
" 'https://www.uni-due.de/humanities/special_needs_education',\n",
|
||||||
|
" 'https://www.uni-due.de/sonderpaedagogik',\n",
|
||||||
|
" 'https://www.uni-due.de/humanities/protestant_theology/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/EvangelischeTheologie',\n",
|
||||||
|
" 'https://www.uni-due.de/humanities/catholic_theology/index.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/katheol',\n",
|
||||||
|
" 'https://www.uni-due.de/turkistik/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/turkistik',\n",
|
||||||
|
" 'https://www.uni-due.de/inkur/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/inkur',\n",
|
||||||
|
" 'https://www.uni-due.de/isu/isu_englisch.php',\n",
|
||||||
|
" 'https://www.uni-due.de/isu',\n",
|
||||||
|
" 'https://www.uni-due.de/cgcr/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/cgcr/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/politik/institute.php',\n",
|
||||||
|
" 'https://www.uni-due.de/politik',\n",
|
||||||
|
" 'https://www.uni-due.de/soziologie/department.php',\n",
|
||||||
|
" 'https://www.uni-due.de/soziologie',\n",
|
||||||
|
" 'https://www.uni-due.de/soziooekonomie/home_en',\n",
|
||||||
|
" 'https://www.uni-due.de/soziooekonomie/institut_en',\n",
|
||||||
|
" 'https://www.uni-due.de/soziooekonomie',\n",
|
||||||
|
" 'https://www.uni-due.de/inef/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/inef',\n",
|
||||||
|
" 'https://www.uni-due.de/iaq/en_index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/iaq',\n",
|
||||||
|
" 'https://www.uni-due.de/ibw',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/erziehungswissenschaft',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/erziehungswissenschaft.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/psychologie',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/isp',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/isp/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/sport-und-bewegungswissenschaften',\n",
|
||||||
|
" 'https://cinch.uni-due.de/de',\n",
|
||||||
|
" 'https://cinch.uni-due.de',\n",
|
||||||
|
" 'https://www.elfe.uni-due.de/en/news',\n",
|
||||||
|
" 'https://www.elfe.uni-due.de/',\n",
|
||||||
|
" 'https://www.hemf.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.hemf.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.maarc.msm.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/ruhrpad/ruhr.pad',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/iem_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/mathematik_iem.php',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/didmath',\n",
|
||||||
|
" 'https://www.uni-due.de/activesites',\n",
|
||||||
|
" 'https://www.uni-due.de/cenide/en',\n",
|
||||||
|
" 'https://www.uni-due.de/cenide/de',\n",
|
||||||
|
" 'https://www.uni-due.de/cenide/netz/en',\n",
|
||||||
|
" 'https://www.uni-due.de/cenide/netz',\n",
|
||||||
|
" 'https://www.uni-due.de/izfb/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/izfb',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb',\n",
|
||||||
|
" 'https://www.uni-due.de/zwu/start.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zwu',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb',\n",
|
||||||
|
" 'https://www.uni-due.de/zwu/start.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zwu',\n",
|
||||||
|
" 'https://www.uni-due.de/izfb/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/izfb',\n",
|
||||||
|
" 'https://www.uni-due.de/ipe/index_en.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/ipe',\n",
|
||||||
|
" 'https://www.uni-due.de/ipe/index.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/cenide/en',\n",
|
||||||
|
" 'https://www.uni-due.de/cenide/de',\n",
|
||||||
|
" 'https://www.uni-due.de/inam/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/inam',\n",
|
||||||
|
" 'https://www.uni-due.de/inam/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/cenide/netz/en',\n",
|
||||||
|
" 'https://www.uni-due.de/cenide/netz',\n",
|
||||||
|
" 'https://www.uni-due.de/zwu/start.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zwu',\n",
|
||||||
|
" 'https://www.uni-due.de/zlv/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zlv',\n",
|
||||||
|
" 'https://www.uni-due.de/cerude/index_neu_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/cerude',\n",
|
||||||
|
" 'https://www.uni-due.de/css',\n",
|
||||||
|
" 'https://www.uni-due.de/cenide/ican/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/cenide/ican',\n",
|
||||||
|
" 'https://www.uni-due.de/for-sex/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/for-sex/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/igsm/home-en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/igsm',\n",
|
||||||
|
" 'https://www.uni-due.de/igsm/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/med/pharmakogenetik/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/med/pharmakogenetik',\n",
|
||||||
|
" 'https://paluno.uni-due.de/en',\n",
|
||||||
|
" 'https://paluno.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/anglistik/applied_linguistics_didactics/index',\n",
|
||||||
|
" 'https://www.uni-due.de/anglistik/linguistics',\n",
|
||||||
|
" 'https://www.uni-due.de/amerikanistik',\n",
|
||||||
|
" 'https://www.uni-due.de/balc',\n",
|
||||||
|
" 'https://www.uni-due.de/anglistik/english_literary_and_cultural_studies',\n",
|
||||||
|
" 'https://www.uni-due.de/anglistik/postcolonial_studies',\n",
|
||||||
|
" 'https://www.uni-due.de/wigeo/eng_index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/wigeo',\n",
|
||||||
|
" 'https://www.uni-due.de/geographie/sachunterricht/gryl.php',\n",
|
||||||
|
" 'https://www.uni-due.de/germanistik/niederlandistik',\n",
|
||||||
|
" 'https://www.uni-due.de/germanistik/mediaevistik.php',\n",
|
||||||
|
" 'https://www.uni-due.de/germanistik/literaturwissenschaft_literaturdidaktik.php',\n",
|
||||||
|
" 'https://www.uni-due.de/germanistik/pontzen',\n",
|
||||||
|
" 'https://www.uni-due.de/germanistik/morek',\n",
|
||||||
|
" 'https://www.uni-due.de/germanistik/linguistik_sprachdidaktik.php',\n",
|
||||||
|
" 'https://www.uni-due.de/geschichte/abt_didaktik',\n",
|
||||||
|
" 'https://www.uni-due.de/geschichte/abt_alte_geschichte.php',\n",
|
||||||
|
" 'https://www.uni-due.de/geschichte/abt_fruehe_neuzeit.php',\n",
|
||||||
|
" 'https://www.uni-due.de/geschichte/abt_mittelalter.php',\n",
|
||||||
|
" 'https://www.uni-due.de/geschichte/abteilung_kulturgeschichte_des_oekonomischen.php',\n",
|
||||||
|
" 'https://www.uni-due.de/geschichte/abteilung_steinheim_institut.php',\n",
|
||||||
|
" 'https://www.uni-due.de/geschichte/abt_spaetmittelalter',\n",
|
||||||
|
" 'https://www.uni-due.de/kowi/instikom/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/kowi/theorkom/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/kowi/mukom/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/kowi/mukom/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie/anthropology',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie/anthropologie',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie/politischephilosophie',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie/theoretischephilosophie_vanriel',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie/achim_lohmar.php',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie/bernd_graefrath.php',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie/praktischephilosophie_hallich/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie/dirk_hartmann.php',\n",
|
||||||
|
" 'https://www.uni-due.de/philosophie/ingensiep',\n",
|
||||||
|
" 'https://www.uni-due.de/sonderpaedagogik/ese/index',\n",
|
||||||
|
" 'https://www.uni-due.de/sonderpaedagogik/sprache/index',\n",
|
||||||
|
" 'https://www.uni-due.de/EvangelischeTheologie/aaron_schart.php',\n",
|
||||||
|
" 'https://www.uni-due.de/EvangelischeTheologie/marcel_nieden.php',\n",
|
||||||
|
" 'https://www.uni-due.de/EvangelischeTheologie/st-start.php',\n",
|
||||||
|
" 'https://www.uni-due.de/EvangelischeTheologie/rp-start.php',\n",
|
||||||
|
" 'https://www.uni-due.de/katheol/scherer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/katheol/systheol',\n",
|
||||||
|
" 'https://www.uni-due.de/politik/berendt.php',\n",
|
||||||
|
" 'https://www.uni-due.de/politik/debiel.php',\n",
|
||||||
|
" 'https://www.uni-due.de/in-east/politik_und_gesellschaft_chinas/home.en',\n",
|
||||||
|
" 'https://www.uni-due.de/in-east/politik_und_gesellschaft_chinas',\n",
|
||||||
|
" 'https://www.uni-due.de/politik/martinsen_f.php',\n",
|
||||||
|
" 'https://www.uni-due.de/soziologie/suug.php',\n",
|
||||||
|
" 'https://www.uni-due.de/soziologie/baykara.php',\n",
|
||||||
|
" 'https://www.uni-due.de/soziologie/klammer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/soziologie/ABO.php',\n",
|
||||||
|
" 'https://www.uni-due.de/soziologie/arbeitsgruppe_quack.php',\n",
|
||||||
|
" 'https://www.uni-due.de/soziologie/schnell.php',\n",
|
||||||
|
" 'https://www.uni-due.de/soziologie/steinbach.php',\n",
|
||||||
|
" 'https://www.uni-due.de/iaq/aim.php',\n",
|
||||||
|
" 'https://www.uni-due.de/iaq/azao.php',\n",
|
||||||
|
" 'https://www.uni-due.de/iaq/best.php',\n",
|
||||||
|
" 'https://www.uni-due.de/iaq/prera.php',\n",
|
||||||
|
" 'https://www.uni-due.de/ibw/erziehungswissenschaft_genderperspektive',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/vet',\n",
|
||||||
|
" 'https://www.uni-due.de/berupaed/en',\n",
|
||||||
|
" 'https://www.uni-due.de/berupaed',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/eb/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/politische-bildung',\n",
|
||||||
|
" 'https://learninglab.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/informatik/ecg',\n",
|
||||||
|
" 'https://www.uni-due.de/bw-pp',\n",
|
||||||
|
" 'https://www.uni-due.de/colaps',\n",
|
||||||
|
" 'https://www.uni-due.de/allgemeine-didaktik',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/allgemeine-paedagogik',\n",
|
||||||
|
" 'https://www.uni-due.de/bifo/en',\n",
|
||||||
|
" 'https://www.uni-due.de/bifo',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/inklusive_paedagogik/index',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/jugend-und-schulforschung',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/kindheitsforschung/en_index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/kindheitsforschung',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/kindheitsforschung/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/boeger',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/migrations-ungleichheitsforschung',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/paedagogik/professionsforschung',\n",
|
||||||
|
" 'https://www.uni-due.de/schule_und_jugendhilfe',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/schulforschung/mammes.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/schulforschung',\n",
|
||||||
|
" 'https://www.uni-due.de/edu-research/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/edu-research/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/koenig/start_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/koenig/start.php',\n",
|
||||||
|
" 'https://www.uni-due.de/unterrichtsentwicklung/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/ufo',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/steins',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/sprachekognition',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/aopsy/en//index',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/aopsy/de/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/sb/start.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/sb/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/diff',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/interkulturelle_psychologie/index_engl.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/interkulturelle_psychologie/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/psychologie/klinischepsychologie/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/llp/en/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/llp/de/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/lls',\n",
|
||||||
|
" 'https://www.uni-due.de/hpg/klinische_intervention.php',\n",
|
||||||
|
" 'https://www.uni-due.de/dia',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/hofaecker/start',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/sozialpolitik/engl_vers',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/sozialpolitik',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/wehrheim/wehrheim.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/isp/sozialpaedagogik/thieme.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/isp/tum/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/biwi/isp/tum',\n",
|
||||||
|
" 'https://www.uni-due.de/sport-und-bewegungswissenschaften/bewegung-und-training-englisch.php',\n",
|
||||||
|
" 'https://www.uni-due.de/sport-und-bewegungswissenschaften/bewegung-und-training.php',\n",
|
||||||
|
" 'https://www.uni-due.de/sport-und-bewegungswissenschaften/dlls.php',\n",
|
||||||
|
" 'https://www.uni-due.de/sport-und-bewegungswissenschaften/sozialwissenschaften_des_sports.php',\n",
|
||||||
|
" 'https://www.uni-due.de/sport-und-bewegungswissenschaften/sportpaedagogik_sportdidaktik.php',\n",
|
||||||
|
" 'https://www.mm.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.wipo.wiwi.uni-due.de/en/profile',\n",
|
||||||
|
" 'https://www.wipo.wiwi.uni-due.de/profil',\n",
|
||||||
|
" 'https://www.wpar.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.exp.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.oek.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.oek.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.goek.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.goek.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.iwb.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.iwb.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.makro.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.mikro.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.mikro.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.pubecon.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.pubecon.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.stat.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.stat.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://amg.wiwi.uni-due.de/en/home',\n",
|
||||||
|
" 'https://amg.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.labor.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.labor.wiwi.uni-due.de/team/sebastian-otten',\n",
|
||||||
|
" 'https://www.labor.wiwi.uni-due.de/team/julia-bredtmann',\n",
|
||||||
|
" 'https://futureofwork.wiwi.uni-due.de/',\n",
|
||||||
|
" 'https://www.wida.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.wida.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.lef.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.lef.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.ewl.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.ewl.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.fin.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.fin.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.irl.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.marketing.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.pim.wiwi.uni-due.de/profil',\n",
|
||||||
|
" 'https://www.steuern.wiwi.uni-due.de/en/1',\n",
|
||||||
|
" 'https://www.steuern.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.uee.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.uee.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.abwl.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.abwl.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.bafi.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.bafi.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.bwsl.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.dmh.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.dmh.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.finance.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.finance.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.ircg.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.ircg.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.log.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.log.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.marketing.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.marketing.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.puu.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.puu.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.pl.msm.uni-due.de/en',\n",
|
||||||
|
" 'https://www.pl.msm.uni-due.de',\n",
|
||||||
|
" 'https://www.scm.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.scm.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.rwpc.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.rwpc.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.so.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.so.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.mc.msm.uni-due.de/en',\n",
|
||||||
|
" 'https://www.mc.msm.uni-due.de/',\n",
|
||||||
|
" 'https://www.insurance.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.mikro.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.mikro.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.makro.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.makro.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.qmw.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.qmw.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.vwl.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.vwl.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.neg.msm.uni-due.de/en/profile',\n",
|
||||||
|
" 'https://www.neg.msm.uni-due.de/profil',\n",
|
||||||
|
" 'https://www.wipaed.msm.uni-due.de/en/startseite',\n",
|
||||||
|
" 'https://www.wipaed.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.china.msm.uni-due.de/en/chair-for-east-asian-economic-studies-china',\n",
|
||||||
|
" 'https://www.china.msm.uni-due.de/chair-for-east-asian-economic-studies-china',\n",
|
||||||
|
" 'https://tdr.informatik.uni-due.de/en',\n",
|
||||||
|
" 'https://tdr.informatik.uni-due.de',\n",
|
||||||
|
" 'https://se.informatik.uni-due.de',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de/ag/ludwig',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de/ag/hein',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de/ag/heinloth',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de/ag/levine',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de/ag/greb',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de/ag/bertolini',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de/ag/kohlhaase',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de/ag/paskunas',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de/ag/goertz',\n",
|
||||||
|
" 'https://www.esaga.uni-due.de/ag/sprang',\n",
|
||||||
|
" 'https://www.uni-due.de/didmath/ag_barzel',\n",
|
||||||
|
" 'https://www.uni-due.de/didmath/mitarbeiter_buechter',\n",
|
||||||
|
" 'https://www.uni-due.de/didmath/ag_schacht',\n",
|
||||||
|
" 'https://www.uni-due.de/didmath/ag_scherer',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/ag_wittbold/ag_wittbold_english',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/ag_wittbold',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/aggastel',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/ag_neff/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/ag_neff',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agdierkes',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agdierkes/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agtoerner',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agweiss',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/ag_scheven.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agpozzi/pozzi',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agkraus',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agkraus/index.html',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agstarke',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agyousept/yousept.php',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agroesch',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agschultz/arbeitsgruppe_engl.php',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agschultz',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/ag_belomestny/urusov',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/ag_stochastische_analysis',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/ag_winter',\n",
|
||||||
|
" 'https://www.uni-due.de/agbovensiepen',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-campen/index.en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-campen',\n",
|
||||||
|
" 'https://www.uni-due.de/agfarle/index_enu.php',\n",
|
||||||
|
" 'https://www.uni-due.de/agfarle',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/gruber',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-hvh/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-hvh',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-hvh/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/aglorke',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-mittendorff/home_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-mittendorff',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-nienhaus',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/schleberger/info_english',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/schleberger',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-schmid',\n",
|
||||||
|
" 'https://www.uni-due.de/agschneider/index-en.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/agschneider',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/wende/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/wende',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/agw/home.php',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/agw/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/twist',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/ag_guhr/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/ag_guhr',\n",
|
||||||
|
" 'https://www.uni-due.de/tqp/index_en.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/tqp',\n",
|
||||||
|
" 'https://www.uni-due.de/thp/index_en.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/thp',\n",
|
||||||
|
" 'https://www.uni-due.de/ptt',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/kratzer/index_eng.php',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/kratzer',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/agk/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/agk',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/pentcheva/highlights_en',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/pentcheva',\n",
|
||||||
|
" 'https://www.uni-due.de/comphys/index_en.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/comphys',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/parteli',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/pentcheva',\n",
|
||||||
|
" 'https://www.uni-due.de/didaktik_der_physik/haertig-eng.php',\n",
|
||||||
|
" 'https://www.uni-due.de/didaktik_der_physik/haertig.php',\n",
|
||||||
|
" 'https://www.uni-due.de/didaktik_der_physik/ForschungTheyssen.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/tech3chem',\n",
|
||||||
|
" 'https://www.uni-due.de/barcikowski-group',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-campen/index.en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/agbovensiepen',\n",
|
||||||
|
" 'https://www.uni-due.de/ag-campen',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/akdomke',\n",
|
||||||
|
" 'https://www.uni-due.de/schluecker-lab/profil.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/akgiese',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/ak_gutmann',\n",
|
||||||
|
" 'https://www.uni-due.de/akhaberhauer',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/chemical-biology',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/molecular-biology-knauer/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/schluecker-lab',\n",
|
||||||
|
" 'https://www.uni-due.de/iac',\n",
|
||||||
|
" 'https://www.uni-due.de/aac',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/ak_schrader/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/ak_schrader/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/rf/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/rf',\n",
|
||||||
|
" 'https://www.uni-due.de/ak_schulz/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/cfd/en/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/cfd',\n",
|
||||||
|
" 'https://www.uni-due.de/nst/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/nst',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/cfd/tomo',\n",
|
||||||
|
" 'https://www.uni-due.de/wet/index_en.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/wet/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/wet',\n",
|
||||||
|
" 'https://www.uni-due.de/reichenberger-group',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/aqm/en',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/aqm',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/pst',\n",
|
||||||
|
" 'https://www.uni-due.de/tech2chem',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/wende/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/wende',\n",
|
||||||
|
" 'https://www.uni-due.de/akniemeyer/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/voskuhl',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/ak_disch/ak_disch.php',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/ak_exner',\n",
|
||||||
|
" 'https://www.uni-due.de/umb/enzym_home.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/umb',\n",
|
||||||
|
" 'https://www.uni-due.de/tech3chem/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/chemiedidaktik',\n",
|
||||||
|
" 'https://www.uni-due.de/chemiedidaktik/09_forschung_agrumann.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/chemiedidaktik/09_forschung_agsumfleth.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/chemiedidaktik/agwalpuski_en.',\n",
|
||||||
|
" 'https://www.uni-due.de/chemiedidaktik/agwalpuski',\n",
|
||||||
|
" 'https://www.uni-due.de/probst-lab',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/galstyan-lab/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/galstyan-lab',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/ak_epple/en/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/ak_epple',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/ak_jansen',\n",
|
||||||
|
" 'https://www.uni-due.de/chemie/ag_mayer',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/bioinformatics-computational-biophysics',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/bionanotechnology/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/chemical-biology',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/andrea-vortkamp.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/barbara-gruener.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/dirk-matthias-hermann.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/farnusch-kaschani.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/silvia-vega-rubin-de-celis.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/mechanistic-cell-biology/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/andrea-musacchio.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/microbiology',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/molecular-biology-meyer',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/molecular-biology-knauer/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/molecular-genetics-westermann/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/molecular-genetics-boos/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/molecular-cell-biology',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/molecular-cell-biology/index.html',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/molecular-cell-meyer',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/molecular-cell-meyer/index.html',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/structural-medicinal-biochemistry/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/strukturelle-medizinische-biochemie/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/daniel-hoffmann.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/barbara-sacca.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/jens-voskuhl.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/jens-siveke.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/basant-kumar-thakur.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/ulrike-hendgen-cotta.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/markus-kaiser.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/tienush-rassaf.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/dirk-schadendorf.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/dagmar-fuehrer-sakel.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/christian-reinhardt.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/adalbert-krawczyk-zmb.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/christoph-kleinschnitz.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/ken-herrmann-2.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/martin-schuler.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/erich-gulbins.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/developmental-biology/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/manuela-wuelling-zmb.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/alexander-probst.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/elke-cario.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/ivo-bendix.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/josephine-herz.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/farnoush-farahpour.php',\n",
|
||||||
|
" 'https://www.uni-due.de/farahpourlab/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/bernd-giebel-2.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/thomas-schrader.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/nina-schulze-zmb.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/elisabeth-littwitz-salomon.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/stefanie-flohe.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/astrid-westendorf.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/matthias-epple.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/katharina-fleischhauer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/peter-horn.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/gunther-wennemuth.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/ralf-kueppers.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/matthias-gunzer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/karl-sebastian-lang.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/jan-buer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/winfried-siffert.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/hans-werner-ingensiep.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/joachim-fandrey.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/katja-ferenz.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/ulf-dittmer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/virologie/ag_sutter.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/anke-hinney.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/doris-hellerschmied-jelinek.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/johann-matschke.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/hemmo-meyer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/shirley-knauer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/sebastian-schluecker.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/verena-jendrossek.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/perihan-nalbant.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/bettina-siebers.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/christian-johannes.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/stefan-westermann.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/dominik-boos.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/wiebke-hansen.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/alexander-schramm.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/heike-heuer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/annette-paschen-zmb.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/nicole-duenker.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/dietmar-lohmann.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/sven-brandau.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/jadwiga-jablonska-koch.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/anzhela-galstyan.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/katharina-lueckerath.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/george-iliakis.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/carsten-kirschning.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/peter-bayer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/stefan-raunser.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/robert-huber.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/jochen-niemeyer.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/stephan-barcikowski.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/kai-exner.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/samuel-pena-llopis.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/bjoern-scheffler.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/claere-von-neubeck-zmb.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/sebastian-bauer-zmb.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/juergen-becker.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/alexander-roesch.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/barbara-gruenwald.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/alpaslan-tasdogan.php',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/members/diana-klein-zmb.php',\n",
|
||||||
|
" 'https://www.uni-due.de/aquatic_ecology',\n",
|
||||||
|
" 'https://www.uni-due.de/aquatische_oekologie',\n",
|
||||||
|
" 'https://www.uni-due.de/zmb/molecular-cell-biology',\n",
|
||||||
|
" 'https://www.uni-due.de/leeselab/leeselab',\n",
|
||||||
|
" 'https://www.uni-due.de/aquatische_oekosystemforschung',\n",
|
||||||
|
" 'https://www.uni-due.de/biodiversitaet',\n",
|
||||||
|
" 'https://www.uni-due.de/biologiedidaktik',\n",
|
||||||
|
" 'https://www.uni-due.de/berll/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/berll',\n",
|
||||||
|
" 'https://www.uni-due.de/biologie/eukaryotische-mikrobiologie/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/fluss_und_auenoekologie/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/interdisziplinaerer_umweltschutz/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biologie/oekotoxikologie/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/phycology',\n",
|
||||||
|
" 'https://www.uni-due.de/phykologie',\n",
|
||||||
|
" 'https://www.uni-due.de/biologie/fakultaet/seniorprofessur.php',\n",
|
||||||
|
" 'https://www.uni-due.de/biologie/angewandte_bodenkunde',\n",
|
||||||
|
" 'https://www.uni-due.de/klimatologie',\n",
|
||||||
|
" 'https://www.uni-due.de/zoologie',\n",
|
||||||
|
" 'https://www.uni-due.de/fertigungstechnik',\n",
|
||||||
|
" 'https://www.uni-due.de/kkm/index-en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/kkm',\n",
|
||||||
|
" 'https://www.uni-due.de/pep',\n",
|
||||||
|
" 'https://www.uni-due.de/tul/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/tul',\n",
|
||||||
|
" 'https://www.uni-due.de/tul/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/vip',\n",
|
||||||
|
" 'https://www.uni-due.de/tech3chem',\n",
|
||||||
|
" 'https://www.uni-due.de/barcikowski-group',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/rf/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/rf',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/cfd/en/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/cfd',\n",
|
||||||
|
" 'https://www.uni-due.de/nst/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/nst',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/cfd/tomo',\n",
|
||||||
|
" 'https://www.uni-due.de/wet/index_en.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/wet',\n",
|
||||||
|
" 'https://www.uni-due.de/reichenberger-group',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/aqm/schierning-cv-en',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/aqm/schierning-cv',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/pst',\n",
|
||||||
|
" 'https://www.uni-due.de/tech2chem',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/wende/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/physik/wende',\n",
|
||||||
|
" 'https://sitm.ris.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/ISMT/index_en.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/IST',\n",
|
||||||
|
" 'https://www.uni-due.de/innovation/english',\n",
|
||||||
|
" 'https://www.uni-due.de/innovation',\n",
|
||||||
|
" 'https://www.so.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.so.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.uni-due.de/ets/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/ets',\n",
|
||||||
|
" 'https://www.uni-due.de/wigeo/juchelka.php',\n",
|
||||||
|
" 'https://www.uni-due.de/wigeo',\n",
|
||||||
|
" 'https://www.uni-due.de/bautechnik',\n",
|
||||||
|
" 'https://www.log.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.log.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.uni-due.de/baubetrieb',\n",
|
||||||
|
" 'https://www.scm.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.scm.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.nes.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/tul/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/tul',\n",
|
||||||
|
" 'https://www.uni-due.de/iam',\n",
|
||||||
|
" 'https://www.dmh.msm.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.dmh.msm.uni-due.de/startseite',\n",
|
||||||
|
" 'https://www.uni-due.de/mechatronik/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/mechatronik',\n",
|
||||||
|
" 'https://www.uni-due.de/ptt',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agschultz/arbeitsgruppe_engl.php',\n",
|
||||||
|
" 'https://www.uni-due.de/mathematik/agschultz/index.php',\n",
|
||||||
|
" 'https://www.ewl.wiwi.uni-due.de/en',\n",
|
||||||
|
" 'https://www.ewl.wiwi.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/imobis',\n",
|
||||||
|
" 'https://www.pim.wiwi.uni-due.de/profil',\n",
|
||||||
|
" 'https://www.uni-due.de/controlling',\n",
|
||||||
|
" 'https://www.uni-due.de/pom/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/pom',\n",
|
||||||
|
" 'https://www.uni-due.de/ate/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/ate',\n",
|
||||||
|
" 'https://www.uni-due.de/aks/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/aks',\n",
|
||||||
|
" 'https://www.uni-due.de/bhe/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/bhe',\n",
|
||||||
|
" 'https://www.dsv.uni-due.de/en/home',\n",
|
||||||
|
" 'https://www.dsv.uni-due.de/de/startseite',\n",
|
||||||
|
" 'https://www.uni-due.de/ees/index.en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/ees',\n",
|
||||||
|
" 'https://www.uni-due.de/ebs',\n",
|
||||||
|
" 'https://www.uni-due.de/en/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/energietechnik',\n",
|
||||||
|
" 'https://www.uni-due.de/ets/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/ets/index',\n",
|
||||||
|
" 'https://www.uni-due.de/lee',\n",
|
||||||
|
" 'https://www.uni-due.de/geotechnik',\n",
|
||||||
|
" 'https://www.uni-due.de/ingmath',\n",
|
||||||
|
" 'https://www.uni-due.de/massivbau',\n",
|
||||||
|
" 'https://www.uni-due.de/materials/index_eng.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/materials',\n",
|
||||||
|
" 'https://www.uni-due.de/mfi/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/mfi',\n",
|
||||||
|
" 'https://www.uni-due.de/mechanika/index_englisch.php',\n",
|
||||||
|
" 'https://www.uni-due.de/mechanika',\n",
|
||||||
|
" 'https://www.uni-due.de/mechanika/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/mechanikb',\n",
|
||||||
|
" 'https://www.uni-due.de/Wassertechnik/Home_englisch.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/Wassertechnik',\n",
|
||||||
|
" 'https://www.uni-due.de/iml',\n",
|
||||||
|
" 'https://www.uni-due.de/muu',\n",
|
||||||
|
" 'https://www.uni-due.de/nts',\n",
|
||||||
|
" 'https://www.uni-due.de/oe',\n",
|
||||||
|
" 'https://www.uni-due.de/oe/de',\n",
|
||||||
|
" 'https://www.uni-due.de/abfall/essen/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/abfall/essen',\n",
|
||||||
|
" 'https://www.uni-due.de/statik/en',\n",
|
||||||
|
" 'https://www.uni-due.de/statik/de',\n",
|
||||||
|
" 'https://www.uni-due.de/srs/index_en.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/srs',\n",
|
||||||
|
" 'https://www.uni-due.de/tm',\n",
|
||||||
|
" 'https://www.uni-due.de/smt/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/smt',\n",
|
||||||
|
" 'https://www.uni-due.de/tud',\n",
|
||||||
|
" 'https://www.uni-due.de/verfahrenstechnik/profile.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/verfahrenstechnik',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/td/en',\n",
|
||||||
|
" 'https://www.uni-due.de/empi/td',\n",
|
||||||
|
" 'https://www.uni-due.de/tul/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/tul/index.php',\n",
|
||||||
|
" 'https://www.uni-due.de/wasserbau/homepage.php',\n",
|
||||||
|
" 'https://www.uni-due.de/wasserbau',\n",
|
||||||
|
" 'https://www.uni-due.de/werkstofftechnik/index_en.shtml',\n",
|
||||||
|
" 'https://www.uni-due.de/werkstofftechnik',\n",
|
||||||
|
" 'https://www.uni-due.de/bauwissenschaften/de',\n",
|
||||||
|
" 'https://syssec.informatik.uni-due.de/en',\n",
|
||||||
|
" 'https://syssec.informatik.uni-due.de',\n",
|
||||||
|
" 'https://softec.ris.uni-due.de/en',\n",
|
||||||
|
" 'https://softec.ris.uni-due.de',\n",
|
||||||
|
" 'https://s3.paluno.uni-due.de',\n",
|
||||||
|
" 'https://se.informatik.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/swe/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/swe',\n",
|
||||||
|
" 'https://www.nes.uni-due.de',\n",
|
||||||
|
" 'https://sse.uni-due.de/en',\n",
|
||||||
|
" 'https://sse.uni-due.de',\n",
|
||||||
|
" 'https://ncs.informatik.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/es/en/en_home.php',\n",
|
||||||
|
" 'https://www.uni-due.de/es',\n",
|
||||||
|
" 'https://hci.informatik.uni-due.de/en',\n",
|
||||||
|
" 'https://hci.informatik.uni-due.de',\n",
|
||||||
|
" 'https://www.vs.uni-due.de/en',\n",
|
||||||
|
" 'https://www.vs.uni-due.de',\n",
|
||||||
|
" 'https://ai.ris.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/datascience',\n",
|
||||||
|
" 'https://ddi.informatik.uni-due.de/en',\n",
|
||||||
|
" 'https://ddi.informatik.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/fmi/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/fmi',\n",
|
||||||
|
" 'https://tdr.informatik.uni-due.de/en',\n",
|
||||||
|
" 'https://tdr.informatik.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/theoinf/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/theoinf',\n",
|
||||||
|
" 'https://www.vs.uni-due.de',\n",
|
||||||
|
" 'https://www.uni-due.de/kognitionspsychologie/index_eng',\n",
|
||||||
|
" 'https://www.uni-due.de/kognitionspsychologie',\n",
|
||||||
|
" 'https://www.uni-due.de/interaktivesysteme/home_en',\n",
|
||||||
|
" 'https://www.uni-due.de/interaktivesysteme',\n",
|
||||||
|
" 'https://www.uni-due.de/psychologische-forschungsmethoden/index_eng.php',\n",
|
||||||
|
" 'https://www.uni-due.de/psychologische-forschungsmethoden',\n",
|
||||||
|
" 'https://www.uni-due.de/media-psych-edu/index_en.php',\n",
|
||||||
|
" 'https://www.uni-due.de/media-psych-edu',\n",
|
||||||
|
" 'https://www.uni-due.de/soco',\n",
|
||||||
|
" 'https://www.uni-due.de/sozialpsychologie',\n",
|
||||||
|
" 'https://www.uni-due.de/wirtschaftspsychologie/home_e.php',\n",
|
||||||
|
" 'https://www.uni-due.de/wirtschaftspsychologie',\n",
|
||||||
|
" 'https://www.uni-due.de/is/index_en',\n",
|
||||||
|
" 'https://www.uni-due.de/is',\n",
|
||||||
|
" 'https://sse.uni-due.de/en/about-us/team/dr-dominik-helm',\n",
|
||||||
|
" 'https://sse.uni-due.de/ueber-uns/team/dr-dominik-helm',\n",
|
||||||
|
" 'https://app.ris.uni-due.de/en',\n",
|
||||||
|
" 'https://app.ris.uni-due.de',\n",
|
||||||
|
" 'https://iis.ris.uni-due.de/en',\n",
|
||||||
|
" 'https://iis.ris.uni-due.de',\n",
|
||||||
|
" 'https://sitm.ris.uni-due.de',\n",
|
||||||
|
" 'https://sust.ris.uni-due.de',\n",
|
||||||
|
" 'https://tm.ris.uni-due.de',\n",
|
||||||
|
" 'https://umo.ris.uni-due.de/en',\n",
|
||||||
|
" 'https://umo.ris.uni-due.de']"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 7,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"my_list"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "airflow",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
#
|
||||||
|
# This file contains the classes that represent our basic data model,
|
||||||
|
# we use pydantic to define the data model so we can easily cache it
|
||||||
|
# in a simple sqlite database.
|
||||||
|
#
|
||||||
|
import enum
|
||||||
|
import typing
|
||||||
|
import pydantic
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
class Language(enum.Enum):
|
||||||
|
''' Represents the language of a concept. '''
|
||||||
|
DE = 'de'
|
||||||
|
EN = 'en'
|
||||||
|
|
||||||
|
class ConceptType(enum.Enum):
|
||||||
|
''' Represents the type of a concept. '''
|
||||||
|
FACULTY = 'faculty'
|
||||||
|
INSTITUTE = 'institute'
|
||||||
|
CHAIR = 'chair'
|
||||||
|
|
||||||
|
class Concept(pydantic.BaseModel):
|
||||||
|
''' A container for concepts with singular, plural and abbreviations. '''
|
||||||
|
language: Language
|
||||||
|
singular: str
|
||||||
|
plural: str
|
||||||
|
abbreviations: typing.List[str] = pydantic.Field(default=[])
|
||||||
|
type: ConceptType
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.singular)
|
||||||
|
|
||||||
|
class Resource(pydantic.BaseModel):
|
||||||
|
url: str
|
||||||
|
pagedepth: int
|
||||||
|
text: str
|
||||||
|
|
||||||
|
class Link(Resource):
|
||||||
|
''' Represents a link with a URL, a text on a page. '''
|
||||||
|
wrapper: bool = pydantic.Field(default=False)
|
||||||
|
|
||||||
|
class Page(Resource):
|
||||||
|
''' Represents a page with a URL, text and links. '''
|
||||||
|
links: typing.List[Link]
|
||||||
|
language: Language = pydantic.Field(default=Language.DE, exclude=True)
|
||||||
|
headings: typing.List[str] = pydantic.Field(default=[], exclude=True)
|
||||||
|
found_link_text_flag: bool
|
||||||
|
ignore_flag: bool = pydantic.Field(default=False)
|
||||||
|
|
||||||
|
class AggregatorPage(Page):
|
||||||
|
''' Represents a page that is used as an aggregator. '''
|
||||||
|
parent: str = pydantic.Field(default='')
|
||||||
|
parent_link: str = pydantic.Field(default='')
|
||||||
|
concept: Concept
|
||||||
|
children: typing.List[Link] = pydantic.Field(default=[])
|
||||||
|
|
||||||
|
class EntityDetail(pydantic.BaseModel):
|
||||||
|
''' Represents a detailed entity '''
|
||||||
|
name: str = pydantic.Field(default='')
|
||||||
|
url: typing.List[str]
|
||||||
|
content: typing.List[str]
|
||||||
|
hash: typing.List[str]
|
||||||
|
found: bool = pydantic.Field(default=False)
|
||||||
|
def mark(self, value: bool):
|
||||||
|
if isinstance(value, bool):
|
||||||
|
self.found = value
|
||||||
|
|
||||||
|
class Target(Resource):
|
||||||
|
''' Represents a target with a URL, text and a hash. '''
|
||||||
|
hash: str
|
||||||
|
|
||||||
|
def matches(self, other: 'Target') -> bool:
|
||||||
|
''' Checks if the content matches this content. '''
|
||||||
|
if self.url == other.url:
|
||||||
|
return True
|
||||||
|
if self.hash == other.hash:
|
||||||
|
return self.text == other.text
|
||||||
|
return False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def create(cls, url: str, text: str, pagedepth: int):
|
||||||
|
''' Creates a target from a resource. '''
|
||||||
|
hash = hashlib.sha256()
|
||||||
|
hash.update(text.encode('utf-8'))
|
||||||
|
return cls(url = url, pagedepth = pagedepth, text = text, hash = hash.hexdigest())
|
||||||
|
|
||||||
|
|
||||||
|
class Entity(pydantic.BaseModel):
|
||||||
|
''' Base class for an entity. '''
|
||||||
|
targets: typing.List[Target]
|
||||||
|
name: str = pydantic.Field(default='')
|
||||||
|
found: bool = pydantic.Field(default=False)
|
||||||
|
|
||||||
|
def equals(self, other: 'Entity') -> bool:
|
||||||
|
''' Checks if all targets match a target. '''
|
||||||
|
for target in self.targets:
|
||||||
|
if not any(target.matches(other_target) for other_target in other.targets):
|
||||||
|
return False
|
||||||
|
for other_target in other.targets:
|
||||||
|
if not any(other_target.matches(target) for target in self.targets):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
def matches(self, other: 'Entity') -> bool:
|
||||||
|
''' Checks if any target matches the targets. '''
|
||||||
|
for target in self.targets:
|
||||||
|
if any(target.matches(other_target) for other_target in other.targets):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def create(cls, name: str, targets: typing.List[Target]):
|
||||||
|
''' Creates an entity from a name and a list of targets. '''
|
||||||
|
return cls(name = name, targets = targets)
|
||||||
|
|
||||||
|
class ChairEntity(Entity):
|
||||||
|
''' Represents a chair entity. '''
|
||||||
|
pass
|
||||||
|
|
||||||
|
class InsituteEntity(Entity):
|
||||||
|
''' Represents an institute entity. '''
|
||||||
|
pass
|
||||||
|
|
||||||
|
class FacultyEntity(Entity):
|
||||||
|
''' Represents a faculty entity. '''
|
||||||
|
chairs: typing.List['ChairEntity'] = pydantic.Field(default=[])
|
||||||
|
institutes: typing.List['InsituteEntity'] = pydantic.Field(default=[])
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
|||||||
|
# Automatically created by: scrapy startproject
|
||||||
|
#
|
||||||
|
# For more information about the [deploy] section see:
|
||||||
|
# https://scrapyd.readthedocs.io/en/latest/deploy.html
|
||||||
|
|
||||||
|
[settings]
|
||||||
|
default = crawler.settings
|
||||||
|
|
||||||
|
[deploy]
|
||||||
|
#url = http://localhost:6800/
|
||||||
|
project = crawler
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"https://www.uni-due.de/biwi/koenig/start.php": "https://www.uni-due.de/biwi/koenig",
|
||||||
|
"https://www.uni-due.de/biwi/hofaecker/start": "https://www.uni-due.de/biwi/hofaecker",
|
||||||
|
"https://www.uni-due.de/biwi/wehrheim/wehrheim.php": "https://www.uni-due.de/biwi/wehrheim",
|
||||||
|
"https://www.uni-due.de/chemie/ak_disch/ak_disch.php": "https://www.uni-due.de/chemie/ak_disch",
|
||||||
|
"https://www.uni-due.de/kunst-kuwiss/kuk_home.shtml": "https://www.uni-due.de/kunst-kuwiss",
|
||||||
|
"https://www.uni-due.de/mathematik/ruhrpad/ruhr.pad": "https://www.uni-due.de/mathematik/ruhrpad",
|
||||||
|
"https://www.uni-due.de/mathematik/ag_belomestny/urusov": "https://www.uni-due.de/mathematik/ag_belomestny",
|
||||||
|
"https://www.uni-due.de/empi/aqm/schierning-cv": "https://www.uni-due.de/empi/aqm"
|
||||||
|
}
|
||||||
@@ -0,0 +1,244 @@
|
|||||||
|
"""
|
||||||
|
Generate crawl seeds from an entity's accepted hierarchy.
|
||||||
|
|
||||||
|
The source truth uses the shared accepted hierarchy tree.
|
||||||
|
Configured seed_levels determine which entity levels are emitted.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
from urllib.parse import urldefrag, urlsplit, urlunsplit
|
||||||
|
|
||||||
|
from pipeline_utils import (
|
||||||
|
add_common_args,
|
||||||
|
generated_entities_path,
|
||||||
|
get_entity,
|
||||||
|
hierarchy_path,
|
||||||
|
load_config,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
VALID_LEVELS = {"faculty", "institute", "chair"}
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_url(url: str) -> str | None:
|
||||||
|
"""Return a stable seed URL, or None for missing/invalid truth values."""
|
||||||
|
if not isinstance(url, str):
|
||||||
|
return None
|
||||||
|
|
||||||
|
url = url.strip()
|
||||||
|
if not url or url.lower() == "none":
|
||||||
|
return None
|
||||||
|
|
||||||
|
url, _ = urldefrag(url)
|
||||||
|
parsed = urlsplit(url)
|
||||||
|
|
||||||
|
if parsed.scheme not in {"http", "https"} or not parsed.hostname:
|
||||||
|
return None
|
||||||
|
|
||||||
|
path = parsed.path.rstrip("/")
|
||||||
|
return urlunsplit((parsed.scheme, parsed.netloc, path, parsed.query, ""))
|
||||||
|
|
||||||
|
|
||||||
|
def hostname_is_blocked(hostname: str, blocked_hosts: list[str]) -> bool:
|
||||||
|
hostname = hostname.lower().rstrip(".")
|
||||||
|
for blocked in blocked_hosts:
|
||||||
|
blocked = blocked.lower().rstrip(".")
|
||||||
|
if hostname == blocked or hostname.endswith("." + blocked):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def hostname_is_allowed(hostname: str, allowed_domains: list[str]) -> bool:
|
||||||
|
hostname = hostname.lower().rstrip(".")
|
||||||
|
for allowed in allowed_domains:
|
||||||
|
allowed = allowed.lower().rstrip(".")
|
||||||
|
if hostname == allowed or hostname.endswith("." + allowed):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def extract_urls(node: dict) -> list[str]:
|
||||||
|
"""Extract all link_de/link_en/link_de_2/... fields from one truth node."""
|
||||||
|
urls = []
|
||||||
|
for key, value in node.items():
|
||||||
|
if key.startswith("link_"):
|
||||||
|
url = normalize_url(value)
|
||||||
|
if url:
|
||||||
|
urls.append(url)
|
||||||
|
return urls
|
||||||
|
|
||||||
|
|
||||||
|
def collect_seeds(truth: dict, seed_levels: set[str]) -> list[dict]:
|
||||||
|
seeds = []
|
||||||
|
|
||||||
|
for faculty in truth.get("faculties", []):
|
||||||
|
if "faculty" in seed_levels:
|
||||||
|
for url in extract_urls(faculty):
|
||||||
|
seeds.append({
|
||||||
|
"url": url,
|
||||||
|
"level": "faculty",
|
||||||
|
"name_de": faculty.get("name_de", ""),
|
||||||
|
"name_en": faculty.get("name_en", ""),
|
||||||
|
})
|
||||||
|
|
||||||
|
for institute in faculty.get("institutes", []):
|
||||||
|
if "institute" in seed_levels:
|
||||||
|
for url in extract_urls(institute):
|
||||||
|
seeds.append({
|
||||||
|
"url": url,
|
||||||
|
"level": "institute",
|
||||||
|
"name_de": institute.get("name_de", ""),
|
||||||
|
"name_en": institute.get("name_en", ""),
|
||||||
|
"faculty_de": faculty.get("name_de", ""),
|
||||||
|
"faculty_en": faculty.get("name_en", ""),
|
||||||
|
})
|
||||||
|
|
||||||
|
for chair in institute.get("chairs", []):
|
||||||
|
if "chair" in seed_levels:
|
||||||
|
for url in extract_urls(chair):
|
||||||
|
seeds.append({
|
||||||
|
"url": url,
|
||||||
|
"level": "chair",
|
||||||
|
"name_de": chair.get("name_de", ""),
|
||||||
|
"name_en": chair.get("name_en", ""),
|
||||||
|
"faculty_de": faculty.get("name_de", ""),
|
||||||
|
"faculty_en": faculty.get("name_en", ""),
|
||||||
|
})
|
||||||
|
|
||||||
|
for chair in faculty.get("chairs", []):
|
||||||
|
if "chair" in seed_levels:
|
||||||
|
for url in extract_urls(chair):
|
||||||
|
seeds.append({
|
||||||
|
"url": url,
|
||||||
|
"level": "chair",
|
||||||
|
"name_de": chair.get("name_de", ""),
|
||||||
|
"name_en": chair.get("name_en", ""),
|
||||||
|
"faculty_de": faculty.get("name_de", ""),
|
||||||
|
"faculty_en": faculty.get("name_en", ""),
|
||||||
|
})
|
||||||
|
|
||||||
|
return seeds
|
||||||
|
|
||||||
|
|
||||||
|
def collect_accepted_seeds(hierarchy: list[dict], seed_levels: set[str]) -> list[dict]:
|
||||||
|
seeds = []
|
||||||
|
|
||||||
|
def add(node, level, faculty):
|
||||||
|
if level not in seed_levels:
|
||||||
|
return
|
||||||
|
for url in extract_urls(node):
|
||||||
|
seed = {
|
||||||
|
"url": url,
|
||||||
|
"level": level,
|
||||||
|
"name_de": node.get("name_de", ""),
|
||||||
|
"name_en": node.get("name_en", ""),
|
||||||
|
}
|
||||||
|
if faculty:
|
||||||
|
seed.update(
|
||||||
|
faculty_de=faculty.get("name_de", ""),
|
||||||
|
faculty_en=faculty.get("name_en", ""),
|
||||||
|
)
|
||||||
|
seeds.append(seed)
|
||||||
|
|
||||||
|
for faculty in hierarchy:
|
||||||
|
add(faculty, "faculty", None)
|
||||||
|
for group in faculty.get("children") or []:
|
||||||
|
group_type = group.get("type")
|
||||||
|
if group_type == "institutes":
|
||||||
|
for institute in group.get("children") or []:
|
||||||
|
add(institute, "institute", faculty)
|
||||||
|
for chair_group in institute.get("children") or []:
|
||||||
|
if chair_group.get("type") == "chairs":
|
||||||
|
for chair in chair_group.get("children") or []:
|
||||||
|
add(chair, "chair", faculty)
|
||||||
|
elif group_type == "chairs":
|
||||||
|
for chair in group.get("children") or []:
|
||||||
|
add(chair, "chair", faculty)
|
||||||
|
|
||||||
|
return seeds
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Generate generic crawler seed URLs from an entity truth file."
|
||||||
|
)
|
||||||
|
add_common_args(parser)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
config = load_config(args.config)
|
||||||
|
entity = get_entity(config, args.entity)
|
||||||
|
crawl = entity.get("crawl", {})
|
||||||
|
|
||||||
|
seed_levels = set(crawl.get("seed_levels", ["institute", "chair"]))
|
||||||
|
invalid_levels = seed_levels - VALID_LEVELS
|
||||||
|
if invalid_levels:
|
||||||
|
raise SystemExit(
|
||||||
|
f"Invalid seed_levels for '{args.entity}': {sorted(invalid_levels)}. "
|
||||||
|
f"Allowed values: {sorted(VALID_LEVELS)}"
|
||||||
|
)
|
||||||
|
|
||||||
|
truth_path = hierarchy_path(config, args.entity)
|
||||||
|
output_path = generated_entities_path(config, args.entity)
|
||||||
|
|
||||||
|
with open(truth_path, encoding="utf-8") as handle:
|
||||||
|
truth = json.load(handle)
|
||||||
|
|
||||||
|
allowed_domains = crawl.get("allowed_domains", [])
|
||||||
|
blocked_hosts = crawl.get("banned_hostnames", [])
|
||||||
|
|
||||||
|
if not allowed_domains:
|
||||||
|
raise SystemExit(
|
||||||
|
f"Entity '{args.entity}' has no crawl.allowed_domains configuration."
|
||||||
|
)
|
||||||
|
|
||||||
|
seeds = []
|
||||||
|
skipped = []
|
||||||
|
|
||||||
|
seed_records = (
|
||||||
|
collect_accepted_seeds(truth, seed_levels)
|
||||||
|
if isinstance(truth, list)
|
||||||
|
else collect_seeds(truth, seed_levels)
|
||||||
|
)
|
||||||
|
for seed in seed_records:
|
||||||
|
hostname = urlsplit(seed["url"]).hostname
|
||||||
|
if hostname_is_blocked(hostname, blocked_hosts):
|
||||||
|
skipped.append({"url": seed["url"], "reason": "banned_hostname"})
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not hostname_is_allowed(hostname, allowed_domains):
|
||||||
|
skipped.append({"url": seed["url"], "reason": "outside_allowed_domains"})
|
||||||
|
continue
|
||||||
|
|
||||||
|
seeds.append(seed)
|
||||||
|
|
||||||
|
# Deduplicate by normalized URL while retaining the first metadata record.
|
||||||
|
unique_seeds = {}
|
||||||
|
for seed in seeds:
|
||||||
|
unique_seeds.setdefault(seed["url"], seed)
|
||||||
|
|
||||||
|
output = {
|
||||||
|
"entity": args.entity,
|
||||||
|
"display_name": entity.get("display_name", args.entity),
|
||||||
|
"source_truth_file": truth_path,
|
||||||
|
"generated_at": datetime.now(timezone.utc).isoformat(),
|
||||||
|
"seed_levels": sorted(seed_levels),
|
||||||
|
"seed_count": len(unique_seeds),
|
||||||
|
"skipped_count": len(skipped),
|
||||||
|
"seeds": list(unique_seeds.values()),
|
||||||
|
"skipped": skipped,
|
||||||
|
}
|
||||||
|
|
||||||
|
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
||||||
|
with open(output_path, "w", encoding="utf-8") as handle:
|
||||||
|
json.dump(output, handle, ensure_ascii=False, indent=2)
|
||||||
|
|
||||||
|
print(f"Generated {len(unique_seeds)} crawl seeds: {output_path}")
|
||||||
|
if skipped:
|
||||||
|
print(f"Skipped {len(skipped)} invalid, banned, or out-of-scope seed URLs.")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
{
|
||||||
|
"runs_dir": "runs",
|
||||||
|
"elasticsearch": {
|
||||||
|
"host": "https://inse.nes.uni-due.de:443/elastic",
|
||||||
|
"user": "elastic",
|
||||||
|
"password_env": "ES_PASSWORD",
|
||||||
|
"request_timeout": 60,
|
||||||
|
"max_retries": 5
|
||||||
|
},
|
||||||
|
"llm": {
|
||||||
|
"base_url_env": "llm_api",
|
||||||
|
"api_key_env": "llm_key",
|
||||||
|
"model_name": "model_name"
|
||||||
|
},
|
||||||
|
"cache_dir": "runs/.llm_cache",
|
||||||
|
"default_categories": [
|
||||||
|
"Teaching",
|
||||||
|
"Research",
|
||||||
|
"Projects",
|
||||||
|
"Staff",
|
||||||
|
"News",
|
||||||
|
"Other"
|
||||||
|
],
|
||||||
|
"entities": {
|
||||||
|
"ude": {
|
||||||
|
"display_name": "University of Duisburg-Essen",
|
||||||
|
"crawler_dir": "crawler/crawler",
|
||||||
|
"scrapy_spider": "ude",
|
||||||
|
"hierarchy_file": "/data/hierarchies/I62318514/hierarchy.json",
|
||||||
|
"problem_orgs_file": "entities/ude/problem_orgs.json",
|
||||||
|
"classifier_banned_hostnames": [
|
||||||
|
"www.uni-due.de",
|
||||||
|
"uni-due.de",
|
||||||
|
"www.esaga.uni-due.de",
|
||||||
|
"esaga.uni-due.de",
|
||||||
|
"bibliography.uni-due.de"
|
||||||
|
],
|
||||||
|
"crawl": {
|
||||||
|
"generated_entities_file": "entities.json",
|
||||||
|
"seed_levels": [
|
||||||
|
"institute",
|
||||||
|
"chair"
|
||||||
|
],
|
||||||
|
"allowed_domains": [
|
||||||
|
"uni-due.de",
|
||||||
|
"uk-essen.de"
|
||||||
|
],
|
||||||
|
"banned_hostnames": [],
|
||||||
|
"deny_url_patterns": [
|
||||||
|
"(campus|webmailer|webmail|git|moodle|primo|shop|lehramtswiki)\\.(uni-duisburg-essen|uni-due)\\.de",
|
||||||
|
"belegung\\.uni-due\\.de",
|
||||||
|
"uni-due\\.de/ub",
|
||||||
|
"uni-due\\.digibib\\.net",
|
||||||
|
"uni-due\\.zoom\\.us",
|
||||||
|
"uni-due\\.de/myude/",
|
||||||
|
"uni-due\\.de/en/deadlines\\.php",
|
||||||
|
"uni-due\\.de/verwaltung",
|
||||||
|
"uni-due\\.de/zim",
|
||||||
|
"uni-due\\.de/aktuell",
|
||||||
|
"duepublico2\\.uni-due\\.de",
|
||||||
|
"uni-due\\.de/person",
|
||||||
|
"uni-due\\.de/de/presse",
|
||||||
|
"uni-due\\.de/de/campusaktuell",
|
||||||
|
"uni-due\\.de/de/intranet",
|
||||||
|
"uni-due\\.de/de/veranstaltungen",
|
||||||
|
"uni-due\\.de/de/presse/meldung\\.php",
|
||||||
|
"\\.bib$"
|
||||||
|
],
|
||||||
|
"depth_limit": 6,
|
||||||
|
"download_delay": 2,
|
||||||
|
"concurrent_requests": 16,
|
||||||
|
"concurrent_requests_per_domain": 16,
|
||||||
|
"download_timeout": 40,
|
||||||
|
"user_agent": "inse-crawler",
|
||||||
|
"operator": "arman.arzani@uni-due.de"
|
||||||
|
},
|
||||||
|
"elasticsearch": {
|
||||||
|
"raw_index": "ude_organization_november_2026",
|
||||||
|
"categorized_index": "ude_organization_categorized_november_2026",
|
||||||
|
"content_index": "ude_organization_content_november_2026"
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"redirections_file": "redirections_lookup.json",
|
||||||
|
"links_to_analyze_file": "links_to_analyze.json",
|
||||||
|
"hierarchy_file": "hierarchy.json",
|
||||||
|
"classifier_log": "classifier_log.json",
|
||||||
|
"content_extractor_log": "content_extractor_log.json",
|
||||||
|
"content_extractor_output_log": "outputs.log",
|
||||||
|
"keywords_updated_log": "keywords_log_updated_orgs.json",
|
||||||
|
"keywords_failed_log": "keywords_log_failed_extractions.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tud": {
|
||||||
|
"display_name": "Technische Universität Dortmund",
|
||||||
|
"crawler_dir": "crawler/crawler",
|
||||||
|
"scrapy_spider": "tud",
|
||||||
|
"hierarchy_file": "/data/hierarchies/I200332995/hierarchy.json",
|
||||||
|
"problem_orgs_file": "entities/tud/problem_orgs.json",
|
||||||
|
"classifier_banned_hostnames": [
|
||||||
|
"www.tu-dortmund.de/",
|
||||||
|
"tu-dortmund.de/"
|
||||||
|
],
|
||||||
|
"crawl": {
|
||||||
|
"generated_entities_file": "entities.json",
|
||||||
|
"seed_levels": [
|
||||||
|
"institute",
|
||||||
|
"chair"
|
||||||
|
],
|
||||||
|
"allowed_domains": [
|
||||||
|
"tu-dortmund.de",
|
||||||
|
"www.tu-dortmund.de"
|
||||||
|
],
|
||||||
|
"banned_hostnames": [],
|
||||||
|
"deny_url_patterns": [],
|
||||||
|
"depth_limit": 1,
|
||||||
|
"download_delay": 2,
|
||||||
|
"concurrent_requests": 16,
|
||||||
|
"concurrent_requests_per_domain": 16,
|
||||||
|
"download_timeout": 40,
|
||||||
|
"user_agent": "inse-crawler",
|
||||||
|
"operator": "arman.arzani@uni-due.de"
|
||||||
|
},
|
||||||
|
"elasticsearch": {
|
||||||
|
"raw_index": "tud_organization_bj_test",
|
||||||
|
"categorized_index": "tud_organization_categorized_bj_test",
|
||||||
|
"content_index": "tud_organization_content_bj_test"
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"redirections_file": "redirections_lookup.json",
|
||||||
|
"links_to_analyze_file": "links_to_analyze.json",
|
||||||
|
"hierarchy_file": "hierarchy.json",
|
||||||
|
"classifier_log": "classifier_log.json",
|
||||||
|
"content_extractor_log": "content_extractor_log.json",
|
||||||
|
"content_extractor_output_log": "outputs.log",
|
||||||
|
"keywords_updated_log": "keywords_log_updated_orgs.json",
|
||||||
|
"keywords_failed_log": "keywords_log_failed_extractions.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,302 @@
|
|||||||
|
"""
|
||||||
|
Shared helpers for the organization-crawling pipeline.
|
||||||
|
|
||||||
|
Every stage script imports this module to:
|
||||||
|
- load pipeline_config.json
|
||||||
|
- resolve the per-entity run folder (runs/<entity>/out/...)
|
||||||
|
- resolve entity-specific input files (accepted hierarchy, problem orgs, ...)
|
||||||
|
- build Elasticsearch / LLM clients from shared config + env vars
|
||||||
|
|
||||||
|
This is the only place that should know about the on-disk layout, so adding a new
|
||||||
|
organization is a config-only change (see 'entity_template' in pipeline_config.json).
|
||||||
|
"""
|
||||||
|
import shutil
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
import argparse
|
||||||
|
import functools
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
import diskcache
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv() # load .env file in cwd, if present
|
||||||
|
DEFAULT_CONFIG_FILENAME = "pipeline_config.json"
|
||||||
|
|
||||||
|
|
||||||
|
def _default_config_path():
|
||||||
|
return os.path.join(os.path.dirname(os.path.abspath(__file__)), DEFAULT_CONFIG_FILENAME)
|
||||||
|
|
||||||
|
|
||||||
|
def load_config(config_path=None):
|
||||||
|
path = os.path.abspath(config_path or _default_config_path())
|
||||||
|
with open(path, encoding="utf-8") as f:
|
||||||
|
config = json.load(f)
|
||||||
|
# remember where the config lives so relative paths inside it (ground truth files,
|
||||||
|
# crawler dirs, ...) resolve consistently no matter what the script's cwd is.
|
||||||
|
config["_config_dir"] = os.path.dirname(path)
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
def resolve_path(config, path):
|
||||||
|
"""Resolve a path from the config relative to the config file's directory,
|
||||||
|
unless it is already absolute."""
|
||||||
|
if os.path.isabs(path):
|
||||||
|
return path
|
||||||
|
return os.path.join(config["_config_dir"], path)
|
||||||
|
|
||||||
|
|
||||||
|
def get_entity(config, entity_name):
|
||||||
|
entities = config.get("entities", {})
|
||||||
|
if entity_name not in entities:
|
||||||
|
raise SystemExit(
|
||||||
|
f"Entity '{entity_name}' not found in pipeline_config.json. "
|
||||||
|
f"Available entities: {list(entities.keys())}"
|
||||||
|
)
|
||||||
|
return entities[entity_name]
|
||||||
|
|
||||||
|
|
||||||
|
def run_dir(config, entity_name):
|
||||||
|
"""The per-entity, per-run folder: runs/<entity>/ (with an out/ subfolder)."""
|
||||||
|
d = resolve_path(config, os.path.join(config.get("runs_dir", "runs"), entity_name))
|
||||||
|
os.makedirs(os.path.join(d, "out"), exist_ok=True)
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
def out_path(config, entity_name, key):
|
||||||
|
"""Resolve the path of a named output artifact for an entity's run.
|
||||||
|
'key' matches a key under entities.<entity>.output in pipeline_config.json,
|
||||||
|
e.g. out_path(config, 'ude', 'hierarchy_file')."""
|
||||||
|
entity = get_entity(config, entity_name)
|
||||||
|
filename = entity["output"][key]
|
||||||
|
return os.path.join(run_dir(config, entity_name), "out", filename)
|
||||||
|
|
||||||
|
|
||||||
|
def entity_input_path(config, entity_name, key):
|
||||||
|
"""Resolve an entity-specific input file path, e.g. 'ground_truth_file' or
|
||||||
|
'problem_orgs_file'."""
|
||||||
|
entity = get_entity(config, entity_name)
|
||||||
|
return resolve_path(config, entity[key])
|
||||||
|
|
||||||
|
|
||||||
|
def hierarchy_path(config, entity_name):
|
||||||
|
"""Resolve the accepted hierarchy shared with the service."""
|
||||||
|
entity = get_entity(config, entity_name)
|
||||||
|
return resolve_path(config, entity["hierarchy_file"])
|
||||||
|
def _first_env(*names):
|
||||||
|
"""Return the first non-empty environment variable among the given names."""
|
||||||
|
for name in names:
|
||||||
|
if name and os.environ.get(name):
|
||||||
|
return os.environ[name]
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def get_es_client(config):
|
||||||
|
from elasticsearch import Elasticsearch
|
||||||
|
es_conf = config["elasticsearch"]
|
||||||
|
|
||||||
|
host = (
|
||||||
|
_first_env("INSE_ELASTIC_URL", "ELASTICSEARCH_INSE_URL", es_conf.get("host_env"))
|
||||||
|
or es_conf.get("host")
|
||||||
|
)
|
||||||
|
if not host:
|
||||||
|
raise SystemExit("Elasticsearch host not set (INSE_ELASTIC_URL or elasticsearch.host).")
|
||||||
|
|
||||||
|
kwargs = {
|
||||||
|
"request_timeout": es_conf.get("request_timeout", 60),
|
||||||
|
"max_retries": es_conf.get("max_retries", 5),
|
||||||
|
"retry_on_timeout": True,
|
||||||
|
}
|
||||||
|
api_key = _first_env(
|
||||||
|
"INSE_ELASTIC_API_KEY",
|
||||||
|
"ELASTICSEARCH_INSE_API_KEY",
|
||||||
|
es_conf.get("api_key_env"),
|
||||||
|
)
|
||||||
|
username = es_conf.get("user") or os.getenv(es_conf.get("user_env", "ES_USERNAME"))
|
||||||
|
password = os.getenv(es_conf.get("password_env", "ES_PASSWORD"))
|
||||||
|
if api_key:
|
||||||
|
kwargs["api_key"] = api_key
|
||||||
|
elif username and password:
|
||||||
|
kwargs["basic_auth"] = (username, password)
|
||||||
|
else:
|
||||||
|
raise SystemExit(
|
||||||
|
"Elasticsearch credentials not set: provide INSE_ELASTIC_API_KEY, "
|
||||||
|
"or elasticsearch.user plus the ES_PASSWORD variable."
|
||||||
|
)
|
||||||
|
return Elasticsearch(host, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# kwargs that only affect transport, not the answer - excluded from the cache
|
||||||
|
# key so a streamed call and a non-streamed call with the same prompt share
|
||||||
|
# one cache entry.
|
||||||
|
_TRANSPORT_KWARGS = ("stream", "stream_options", "timeout")
|
||||||
|
|
||||||
|
|
||||||
|
def _stable_key(func_name, kwargs):
|
||||||
|
kwargs = {k: v for k, v in kwargs.items() if k not in _TRANSPORT_KWARGS}
|
||||||
|
|
||||||
|
def default(o):
|
||||||
|
if isinstance(o, type):
|
||||||
|
# e.g. a pydantic response_format class -> key on its schema,
|
||||||
|
if hasattr(o, "model_json_schema"):
|
||||||
|
return o.model_json_schema()
|
||||||
|
return f"{o.__module__}.{o.__qualname__}"
|
||||||
|
if hasattr(o, "model_dump"):
|
||||||
|
return o.model_dump()
|
||||||
|
return str(o)
|
||||||
|
|
||||||
|
payload = json.dumps({"func": func_name, **kwargs}, default=default, sort_keys=True)
|
||||||
|
return hashlib.sha256(payload.encode()).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def _collect_stream(stream):
|
||||||
|
"""Consume a chat.completions stream and assemble it into a regular
|
||||||
|
ChatCompletion object (first choice only, tool calls ignored).
|
||||||
|
|
||||||
|
We stream purely as a keep-alive: the Apache reverse proxy in front of
|
||||||
|
vLLM drops idle connections after ~300s, and a long generation with
|
||||||
|
stream=False sends nothing until it is finished -> 502 Proxy Error.
|
||||||
|
With streaming, chunks flow continuously and the proxy stays happy.
|
||||||
|
"""
|
||||||
|
from openai.types.chat import ChatCompletion, ChatCompletionMessage
|
||||||
|
from openai.types.chat.chat_completion import Choice
|
||||||
|
|
||||||
|
meta = {"id": "", "model": "", "created": 0}
|
||||||
|
content, reasoning, finish_reason, usage = [], [], None, None
|
||||||
|
for chunk in stream:
|
||||||
|
for k in meta:
|
||||||
|
meta[k] = meta[k] or getattr(chunk, k, None) or meta[k]
|
||||||
|
if getattr(chunk, "usage", None):
|
||||||
|
usage = chunk.usage
|
||||||
|
for choice in chunk.choices or []:
|
||||||
|
if choice.index != 0:
|
||||||
|
continue
|
||||||
|
delta = choice.delta
|
||||||
|
if delta is not None:
|
||||||
|
if delta.content:
|
||||||
|
content.append(delta.content)
|
||||||
|
r = getattr(delta, "reasoning", None) or getattr(delta, "reasoning_content", None)
|
||||||
|
if r:
|
||||||
|
reasoning.append(r)
|
||||||
|
if choice.finish_reason:
|
||||||
|
finish_reason = choice.finish_reason
|
||||||
|
|
||||||
|
if finish_reason is None:
|
||||||
|
# Connection dropped mid-generation - never hand back a truncated
|
||||||
|
# answer as if it were complete; let the caller's retry loop handle it.
|
||||||
|
raise RuntimeError("LLM stream ended without a finish_reason (connection dropped?)")
|
||||||
|
|
||||||
|
message = ChatCompletionMessage(role="assistant", content="".join(content))
|
||||||
|
completion = ChatCompletion(
|
||||||
|
id=meta["id"], object="chat.completion", created=meta["created"], model=meta["model"],
|
||||||
|
choices=[Choice(index=0, finish_reason=finish_reason, message=message)],
|
||||||
|
usage=usage,
|
||||||
|
)
|
||||||
|
if reasoning:
|
||||||
|
completion.reasoning = "".join(reasoning) # keep for debugging (extra attr, not part of the schema)
|
||||||
|
return completion
|
||||||
|
|
||||||
|
|
||||||
|
def _wrap_stream_collect(method):
|
||||||
|
"""stream=True still returns a fully assembled ChatCompletion, so callers
|
||||||
|
(and the cache) never have to deal with Stream objects."""
|
||||||
|
@functools.wraps(method)
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
if kwargs.get("stream"):
|
||||||
|
return _collect_stream(method(*args, **kwargs))
|
||||||
|
return method(*args, **kwargs)
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
def _wrap_cached(method, cache, func_name):
|
||||||
|
@functools.wraps(method)
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
key = _stable_key(func_name, kwargs)
|
||||||
|
if key in cache:
|
||||||
|
return cache[key]
|
||||||
|
result = method(*args, **kwargs)
|
||||||
|
if _is_complete(result):
|
||||||
|
cache[key] = result
|
||||||
|
return result
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
def _is_complete(completion):
|
||||||
|
"""Only cache answers the model actually finished. A truncated answer
|
||||||
|
(finish_reason == "length": max_tokens hit, possibly by a reasoning
|
||||||
|
trace alone) would otherwise be replayed from the cache on every retry."""
|
||||||
|
try:
|
||||||
|
return all(c.finish_reason == "stop" for c in completion.choices)
|
||||||
|
except Exception:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def get_llm_client(config, use_cache=True):
|
||||||
|
from openai import OpenAI
|
||||||
|
llm_conf = config["llm"]
|
||||||
|
base_url = _first_env("INSE_LLM_BASE_URL", llm_conf.get("base_url_env", "llm_api"))
|
||||||
|
api_key = _first_env("INSE_LLM_API_KEY", llm_conf.get("api_key_env", "llm_key"))
|
||||||
|
model_name = _first_env("INSE_LLM_MODEL", llm_conf.get("model_name", "model_name"))
|
||||||
|
if not (base_url and api_key and model_name):
|
||||||
|
raise SystemExit("LLM settings missing (INSE_LLM_BASE_URL, INSE_LLM_API_KEY, INSE_LLM_MODEL).")
|
||||||
|
|
||||||
|
client = OpenAI(base_url=base_url, api_key=api_key, max_retries=0)
|
||||||
|
client.chat.completions.create = _wrap_stream_collect(client.chat.completions.create)
|
||||||
|
|
||||||
|
if use_cache:
|
||||||
|
cache_dir = resolve_path(
|
||||||
|
config, config.get("cache_dir") or llm_conf.get("cache_dir", ".llm_cache")
|
||||||
|
)
|
||||||
|
cache = diskcache.Cache(cache_dir)
|
||||||
|
|
||||||
|
client.chat.completions.create = _wrap_cached(
|
||||||
|
client.chat.completions.create, cache, "chat.completions.create"
|
||||||
|
)
|
||||||
|
# if content_extractor_pydantic.py uses structured outputs via .parse()
|
||||||
|
if hasattr(client.beta.chat.completions, "parse"):
|
||||||
|
client.beta.chat.completions.parse = _wrap_cached(
|
||||||
|
client.beta.chat.completions.parse, cache, "beta.chat.completions.parse"
|
||||||
|
)
|
||||||
|
|
||||||
|
return client, model_name
|
||||||
|
|
||||||
|
|
||||||
|
def add_common_args(parser: argparse.ArgumentParser):
|
||||||
|
"""Every stage script accepts --entity (required) and --config (optional override)."""
|
||||||
|
parser.add_argument("--entity", required=True, help="Entity name as defined in pipeline_config.json")
|
||||||
|
parser.add_argument("--config", default=None, help="Path to pipeline_config.json (default: alongside this file)")
|
||||||
|
return parser
|
||||||
|
|
||||||
|
def generated_entities_path(config, entity_name):
|
||||||
|
"""Generated crawl-seed JSON: runs/<entity>/entities.json."""
|
||||||
|
entity = get_entity(config, entity_name)
|
||||||
|
filename = entity.get("crawl", {}).get("generated_entities_file", "entities.json")
|
||||||
|
return os.path.join(run_dir(config, entity_name), filename)
|
||||||
|
|
||||||
|
|
||||||
|
def warc_dir(config, entity_name):
|
||||||
|
"""Entity-specific WARC output: runs/<entity>/warc/."""
|
||||||
|
path = os.path.join(run_dir(config, entity_name), "warc")
|
||||||
|
os.makedirs(path, exist_ok=True)
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def crawl_state_dir(config, entity_name):
|
||||||
|
"""Entity-specific resumable Scrapy state: runs/<entity>/crawl-state/."""
|
||||||
|
path = os.path.join(run_dir(config, entity_name), "crawl-state")
|
||||||
|
os.makedirs(path, exist_ok=True)
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def reset_entity_run(config, entity_name):
|
||||||
|
"""Delete all generated data for one entity, including WARC and crawl state."""
|
||||||
|
path = resolve_path(
|
||||||
|
config,
|
||||||
|
os.path.join(config.get("runs_dir", "runs"), entity_name),
|
||||||
|
)
|
||||||
|
if os.path.exists(path):
|
||||||
|
shutil.rmtree(path)
|
||||||
|
return run_dir(config, entity_name)
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
aiohappyeyeballs==2.6.1
|
||||||
|
aiohttp==3.13.5
|
||||||
|
aiosignal==1.4.0
|
||||||
|
annotated-types==0.7.0
|
||||||
|
anyio==4.12.1
|
||||||
|
async-timeout==5.0.1
|
||||||
|
attrs==26.1.0
|
||||||
|
Automat==25.4.16
|
||||||
|
babel==2.18.0
|
||||||
|
beautifulsoup4==4.14.3
|
||||||
|
certifi==2026.2.25
|
||||||
|
cffi==2.1.1
|
||||||
|
charset-normalizer==3.4.4
|
||||||
|
click==8.3.1
|
||||||
|
constantly==23.10.4
|
||||||
|
courlan==1.3.2
|
||||||
|
cryptography==50.0.0
|
||||||
|
cssselect==1.5.0
|
||||||
|
dateparser==1.4.0
|
||||||
|
defusedxml==0.7.1
|
||||||
|
dill==0.4.1
|
||||||
|
diskcache==5.6.3
|
||||||
|
distro==1.9.0
|
||||||
|
elastic-transport==8.17.1
|
||||||
|
elasticsearch==8.17.0
|
||||||
|
exceptiongroup==1.3.1
|
||||||
|
filelock==3.20.0
|
||||||
|
frozenlist==1.8.0
|
||||||
|
fsspec==2025.12.0
|
||||||
|
greenlet==3.4.0
|
||||||
|
h11==0.16.0
|
||||||
|
hf-xet==1.2.0
|
||||||
|
htmldate==1.9.4
|
||||||
|
httpcore==1.0.9
|
||||||
|
httpx==0.28.1
|
||||||
|
huggingface-hub==0.36.0
|
||||||
|
hyperlink==21.0.0
|
||||||
|
idna==3.11
|
||||||
|
ijson==3.5.1
|
||||||
|
Incremental==24.11.0
|
||||||
|
itemadapter==0.13.1
|
||||||
|
itemloaders==1.4.0
|
||||||
|
jellyfish==1.2.1
|
||||||
|
Jinja2==3.1.6
|
||||||
|
jiter==0.16.0
|
||||||
|
jmespath==1.1.0
|
||||||
|
joblib==1.5.3
|
||||||
|
jusText==3.0.2
|
||||||
|
langdetect==1.0.9
|
||||||
|
llvmlite==0.46.0
|
||||||
|
lxml==6.0.2
|
||||||
|
lxml_html_clean==0.4.4
|
||||||
|
MarkupSafe==3.0.3
|
||||||
|
mpmath==1.3.0
|
||||||
|
multidict==6.7.1
|
||||||
|
multiprocess==0.70.19
|
||||||
|
narwhals==2.13.0
|
||||||
|
nest_asyncio==1.6.0
|
||||||
|
networkx==3.4.2
|
||||||
|
nltk==3.9.2
|
||||||
|
numba==0.63.1
|
||||||
|
numpy==2.2.6
|
||||||
|
openai==2.41.1
|
||||||
|
outcome==1.3.0.post0
|
||||||
|
packaging==25.0
|
||||||
|
pandas==2.3.3
|
||||||
|
parsel==1.11.0
|
||||||
|
pillow==12.2.0
|
||||||
|
pip==25.3
|
||||||
|
platformdirs==4.5.1
|
||||||
|
prompt_toolkit==3.0.52
|
||||||
|
propcache==0.4.1
|
||||||
|
Protego==0.6.2
|
||||||
|
psutil==7.1.3
|
||||||
|
pure_eval==0.2.3
|
||||||
|
pyarrow==23.0.1
|
||||||
|
pycparser==3.0
|
||||||
|
pydantic==2.13.0
|
||||||
|
pydantic_core==2.46.0
|
||||||
|
PyDispatcher==2.0.7
|
||||||
|
pynndescent==0.5.13
|
||||||
|
pyOpenSSL==26.4.0
|
||||||
|
PySocks==1.7.1
|
||||||
|
python-dateutil==2.9.0.post0
|
||||||
|
python-dotenv==1.2.2
|
||||||
|
python-magic==0.4.27
|
||||||
|
pytz==2025.2
|
||||||
|
PyYAML==6.0.3
|
||||||
|
queuelib==1.9.0
|
||||||
|
regex==2025.11.3
|
||||||
|
requests==2.32.5
|
||||||
|
requests-file==3.0.1
|
||||||
|
safetensors==0.7.0
|
||||||
|
scikit-learn==1.7.2
|
||||||
|
scipy==1.15.3
|
||||||
|
Scrapy==2.17.0
|
||||||
|
scrapy-warcio==0.0.8
|
||||||
|
segtok==1.5.11
|
||||||
|
sentence-transformers==5.2.0
|
||||||
|
service-identity==26.1.0
|
||||||
|
setuptools==80.9.0
|
||||||
|
six==1.17.0
|
||||||
|
sniffio==1.3.1
|
||||||
|
sortedcontainers==2.4.0
|
||||||
|
soupsieve==2.8.3
|
||||||
|
stack_data==0.6.3
|
||||||
|
svgwrite==1.4.3
|
||||||
|
sympy==1.14.0
|
||||||
|
tabulate==0.10.0
|
||||||
|
threadpoolctl==3.6.0
|
||||||
|
tiktoken==0.13.0
|
||||||
|
tld==0.13.2
|
||||||
|
tldextract==5.3.1
|
||||||
|
tokenizers==0.22.1
|
||||||
|
tomli==2.4.1
|
||||||
|
tqdm==4.67.1
|
||||||
|
trafilatura==2.0.0
|
||||||
|
transformers==4.57.3
|
||||||
|
trio==0.33.0
|
||||||
|
trio-websocket==0.12.2
|
||||||
|
Twisted==26.4.0
|
||||||
|
typing_extensions==4.15.0
|
||||||
|
typing-inspection==0.4.2
|
||||||
|
tzdata==2025.3
|
||||||
|
tzlocal==5.3.1
|
||||||
|
umap-learn==0.5.9.post2
|
||||||
|
urllib3==2.6.3
|
||||||
|
w3lib==2.4.1
|
||||||
|
warcio==1.8.1
|
||||||
|
warctools==5.0.1
|
||||||
|
wcwidth==0.2.14
|
||||||
|
webdriver-manager==4.0.2
|
||||||
|
websocket-client==1.9.0
|
||||||
|
wheel==0.45.1
|
||||||
|
wsproto==1.3.2
|
||||||
|
xlsxwriter==3.2.9
|
||||||
|
xxhash==3.6.0
|
||||||
|
yake==0.7.3
|
||||||
|
yarl==1.23.0
|
||||||
|
zope.interface==8.5
|
||||||
@@ -0,0 +1,363 @@
|
|||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import signal
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import time
|
||||||
|
|
||||||
|
from pipeline_utils import (
|
||||||
|
crawl_state_dir,
|
||||||
|
generated_entities_path,
|
||||||
|
get_entity,
|
||||||
|
load_config,
|
||||||
|
reset_entity_run,
|
||||||
|
run_dir,
|
||||||
|
resolve_path,
|
||||||
|
warc_dir,
|
||||||
|
)
|
||||||
|
|
||||||
|
_active_process: subprocess.Popen | None = None
|
||||||
|
_stop_requested = False
|
||||||
|
|
||||||
|
|
||||||
|
def _handle_stop_signal(signum: int, _frame) -> None:
|
||||||
|
"""Forward SIGTERM to the running stage's process group and remember the request.
|
||||||
|
|
||||||
|
The handler must not block: the main loop keeps draining the child's output
|
||||||
|
until the stage has shut down (Scrapy saves its JOBDIR on the first SIGTERM).
|
||||||
|
If the container's stop timeout is shorter than the shutdown, Docker kills it.
|
||||||
|
"""
|
||||||
|
global _stop_requested
|
||||||
|
_stop_requested = True
|
||||||
|
process = _active_process
|
||||||
|
if process is not None and process.poll() is None:
|
||||||
|
try:
|
||||||
|
os.killpg(process.pid, signal.SIGTERM)
|
||||||
|
except ProcessLookupError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def _exit_if_stopped() -> None:
|
||||||
|
if _stop_requested:
|
||||||
|
print(
|
||||||
|
"Interrupted. Progress saved; the next run with --auto-resume continues here.",
|
||||||
|
flush=True,
|
||||||
|
)
|
||||||
|
raise SystemExit(143)
|
||||||
|
|
||||||
|
|
||||||
|
def run_command(command: str, cwd: str | None = None, log=None) -> None:
|
||||||
|
"""Run a stage in its own process group; stream output to stdout and the log file."""
|
||||||
|
global _active_process
|
||||||
|
_exit_if_stopped()
|
||||||
|
process = subprocess.Popen(
|
||||||
|
command,
|
||||||
|
shell=True,
|
||||||
|
cwd=cwd,
|
||||||
|
text=True,
|
||||||
|
encoding="utf-8",
|
||||||
|
errors="replace",
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
bufsize=1,
|
||||||
|
start_new_session=True,
|
||||||
|
)
|
||||||
|
_active_process = process
|
||||||
|
try:
|
||||||
|
if _stop_requested: # signal arrived between Popen and the assignment above
|
||||||
|
try:
|
||||||
|
os.killpg(process.pid, signal.SIGTERM)
|
||||||
|
except ProcessLookupError:
|
||||||
|
pass
|
||||||
|
for line in process.stdout:
|
||||||
|
sys.stdout.write(line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
if log is not None:
|
||||||
|
log.write(line)
|
||||||
|
log.flush()
|
||||||
|
return_code = process.wait()
|
||||||
|
finally:
|
||||||
|
_active_process = None
|
||||||
|
if return_code != 0:
|
||||||
|
_exit_if_stopped() # a non-zero exit caused by our stop is not a failure
|
||||||
|
raise subprocess.CalledProcessError(return_code, command)
|
||||||
|
|
||||||
|
|
||||||
|
def _write_state(path: str, state: dict) -> None:
|
||||||
|
directory = os.path.dirname(path)
|
||||||
|
with tempfile.NamedTemporaryFile(
|
||||||
|
mode="w", encoding="utf-8", dir=directory, delete=False
|
||||||
|
) as handle:
|
||||||
|
json.dump(state, handle, indent=2)
|
||||||
|
handle.write("\n")
|
||||||
|
handle.flush()
|
||||||
|
os.fsync(handle.fileno())
|
||||||
|
temporary_path = handle.name
|
||||||
|
os.replace(temporary_path, path)
|
||||||
|
|
||||||
|
|
||||||
|
def _read_state(path: str) -> dict | None:
|
||||||
|
try:
|
||||||
|
with open(path, encoding="utf-8") as handle:
|
||||||
|
state = json.load(handle)
|
||||||
|
except (OSError, ValueError):
|
||||||
|
return None
|
||||||
|
return state if isinstance(state, dict) else None
|
||||||
|
|
||||||
|
|
||||||
|
def _new_state(signature: dict) -> dict:
|
||||||
|
return {"done": [], "completed": False, "signature": signature}
|
||||||
|
|
||||||
|
|
||||||
|
def _prepare_run(
|
||||||
|
config: dict, entity_name: str, signature: dict, fresh: bool, auto_resume: bool
|
||||||
|
) -> tuple[str, dict]:
|
||||||
|
"""Return (run folder, state).
|
||||||
|
|
||||||
|
--fresh wipe the entity's run folder and start over.
|
||||||
|
--auto-resume continue the existing run without deleting data,
|
||||||
|
regardless of its signature or completion status.
|
||||||
|
neither keep existing data (so --skip-crawl and
|
||||||
|
--skip-entity-generation still work) and start a new state.
|
||||||
|
"""
|
||||||
|
if fresh:
|
||||||
|
print(f"Removing all generated data for entity '{entity_name}'...")
|
||||||
|
return reset_entity_run(config, entity_name), _new_state(signature)
|
||||||
|
|
||||||
|
entity_run_dir = resolve_path(
|
||||||
|
config, os.path.join(config.get("runs_dir", "runs"), entity_name)
|
||||||
|
)
|
||||||
|
if os.path.isdir(entity_run_dir):
|
||||||
|
with os.scandir(entity_run_dir) as entries:
|
||||||
|
has_previous_data = any(entries)
|
||||||
|
else:
|
||||||
|
has_previous_data = False
|
||||||
|
entity_run_dir = run_dir(config, entity_name)
|
||||||
|
if auto_resume:
|
||||||
|
state = _read_state(os.path.join(entity_run_dir, "pipeline_state.json"))
|
||||||
|
if state is not None and isinstance(state.get("done"), list):
|
||||||
|
if state.get("completed"):
|
||||||
|
print("Previous run completed. Starting a new run.")
|
||||||
|
return reset_entity_run(config, entity_name), _new_state(signature)
|
||||||
|
if state.get("signature") != signature:
|
||||||
|
print("Warning: flags differ from the interrupted run; resuming anyway.")
|
||||||
|
print(f"Resuming. Completed steps: {', '.join(state['done']) or 'none'}")
|
||||||
|
return entity_run_dir, state
|
||||||
|
if has_previous_data:
|
||||||
|
print("No pipeline state found. Continuing with existing data.")
|
||||||
|
else:
|
||||||
|
print("No previous data found. Starting fresh.")
|
||||||
|
return entity_run_dir, _new_state(signature)
|
||||||
|
|
||||||
|
return entity_run_dir, _new_state(signature)
|
||||||
|
|
||||||
|
|
||||||
|
def _run_step(
|
||||||
|
name: str,
|
||||||
|
state: dict,
|
||||||
|
state_path: str,
|
||||||
|
command: str,
|
||||||
|
cwd: str,
|
||||||
|
log,
|
||||||
|
) -> None:
|
||||||
|
if name in state["done"]:
|
||||||
|
print(f"Skipping '{name}' (already done).")
|
||||||
|
return
|
||||||
|
print(f"Running {name}...", flush=True)
|
||||||
|
try:
|
||||||
|
run_command(command, cwd=cwd, log=log)
|
||||||
|
except subprocess.CalledProcessError as error:
|
||||||
|
print(f"Step '{name}' failed with exit code {error.returncode}.", flush=True)
|
||||||
|
raise
|
||||||
|
state["done"].append(name)
|
||||||
|
_write_state(state_path, state)
|
||||||
|
_exit_if_stopped()
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Run the full organization-crawling pipeline for one entity."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--skip-entity-generation",
|
||||||
|
action="store_true",
|
||||||
|
help="Skip generation of runs/<entity>/entities.json and reuse an existing seed file",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--entity", required=True, help="Entity name as defined in pipeline_config.json"
|
||||||
|
)
|
||||||
|
parser.add_argument("--config", default=None, help="Path to pipeline_config.json")
|
||||||
|
parser.add_argument(
|
||||||
|
"--fresh",
|
||||||
|
action="store_true",
|
||||||
|
help="Wipe this entity's run folder before starting",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--auto-resume",
|
||||||
|
action="store_true",
|
||||||
|
help="Resume an unfinished run with the same pipeline signature",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--skip-crawl",
|
||||||
|
action="store_true",
|
||||||
|
help="Skip the Scrapy crawl step (reuse an existing warc/ directory)",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--crawl-limit",
|
||||||
|
type=int,
|
||||||
|
default=None,
|
||||||
|
help="Stop the Scrapy crawl gracefully after about N pages (smoke test)",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--upload-limit",
|
||||||
|
type=int,
|
||||||
|
default=None,
|
||||||
|
help="Only upload the first N pages to Elasticsearch",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
for signum in (signal.SIGTERM, signal.SIGINT):
|
||||||
|
signal.signal(signum, _handle_stop_signal)
|
||||||
|
|
||||||
|
start_time = time.time()
|
||||||
|
base_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
config_path = os.path.abspath(
|
||||||
|
args.config or os.path.join(base_dir, "pipeline_config.json")
|
||||||
|
)
|
||||||
|
config = load_config(config_path)
|
||||||
|
entity = get_entity(config, args.entity)
|
||||||
|
|
||||||
|
signature = {
|
||||||
|
"entity": args.entity,
|
||||||
|
"upload_limit": args.upload_limit,
|
||||||
|
"crawl_limit": args.crawl_limit,
|
||||||
|
}
|
||||||
|
entity_run_dir, state = _prepare_run(
|
||||||
|
config, args.entity, signature, args.fresh, args.auto_resume
|
||||||
|
)
|
||||||
|
state_path = os.path.join(entity_run_dir, "pipeline_state.json")
|
||||||
|
_write_state(state_path, state)
|
||||||
|
|
||||||
|
out_dir = os.path.join(entity_run_dir, "out")
|
||||||
|
entity_warc_dir = warc_dir(config, args.entity)
|
||||||
|
entity_crawl_state_dir = crawl_state_dir(config, args.entity)
|
||||||
|
warc_directory = os.path.join(entity_run_dir, "warc")
|
||||||
|
common_args = f'--entity {args.entity} --config "{config_path}"'
|
||||||
|
|
||||||
|
with open(os.path.join(entity_run_dir, "pipeline.log"), "a", encoding="utf-8") as log:
|
||||||
|
if "entities" not in state["done"]:
|
||||||
|
if not args.skip_entity_generation:
|
||||||
|
_run_step(
|
||||||
|
"entities",
|
||||||
|
state,
|
||||||
|
state_path,
|
||||||
|
f"{sys.executable} generate_entities.py {common_args}",
|
||||||
|
base_dir,
|
||||||
|
log,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
seed_file = generated_entities_path(config, args.entity)
|
||||||
|
if not os.path.exists(seed_file):
|
||||||
|
raise SystemExit(
|
||||||
|
f"--skip-entity-generation was requested but seed file is missing: {seed_file}"
|
||||||
|
)
|
||||||
|
state["done"].append("entities")
|
||||||
|
_write_state(state_path, state)
|
||||||
|
|
||||||
|
if "crawl" not in state["done"]:
|
||||||
|
if not args.skip_crawl:
|
||||||
|
crawl = entity.get("crawl", {})
|
||||||
|
depth_limit = crawl.get("depth_limit", 6)
|
||||||
|
warc_config_path = os.path.join(entity_run_dir, "warc.yml")
|
||||||
|
with open(warc_config_path, "w", encoding="utf-8") as handle:
|
||||||
|
json.dump(
|
||||||
|
{
|
||||||
|
"warc_spec": "https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.0/",
|
||||||
|
"max_warc_size": 5000000000,
|
||||||
|
"collection": args.entity,
|
||||||
|
"description": f"A crawl of {entity.get('display_name', args.entity)}",
|
||||||
|
"operator": crawl.get("operator", "unknown"),
|
||||||
|
"robots": "obey",
|
||||||
|
"user_agent": crawl.get("user_agent", "inse-crawler"),
|
||||||
|
"warc_prefix": f"{args.entity}_depth{depth_limit}",
|
||||||
|
"warc_dest": entity_warc_dir,
|
||||||
|
},
|
||||||
|
handle,
|
||||||
|
indent=2,
|
||||||
|
)
|
||||||
|
crawl_limit_flag = (
|
||||||
|
f" -s CLOSESPIDER_PAGECOUNT={args.crawl_limit}"
|
||||||
|
if args.crawl_limit is not None
|
||||||
|
else ""
|
||||||
|
)
|
||||||
|
_run_step(
|
||||||
|
"crawl",
|
||||||
|
state,
|
||||||
|
state_path,
|
||||||
|
f'SCRAPY_WARCIO_SETTINGS="{warc_config_path}" scrapy crawl organization '
|
||||||
|
f'-a entity="{args.entity}" -a config="{config_path}" '
|
||||||
|
f'-s JOBDIR="{entity_crawl_state_dir}" -s LOG_LEVEL=INFO'
|
||||||
|
f"{crawl_limit_flag}",
|
||||||
|
resolve_path(config, entity["crawler_dir"]),
|
||||||
|
log,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
if not os.path.isdir(entity_warc_dir) or not os.listdir(entity_warc_dir):
|
||||||
|
raise SystemExit(
|
||||||
|
f"--skip-crawl was requested but no WARC files exist in {entity_warc_dir}"
|
||||||
|
)
|
||||||
|
state["done"].append("crawl")
|
||||||
|
_write_state(state_path, state)
|
||||||
|
|
||||||
|
limit_flag = f" --limit {args.upload_limit}" if args.upload_limit is not None else ""
|
||||||
|
steps = (
|
||||||
|
(
|
||||||
|
"redirections",
|
||||||
|
f"{sys.executable} 00_redirections/0_get_redirections.py {warc_directory} {common_args}",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"upload",
|
||||||
|
f"{sys.executable} 01_upload/1_upload_pages.py {warc_directory} "
|
||||||
|
f"{os.path.join(out_dir, entity['output']['redirections_file'])} {common_args}{limit_flag}",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"hierarchy",
|
||||||
|
f"{sys.executable} 02_hierarchy/create_hierarchy.py {common_args}",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"classify",
|
||||||
|
f"{sys.executable} 03_url_classifier/links_classifier.py {common_args}",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"extract",
|
||||||
|
f"{sys.executable} 04_content_extractor/content_extractor_pydantic.py {common_args}",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"keywords",
|
||||||
|
f"{sys.executable} 05_keyword_extraction/extract_content_keywords.py {common_args}",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
for name, command in steps:
|
||||||
|
_run_step(name, state, state_path, command, base_dir, log)
|
||||||
|
|
||||||
|
state["completed"] = True
|
||||||
|
_write_state(state_path, state)
|
||||||
|
# Scrapy's JOBDIR remembers every seen URL; keeping it would make the next crawl fetch nothing.
|
||||||
|
crawl_state = os.path.join(entity_run_dir, "crawl-state")
|
||||||
|
if os.path.isdir(crawl_state):
|
||||||
|
shutil.rmtree(crawl_state)
|
||||||
|
|
||||||
|
runtime_hours = (time.time() - start_time) / 3600
|
||||||
|
print(f"Final runtime: {runtime_hours:.2f} hours")
|
||||||
|
print(f"Finished running the '{args.entity}' organization pipeline.")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
raise SystemExit(main())
|
||||||
|
except subprocess.CalledProcessError as error:
|
||||||
|
raise SystemExit(error.returncode)
|
||||||
@@ -752,7 +752,7 @@ One doc per focal author, `_id = <institution>_<author>` (same scheme as scores)
|
|||||||
|
|
||||||
| field | content |
|
| field | content |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `nodes[]` | `{id, name, role, inst, active_years, suspicious}`; role ∈ ego / mentee / cohort / industry / external |
|
| `nodes[]` | `{id, name, role, inst, active_years, suspicious, company_insts?}`; role ∈ ego / mentee / cohort / industry / external |
|
||||||
| `edges[]` | `{a, b, w, n_works, cross, first_year, last_year}` — `w` = decayed tie strength, `cross` = mostly cross-institution |
|
| `edges[]` | `{a, b, w, n_works, cross, first_year, last_year}` — `w` = decayed tie strength, `cross` = mostly cross-institution |
|
||||||
| `ego{}` | header duplicate (bucket, tags, sub_scores, max_sub_score) so a network endpoint renders standalone |
|
| `ego{}` | header duplicate (bucket, tags, sub_scores, max_sub_score) so a network endpoint renders standalone |
|
||||||
| totals | `total_coauthors`, `cohort_coauthors`, `mentee_count`, `shown`, `shown_mentees` |
|
| totals | `total_coauthors`, `cohort_coauthors`, `mentee_count`, `shown`, `shown_mentees` |
|
||||||
@@ -765,6 +765,16 @@ the mentor score is about. Positions are NOT stored: the webapp's echarts `graph
|
|||||||
series (force layout) lays out at render time; map role → color, active_years →
|
series (force layout) lays out at render time; map role → color, active_years →
|
||||||
symbol size, `cross` → dashed line.
|
symbol size, `cross` → dashed line.
|
||||||
|
|
||||||
|
Role semantics (fixed 2026-08-29): `industry` is **ego-relative** — the node holds a
|
||||||
|
company-typed affiliation on a work **shared with this ego**, and those company
|
||||||
|
names are on the node as `company_insts` (present on any role: a mentee or cohort
|
||||||
|
member with a company link keeps their role but still carries the names, and the
|
||||||
|
ego's own company affiliations appear on the ego node). The previous global
|
||||||
|
"has a company affiliation anywhere in the corpus" flag mislabeled people whose
|
||||||
|
industry ties had nothing to do with the ego (audited: 2 of 6 industry nodes in
|
||||||
|
I62318514_A5113304257). `inst` is the person's **most frequent** affiliation across
|
||||||
|
their works, not first-seen. Focal cohort members are never `industry`.
|
||||||
|
|
||||||
`nodes`/`edges` are mapped `"enabled": false` (stored, never indexed) — the index
|
`nodes`/`edges` are mapped `"enabled": false` (stored, never indexed) — the index
|
||||||
stays small and fast for the queryable header fields (`institution_id`, `author_id`,
|
stays small and fast for the queryable header fields (`institution_id`, `author_id`,
|
||||||
`ego.tags`, `computed_at`, …). Skip building with `--no-network`.
|
`ego.tags`, `computed_at`, …). Skip building with `--no-network`.
|
||||||
|
|||||||
@@ -32,7 +32,10 @@ from service.scripts.profiling.multipliers.founding import (
|
|||||||
from service.scripts.profiling.multipliers.graph import build_graph, short_id
|
from service.scripts.profiling.multipliers.graph import build_graph, short_id
|
||||||
from service.scripts.profiling.multipliers.index import NETWORK_MAPPING, NETWORKS_INDEX, MultiplicatorsIndexClient
|
from service.scripts.profiling.multipliers.index import NETWORK_MAPPING, NETWORKS_INDEX, MultiplicatorsIndexClient
|
||||||
from service.scripts.profiling.multipliers.metrics import compute_all_metrics, incident_edges
|
from service.scripts.profiling.multipliers.metrics import compute_all_metrics, incident_edges
|
||||||
from service.scripts.profiling.multipliers.networks import build_network_docs
|
from service.scripts.profiling.multipliers.networks import (
|
||||||
|
build_network_docs,
|
||||||
|
collect_author_context,
|
||||||
|
)
|
||||||
from service.scripts.profiling.multipliers.scoring import load_config, score_rows
|
from service.scripts.profiling.multipliers.scoring import load_config, score_rows
|
||||||
from service.scripts.profiling.multipliers.signals import (
|
from service.scripts.profiling.multipliers.signals import (
|
||||||
cached_author_patent_profiles,
|
cached_author_patent_profiles,
|
||||||
@@ -100,24 +103,14 @@ def main() -> None:
|
|||||||
f"({timings['load_cache_s']}s)")
|
f"({timings['load_cache_s']}s)")
|
||||||
|
|
||||||
# ---- single pass over works before they are freed: DOIs (CORDIS join) +
|
# ---- single pass over works before they are freed: DOIs (CORDIS join) +
|
||||||
# per-author institution label and company flag (network docs) ----
|
# per-author institution label and ego-relative company links (network docs)
|
||||||
focal_short_ids = {short_id(a) for a in focal_ids}
|
focal_short_ids = {short_id(a) for a in focal_ids}
|
||||||
dois_by_author: dict[str, set[str]] = {}
|
dois_by_author, inst_by_author, company_links = collect_author_context(
|
||||||
inst_by_author: dict[str, str] = {}
|
works,
|
||||||
company_authors: set[str] = set()
|
focal_short_ids,
|
||||||
for w in works:
|
max_authors_per_work=config["extraction"]["max_authors_per_work"],
|
||||||
doi = normalize_doi(w.get("doi"))
|
doi_normalizer=normalize_doi,
|
||||||
for a in w.get("authorships") or []:
|
)
|
||||||
aid = short_id((a.get("author") or {}).get("id"))
|
|
||||||
if not aid:
|
|
||||||
continue
|
|
||||||
if doi and aid in focal_short_ids:
|
|
||||||
dois_by_author.setdefault(aid, set()).add(doi)
|
|
||||||
for inst in a.get("institutions") or []:
|
|
||||||
if aid not in inst_by_author and inst.get("display_name"):
|
|
||||||
inst_by_author[aid] = inst["display_name"]
|
|
||||||
if inst.get("type") == "company":
|
|
||||||
company_authors.add(aid)
|
|
||||||
|
|
||||||
# ---- founder-model publication/grant features (works still in memory) ----
|
# ---- founder-model publication/grant features (works still in memory) ----
|
||||||
pub_features: dict = {}
|
pub_features: dict = {}
|
||||||
@@ -286,7 +279,7 @@ def main() -> None:
|
|||||||
scored,
|
scored,
|
||||||
incident_edges(graph),
|
incident_edges(graph),
|
||||||
inst_by_author,
|
inst_by_author,
|
||||||
company_authors,
|
company_links,
|
||||||
max_nodes=int(network_cfg.get("max_nodes", 42)),
|
max_nodes=int(network_cfg.get("max_nodes", 42)),
|
||||||
max_forced_mentees=int(network_cfg.get("max_forced_mentees", 14)),
|
max_forced_mentees=int(network_cfg.get("max_forced_mentees", 14)),
|
||||||
)
|
)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -11,22 +11,93 @@ visualization index".
|
|||||||
Node selection forces up to `max_forced_mentees` mentees in before the
|
Node selection forces up to `max_forced_mentees` mentees in before the
|
||||||
top-by-weight cut: mentee ties are decayed and team-size-divided, so a pure
|
top-by-weight cut: mentee ties are decayed and team-size-divided, so a pure
|
||||||
top-N hides exactly the people the mentor score is about.
|
top-N hides exactly the people the mentor score is about.
|
||||||
|
|
||||||
|
The `industry` role is EGO-RELATIVE: a node is industry in this ego's network
|
||||||
|
only if it has a company-typed affiliation on a work SHARED with the ego, and
|
||||||
|
those company names are stored on the node as `company_insts`. A global
|
||||||
|
"has a company affiliation anywhere in the corpus" flag mislabels people whose
|
||||||
|
industry ties have nothing to do with this ego (measured: 2 of 6 industry
|
||||||
|
nodes in the first audited network).
|
||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any, Callable
|
||||||
|
|
||||||
from service.scripts.profiling.multipliers.graph import Graph
|
from service.scripts.profiling.multipliers.graph import Graph, short_id
|
||||||
from service.scripts.profiling.multipliers.metrics import is_suspicious_profile
|
from service.scripts.profiling.multipliers.metrics import is_suspicious_profile
|
||||||
|
|
||||||
|
|
||||||
|
def collect_author_context(
|
||||||
|
works: list[dict[str, Any]],
|
||||||
|
focal_short_ids: set[str],
|
||||||
|
max_authors_per_work: int = 50,
|
||||||
|
doi_normalizer: Callable[[str | None], str | None] | None = None,
|
||||||
|
) -> tuple[dict[str, set[str]], dict[str, str], dict[str, dict[str, set[str]]]]:
|
||||||
|
"""One pass over the work extract -> (dois_by_author, inst_by_author, company_links).
|
||||||
|
|
||||||
|
dois_by_author focal author -> their work DOIs (CORDIS join); only
|
||||||
|
collected when `doi_normalizer` is given.
|
||||||
|
inst_by_author author -> their MOST FREQUENT institution display name
|
||||||
|
across all their works (ties break lexicographically).
|
||||||
|
First-seen selection showed minority affiliations.
|
||||||
|
company_links focal ego -> {co-author -> company display names}, from
|
||||||
|
company-typed affiliations the co-author holds ON WORKS
|
||||||
|
SHARED with that ego. An ego's own company affiliations
|
||||||
|
land under their own id. Works above
|
||||||
|
`max_authors_per_work` are excluded, mirroring the graph's
|
||||||
|
hyperauthorship cap — consortium papers are not
|
||||||
|
collaboration evidence.
|
||||||
|
"""
|
||||||
|
dois_by_author: dict[str, set[str]] = {}
|
||||||
|
inst_counts: dict[str, dict[str, int]] = {}
|
||||||
|
company_links: dict[str, dict[str, set[str]]] = {}
|
||||||
|
|
||||||
|
for w in works:
|
||||||
|
doi = doi_normalizer(w.get("doi")) if doi_normalizer else None
|
||||||
|
seen: set[str] = set()
|
||||||
|
focal_on_work: list[str] = []
|
||||||
|
company_on_work: list[tuple[str, set[str]]] = []
|
||||||
|
for a in w.get("authorships") or []:
|
||||||
|
aid = short_id((a.get("author") or {}).get("id"))
|
||||||
|
if not aid or aid in seen:
|
||||||
|
continue
|
||||||
|
seen.add(aid)
|
||||||
|
if aid in focal_short_ids:
|
||||||
|
focal_on_work.append(aid)
|
||||||
|
if doi:
|
||||||
|
dois_by_author.setdefault(aid, set()).add(doi)
|
||||||
|
companies: set[str] = set()
|
||||||
|
for inst in a.get("institutions") or []:
|
||||||
|
name = inst.get("display_name")
|
||||||
|
if not name:
|
||||||
|
continue
|
||||||
|
counts = inst_counts.setdefault(aid, {})
|
||||||
|
counts[name] = counts.get(name, 0) + 1
|
||||||
|
if inst.get("type") == "company":
|
||||||
|
companies.add(name)
|
||||||
|
if companies:
|
||||||
|
company_on_work.append((aid, companies))
|
||||||
|
|
||||||
|
if company_on_work and 2 <= len(seen) <= max_authors_per_work:
|
||||||
|
for ego in focal_on_work:
|
||||||
|
links = company_links.setdefault(ego, {})
|
||||||
|
for aid, companies in company_on_work:
|
||||||
|
links.setdefault(aid, set()).update(companies)
|
||||||
|
|
||||||
|
inst_by_author = {
|
||||||
|
aid: max(counts.items(), key=lambda kv: (kv[1], kv[0]))[0]
|
||||||
|
for aid, counts in inst_counts.items()
|
||||||
|
}
|
||||||
|
return dois_by_author, inst_by_author, company_links
|
||||||
|
|
||||||
|
|
||||||
def build_network_docs(
|
def build_network_docs(
|
||||||
graph: Graph,
|
graph: Graph,
|
||||||
metric_rows: dict[str, dict[str, Any]],
|
metric_rows: dict[str, dict[str, Any]],
|
||||||
scored_rows: list[dict[str, Any]],
|
scored_rows: list[dict[str, Any]],
|
||||||
incident: dict[str, list],
|
incident: dict[str, list],
|
||||||
inst_by_author: dict[str, str],
|
inst_by_author: dict[str, str],
|
||||||
company_authors: set[str],
|
company_links: dict[str, dict[str, set[str]]],
|
||||||
max_nodes: int = 42,
|
max_nodes: int = 42,
|
||||||
max_forced_mentees: int = 14,
|
max_forced_mentees: int = 14,
|
||||||
) -> list[dict[str, Any]]:
|
) -> list[dict[str, Any]]:
|
||||||
@@ -34,6 +105,7 @@ def build_network_docs(
|
|||||||
|
|
||||||
metric_rows must still carry the FULL `junior_ids` (pre-scoring; the scored
|
metric_rows must still carry the FULL `junior_ids` (pre-scoring; the scored
|
||||||
rows' evidence list is capped). scored_rows supply the ego header fields.
|
rows' evidence list is capped). scored_rows supply the ego header fields.
|
||||||
|
`company_links` comes from `collect_author_context`.
|
||||||
"""
|
"""
|
||||||
scored_by_id = {r["author_id"]: r for r in scored_rows}
|
scored_by_id = {r["author_id"]: r for r in scored_rows}
|
||||||
docs: list[dict[str, Any]] = []
|
docs: list[dict[str, Any]] = []
|
||||||
@@ -51,8 +123,8 @@ def build_network_docs(
|
|||||||
forced = set(mentee_picks)
|
forced = set(mentee_picks)
|
||||||
others = [n for n, _ in ranked if n not in forced]
|
others = [n for n, _ in ranked if n not in forced]
|
||||||
selected = [ego_id] + mentee_picks + others[: max_nodes - len(mentee_picks)]
|
selected = [ego_id] + mentee_picks + others[: max_nodes - len(mentee_picks)]
|
||||||
idset = set(selected)
|
|
||||||
|
|
||||||
|
ego_company = company_links.get(ego_id, {})
|
||||||
nodes = []
|
nodes = []
|
||||||
for nid in selected:
|
for nid in selected:
|
||||||
node = graph.nodes[nid]
|
node = graph.nodes[nid]
|
||||||
@@ -60,22 +132,25 @@ def build_network_docs(
|
|||||||
role = "ego"
|
role = "ego"
|
||||||
elif nid in mentees:
|
elif nid in mentees:
|
||||||
role = "mentee"
|
role = "mentee"
|
||||||
elif nid in company_authors and not node.is_focal:
|
elif nid in ego_company and not node.is_focal:
|
||||||
role = "industry"
|
role = "industry"
|
||||||
elif node.is_focal:
|
elif node.is_focal:
|
||||||
role = "cohort"
|
role = "cohort"
|
||||||
else:
|
else:
|
||||||
role = "external"
|
role = "external"
|
||||||
nodes.append(
|
node_doc = {
|
||||||
{
|
"id": nid,
|
||||||
"id": nid,
|
"name": node.display_name,
|
||||||
"name": node.display_name,
|
"role": role,
|
||||||
"role": role,
|
"inst": inst_by_author.get(nid, ""),
|
||||||
"inst": inst_by_author.get(nid, ""),
|
"active_years": len(node.publication_years),
|
||||||
"active_years": len(node.publication_years),
|
"suspicious": is_suspicious_profile(node.publication_years),
|
||||||
"suspicious": is_suspicious_profile(node.publication_years),
|
}
|
||||||
}
|
# which companies connect this person to the ego (present on every
|
||||||
)
|
# role — a mentee or cohort member can hold a company link too)
|
||||||
|
if nid in ego_company:
|
||||||
|
node_doc["company_insts"] = sorted(ego_company[nid])
|
||||||
|
nodes.append(node_doc)
|
||||||
|
|
||||||
# pair lookups against the edge dict (~900 per ego), NOT a scan of
|
# pair lookups against the edge dict (~900 per ego), NOT a scan of
|
||||||
# the 5.8M-edge dict per ego
|
# the 5.8M-edge dict per ego
|
||||||
|
|||||||
@@ -0,0 +1,140 @@
|
|||||||
|
"""Tests for the ego-network docs: ego-relative industry roles and company links.
|
||||||
|
|
||||||
|
Regression background (audit of I62318514_A5113304257): the old global
|
||||||
|
"has a company affiliation anywhere in the corpus" flag marked 2 of 6 industry
|
||||||
|
nodes whose company ties were on works NOT shared with the ego, and the
|
||||||
|
first-seen `inst` label showed minority affiliations.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from service.scripts.profiling.multipliers.graph import build_graph
|
||||||
|
from service.scripts.profiling.multipliers.metrics import incident_edges
|
||||||
|
from service.scripts.profiling.multipliers.networks import (
|
||||||
|
build_network_docs,
|
||||||
|
collect_author_context,
|
||||||
|
)
|
||||||
|
|
||||||
|
EGO, OTHER_EGO, COHORT, MENTEE = "E1", "F1", "C1", "M1"
|
||||||
|
FOCAL = {EGO, OTHER_EGO, COHORT, MENTEE}
|
||||||
|
X_SHARED_COMPANY = "X1" # company affiliation on a work shared with EGO
|
||||||
|
Y_ELSEWHERE_COMPANY = "Y1" # company affiliation only on a work NOT shared with EGO
|
||||||
|
|
||||||
|
|
||||||
|
def make_work(wid, authors, year=2024, doi=None):
|
||||||
|
"""authors: list of (author_id, [(inst_name, inst_type), ...])."""
|
||||||
|
return {
|
||||||
|
"id": f"https://openalex.org/{wid}",
|
||||||
|
"publication_year": year,
|
||||||
|
"doi": doi,
|
||||||
|
"authorships": [
|
||||||
|
{
|
||||||
|
"author": {"id": aid, "display_name": aid},
|
||||||
|
"institutions": [
|
||||||
|
{"id": f"I_{name}", "display_name": name, "type": typ}
|
||||||
|
for name, typ in insts
|
||||||
|
],
|
||||||
|
}
|
||||||
|
for aid, insts in authors
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def fixture_works():
|
||||||
|
return [
|
||||||
|
# shared with EGO: X and the ego itself carry company affiliations here,
|
||||||
|
# the mentee and a cohort member too (role precedence must still win)
|
||||||
|
make_work(
|
||||||
|
"W1",
|
||||||
|
[
|
||||||
|
(EGO, [("EgoCo", "company"), ("UDE", "education")]),
|
||||||
|
(X_SHARED_COMPANY, [("Acme Corp", "company"), ("Uni A", "education")]),
|
||||||
|
(MENTEE, [("UDE", "education"), ("MenteeCo", "company")]),
|
||||||
|
(COHORT, [("UDE", "education"), ("Gamma AG", "company")]),
|
||||||
|
],
|
||||||
|
doi="https://doi.org/10.1/w1",
|
||||||
|
),
|
||||||
|
# shared with EGO, but Y has no company affiliation on it
|
||||||
|
make_work("W2", [(EGO, [("UDE", "education")]), (Y_ELSEWHERE_COMPANY, [("Uni B", "education")])]),
|
||||||
|
# Y's company affiliation lives on a work shared with OTHER_EGO only
|
||||||
|
make_work(
|
||||||
|
"W3",
|
||||||
|
[
|
||||||
|
(OTHER_EGO, [("UDE", "education")]),
|
||||||
|
(Y_ELSEWHERE_COMPANY, [("Beta GmbH", "company"), ("Uni B", "education")]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def test_company_links_are_ego_relative():
|
||||||
|
_, _, links = collect_author_context(fixture_works(), FOCAL)
|
||||||
|
# X's company tie is on a work shared with EGO; Y's is not
|
||||||
|
assert links[EGO][X_SHARED_COMPANY] == {"Acme Corp"}
|
||||||
|
assert Y_ELSEWHERE_COMPANY not in links[EGO]
|
||||||
|
# ...but it IS a company link for the ego whose work carries it
|
||||||
|
assert links[OTHER_EGO][Y_ELSEWHERE_COMPANY] == {"Beta GmbH"}
|
||||||
|
# the ego's own company affiliation lands under their own id
|
||||||
|
assert links[EGO][EGO] == {"EgoCo"}
|
||||||
|
|
||||||
|
|
||||||
|
def test_company_links_respect_the_hyperauthorship_cap():
|
||||||
|
crowd = [(f"D{i}", [("UDE", "education")]) for i in range(60)]
|
||||||
|
big = make_work("W9", [(EGO, [("UDE", "education")]),
|
||||||
|
("Z1", [("Huge Inc", "company")])] + crowd)
|
||||||
|
_, _, links = collect_author_context([big], FOCAL, max_authors_per_work=50)
|
||||||
|
assert links == {}
|
||||||
|
|
||||||
|
|
||||||
|
def test_inst_label_is_the_modal_affiliation():
|
||||||
|
_, inst_by_author, _ = collect_author_context(fixture_works(), FOCAL)
|
||||||
|
# Y appears with "Uni B" on both works -> modal, not first-seen
|
||||||
|
assert inst_by_author[Y_ELSEWHERE_COMPANY] == "Uni B"
|
||||||
|
assert inst_by_author[COHORT] == "UDE"
|
||||||
|
|
||||||
|
|
||||||
|
def test_dois_collected_only_with_normalizer_and_only_for_focal():
|
||||||
|
dois, _, _ = collect_author_context(
|
||||||
|
fixture_works(), FOCAL, doi_normalizer=lambda d: d
|
||||||
|
)
|
||||||
|
assert EGO in dois and X_SHARED_COMPANY not in dois
|
||||||
|
no_dois, _, _ = collect_author_context(fixture_works(), FOCAL)
|
||||||
|
assert no_dois == {}
|
||||||
|
|
||||||
|
|
||||||
|
def _docs():
|
||||||
|
works = fixture_works()
|
||||||
|
graph = build_graph(works, FOCAL)
|
||||||
|
_, inst_by_author, company_links = collect_author_context(works, FOCAL)
|
||||||
|
metric_rows = {
|
||||||
|
EGO: {"junior_ids": [MENTEE]},
|
||||||
|
OTHER_EGO: {"junior_ids": []},
|
||||||
|
}
|
||||||
|
scored_rows = [{"author_id": EGO}, {"author_id": OTHER_EGO}]
|
||||||
|
docs = build_network_docs(
|
||||||
|
graph, metric_rows, scored_rows, incident_edges(graph),
|
||||||
|
inst_by_author, company_links,
|
||||||
|
)
|
||||||
|
return {d["author_id"]: {n["id"]: n for n in d["nodes"]} for d in docs}
|
||||||
|
|
||||||
|
|
||||||
|
def test_industry_role_requires_company_link_on_shared_works():
|
||||||
|
nodes = _docs()
|
||||||
|
ego_net, other_net = nodes[EGO], nodes[OTHER_EGO]
|
||||||
|
assert ego_net[X_SHARED_COMPANY]["role"] == "industry"
|
||||||
|
assert ego_net[X_SHARED_COMPANY]["company_insts"] == ["Acme Corp"]
|
||||||
|
# Y co-authored with EGO but their company tie is elsewhere -> external here
|
||||||
|
assert ego_net[Y_ELSEWHERE_COMPANY]["role"] == "external"
|
||||||
|
assert "company_insts" not in ego_net[Y_ELSEWHERE_COMPANY]
|
||||||
|
# ...and industry in the network the tie actually belongs to
|
||||||
|
assert other_net[Y_ELSEWHERE_COMPANY]["role"] == "industry"
|
||||||
|
assert other_net[Y_ELSEWHERE_COMPANY]["company_insts"] == ["Beta GmbH"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_role_precedence_keeps_mentee_cohort_and_ego_but_carries_company_insts():
|
||||||
|
ego_net = _docs()[EGO]
|
||||||
|
assert ego_net[MENTEE]["role"] == "mentee"
|
||||||
|
assert ego_net[MENTEE]["company_insts"] == ["MenteeCo"]
|
||||||
|
assert ego_net[COHORT]["role"] == "cohort" # focal members are never industry
|
||||||
|
assert ego_net[COHORT]["company_insts"] == ["Gamma AG"]
|
||||||
|
assert ego_net[EGO]["role"] == "ego"
|
||||||
|
assert ego_net[EGO]["company_insts"] == ["EgoCo"]
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# Upload verified UDE OrgMiner persons
|
||||||
|
|
||||||
|
Run from the repository root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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`](../jobs-image/README.md#ude-orgminer-verified-persons).
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
The script processes one organization at a time, so a run needs no concurrency
|
||||||
|
flags.
|
||||||
|
|
||||||
|
Useful options:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 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.
|
||||||
+911
@@ -0,0 +1,911 @@
|
|||||||
|
"""Upload UDE OrgMiner staff that were verified by the collaboration graph.
|
||||||
|
|
||||||
|
What this script does
|
||||||
|
---------------------
|
||||||
|
For every organization in the UDE organization-content index (one at a time):
|
||||||
|
|
||||||
|
1. READ the organization and its staff list from Elasticsearch (INSE)
|
||||||
|
2. VERIFY each staff member against the collaboration graph (OpenAlex)
|
||||||
|
3. BUILD one document per (organization, OpenAlex person)
|
||||||
|
4. UPLOAD the documents to ``orgminer_verified_persons_ude`` (bulk upsert)
|
||||||
|
5. CHECKPOINT the organization as done in a small JSON progress file
|
||||||
|
|
||||||
|
Everything runs sequentially: one organization at a time, one graph query at a
|
||||||
|
time.
|
||||||
|
|
||||||
|
Resumability
|
||||||
|
------------
|
||||||
|
Document IDs are deterministic, so re-running is always safe (documents are
|
||||||
|
overwritten, never duplicated). The progress file stores only:
|
||||||
|
|
||||||
|
* ``processed_org_doc_ids``: organizations that were fully uploaded.
|
||||||
|
* ``last_source_uri``: a cursor; every organization sorted before it is done.
|
||||||
|
|
||||||
|
The cursor stops advancing at the first failed organization, so failures are
|
||||||
|
retried on the next run.
|
||||||
|
|
||||||
|
Usage (from any directory):
|
||||||
|
python service/scripts/upload_orgminer_verified_persons_ude/upload_orgminer_verified_persons_ude.py
|
||||||
|
|
||||||
|
Requires the INSE and NES Elasticsearch credentials in the service's ``.env``
|
||||||
|
file or the environment. ``--dry-run`` verifies and counts without creating the
|
||||||
|
index, uploading, or touching the progress file.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import asyncio
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
from collections.abc import AsyncIterator, Awaitable, Callable, Iterable
|
||||||
|
from contextlib import aclosing
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
from datetime import UTC, datetime
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
SERVICE_DIR = Path(__file__).resolve().parents[2]
|
||||||
|
sys.path.insert(0, str(SERVICE_DIR / "src" / "main"))
|
||||||
|
|
||||||
|
from inse import config # noqa: E402
|
||||||
|
from inse.model import ESIndex # noqa: E402
|
||||||
|
from inse.orgminer import logic # noqa: E402
|
||||||
|
from inse.orgminer.institutions_helper import ( # noqa: E402
|
||||||
|
DEFAULT_INSTITUTION_ID,
|
||||||
|
normalize_org_uri,
|
||||||
|
)
|
||||||
|
|
||||||
|
T = TypeVar("T")
|
||||||
|
Hit = dict[str, Any] # one Elasticsearch search hit
|
||||||
|
HierarchyLookup = dict[str, tuple[str, list[str]]] # uri -> (name, path from root)
|
||||||
|
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Configuration
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
SOURCE_INDEX = ESIndex.UDE_ORGANIZATION_CONTENT.value
|
||||||
|
OUTPUT_INDEX = "orgminer_verified_persons_ude"
|
||||||
|
INSTITUTION_URL = f"https://openalex.org/{DEFAULT_INSTITUTION_ID}"
|
||||||
|
DEFAULT_PROGRESS_FILE = (
|
||||||
|
Path(__file__).resolve().parent / "orgminer_verified_persons_ude_progress.json"
|
||||||
|
)
|
||||||
|
PROGRESS_VERSION = 2
|
||||||
|
|
||||||
|
# Scanning the source index (point-in-time search, paged).
|
||||||
|
SCAN_PAGE_SIZE = 100
|
||||||
|
PIT_KEEP_ALIVE = "10m"
|
||||||
|
MAX_PIT_RESTARTS = 5
|
||||||
|
|
||||||
|
# Bulk uploads.
|
||||||
|
BULK_MAX_DOCS = 250
|
||||||
|
BULK_MAX_BYTES = 5 * 1024 * 1024
|
||||||
|
MAX_ATTEMPTS = 4
|
||||||
|
RETRYABLE_STATUS = {429, 502, 503, 504}
|
||||||
|
|
||||||
|
# Collab-graph queries per organization. Kept at 1: fully sequential.
|
||||||
|
GRAPH_QUERIES_AT_A_TIME = 1
|
||||||
|
|
||||||
|
PROGRESS_SAVE_INTERVAL_S = 5.0
|
||||||
|
PROGRESS_LOG_INTERVAL_S = 30.0
|
||||||
|
|
||||||
|
INDEX_MAPPING = {
|
||||||
|
"dynamic": "strict",
|
||||||
|
"properties": {
|
||||||
|
"name": {"type": "text", "fields": {"keyword": {"type": "keyword"}}},
|
||||||
|
"org_name": {"type": "text", "fields": {"keyword": {"type": "keyword"}}},
|
||||||
|
"org_uri": {"type": "keyword"},
|
||||||
|
"org_hierarchy_path": {"type": "keyword"},
|
||||||
|
"openalex_id": {"type": "keyword"},
|
||||||
|
# Kept verbatim in _source; staff dicts vary, so don't index them.
|
||||||
|
"staff": {"type": "object", "dynamic": False},
|
||||||
|
"staff_entries": {"type": "object", "dynamic": False},
|
||||||
|
"source_index": {"type": "keyword"},
|
||||||
|
"source_org_doc_id": {"type": "keyword"},
|
||||||
|
"verification_method": {"type": "keyword"},
|
||||||
|
"verification_evidence": {
|
||||||
|
"type": "nested",
|
||||||
|
"properties": {
|
||||||
|
"openalex_id": {"type": "keyword"},
|
||||||
|
"collaborator_openalex_id": {"type": "keyword"},
|
||||||
|
"shared_work_weight": {"type": "float"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"verified_at": {"type": "date"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format="%(asctime)s %(levelname)s %(name)s %(message)s",
|
||||||
|
)
|
||||||
|
logger = logging.getLogger("upload_orgminer_verified_persons_ude")
|
||||||
|
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Generic helpers
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
def backoff_delay(attempt: int) -> float:
|
||||||
|
return min(2.0**attempt, 30.0)
|
||||||
|
|
||||||
|
|
||||||
|
async def retry_async(
|
||||||
|
operation: Callable[[], Awaitable[T]],
|
||||||
|
*,
|
||||||
|
description: str,
|
||||||
|
attempts: int = MAX_ATTEMPTS,
|
||||||
|
) -> T:
|
||||||
|
"""Run ``operation``; on any exception wait (exponential backoff) and retry."""
|
||||||
|
for attempt in range(1, attempts + 1):
|
||||||
|
try:
|
||||||
|
return await operation()
|
||||||
|
except Exception as exc:
|
||||||
|
if attempt == attempts:
|
||||||
|
raise
|
||||||
|
logger.warning(
|
||||||
|
"%s failed (attempt %d/%d): %s. Retrying.",
|
||||||
|
description,
|
||||||
|
attempt,
|
||||||
|
attempts,
|
||||||
|
exc,
|
||||||
|
)
|
||||||
|
await asyncio.sleep(backoff_delay(attempt))
|
||||||
|
raise AssertionError("unreachable")
|
||||||
|
|
||||||
|
|
||||||
|
def require_es_credentials() -> tuple[str, str]:
|
||||||
|
"""Check both clusters are configured; return the INSE (url, api_key)."""
|
||||||
|
if (
|
||||||
|
not config.settings.elasticsearch_url
|
||||||
|
or not config.settings.elasticsearch_api_key
|
||||||
|
):
|
||||||
|
raise SystemExit(
|
||||||
|
"NES Elasticsearch credentials are missing. Collab-graph verification "
|
||||||
|
"needs ELASTICSEARCH_URL and ELASTICSEARCH_API_KEY."
|
||||||
|
)
|
||||||
|
url = config.settings.elasticsearch_inse_url
|
||||||
|
api_key = config.settings.elasticsearch_inse_api_key
|
||||||
|
if not url or not api_key:
|
||||||
|
raise SystemExit(
|
||||||
|
"INSE Elasticsearch credentials are missing. Set "
|
||||||
|
"ELASTICSEARCH_INSE_URL and ELASTICSEARCH_INSE_API_KEY in the "
|
||||||
|
"environment or service/src/main/inse/.env."
|
||||||
|
)
|
||||||
|
return url.rstrip("/"), api_key
|
||||||
|
|
||||||
|
|
||||||
|
def make_headers(api_key: str, content_type: str = "application/json") -> dict[str, str]:
|
||||||
|
return {"Authorization": f"ApiKey {api_key}", "Content-Type": content_type}
|
||||||
|
|
||||||
|
|
||||||
|
def checkpoint_dir_is_mounted(path: Path) -> bool | None:
|
||||||
|
"""Whether the checkpoint directory is a mount point (relevant in containers).
|
||||||
|
|
||||||
|
Returns ``None`` when the platform doesn't expose mount info (e.g. macOS).
|
||||||
|
"""
|
||||||
|
mountinfo = Path("/proc/self/mountinfo")
|
||||||
|
if not mountinfo.exists():
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
directory = str(path.parent.resolve())
|
||||||
|
lines = mountinfo.read_text(encoding="utf-8").splitlines()
|
||||||
|
except OSError:
|
||||||
|
return None
|
||||||
|
return any(
|
||||||
|
len(fields) > 4 and fields[4] == directory
|
||||||
|
for fields in (line.split() for line in lines)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Run statistics and progress checkpoint
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Stats:
|
||||||
|
scanned: int = 0
|
||||||
|
orgs_done: int = 0
|
||||||
|
orgs_failed: int = 0
|
||||||
|
person_docs: int = 0
|
||||||
|
uploaded: int = 0
|
||||||
|
doc_errors: int = 0
|
||||||
|
started: float = field(default_factory=time.monotonic)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def has_errors(self) -> bool:
|
||||||
|
return bool(self.orgs_failed or self.doc_errors)
|
||||||
|
|
||||||
|
def summary(self) -> str:
|
||||||
|
return (
|
||||||
|
f"scanned={self.scanned} orgs_done={self.orgs_done} "
|
||||||
|
f"orgs_failed={self.orgs_failed} person_docs={self.person_docs} "
|
||||||
|
f"uploaded={self.uploaded} doc_errors={self.doc_errors} "
|
||||||
|
f"elapsed={time.monotonic() - self.started:.0f}s"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Progress:
|
||||||
|
"""Checkpoint saved to a JSON file (at most every few seconds, and on exit)."""
|
||||||
|
|
||||||
|
path: Path
|
||||||
|
persist: bool # False in --dry-run: never write the file
|
||||||
|
processed_org_ids: set[str] = field(default_factory=set)
|
||||||
|
last_source_uri: str | None = None
|
||||||
|
_dirty: bool = False
|
||||||
|
_last_save: float = 0.0
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def load(cls, path: Path, *, persist: bool) -> Progress:
|
||||||
|
progress = cls(path=path, persist=persist)
|
||||||
|
if not path.exists():
|
||||||
|
return progress
|
||||||
|
try:
|
||||||
|
state = json.loads(path.read_text(encoding="utf-8"))
|
||||||
|
except (OSError, json.JSONDecodeError) as exc:
|
||||||
|
raise SystemExit(f"Could not read progress file {path}: {exc}") from exc
|
||||||
|
|
||||||
|
if (
|
||||||
|
state.get("source_index") != SOURCE_INDEX
|
||||||
|
or state.get("output_index") != OUTPUT_INDEX
|
||||||
|
):
|
||||||
|
raise SystemExit(
|
||||||
|
f"Progress file {path} belongs to a different source/output index. "
|
||||||
|
"Choose another --progress-file or move the old file."
|
||||||
|
)
|
||||||
|
progress.processed_org_ids = set(state.get("processed_org_doc_ids", []))
|
||||||
|
progress.last_source_uri = state.get("last_source_uri")
|
||||||
|
return progress
|
||||||
|
|
||||||
|
def reset(self) -> None:
|
||||||
|
self.processed_org_ids.clear()
|
||||||
|
self.last_source_uri = None
|
||||||
|
|
||||||
|
def mark_org_done(self, org_doc_id: str) -> None:
|
||||||
|
self.processed_org_ids.add(org_doc_id)
|
||||||
|
self._dirty = True
|
||||||
|
|
||||||
|
def advance_cursor(self, uri: str | None) -> None:
|
||||||
|
if uri and uri != self.last_source_uri:
|
||||||
|
self.last_source_uri = uri
|
||||||
|
self._dirty = True
|
||||||
|
|
||||||
|
def save(self, *, force: bool = False) -> None:
|
||||||
|
if not self.persist or not self._dirty:
|
||||||
|
return
|
||||||
|
now = time.monotonic()
|
||||||
|
if not force and now - self._last_save < PROGRESS_SAVE_INTERVAL_S:
|
||||||
|
return
|
||||||
|
state = {
|
||||||
|
"version": PROGRESS_VERSION,
|
||||||
|
"source_index": SOURCE_INDEX,
|
||||||
|
"output_index": OUTPUT_INDEX,
|
||||||
|
"processed_org_doc_ids": sorted(self.processed_org_ids),
|
||||||
|
"last_source_uri": self.last_source_uri,
|
||||||
|
"updated_at": datetime.now(UTC).isoformat(),
|
||||||
|
}
|
||||||
|
self.path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
tmp = self.path.with_suffix(self.path.suffix + ".tmp")
|
||||||
|
tmp.write_text(
|
||||||
|
json.dumps(state, ensure_ascii=False, indent=2, sort_keys=True) + "\n",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
os.replace(tmp, self.path) # atomic: never leaves a half-written file
|
||||||
|
self._dirty = False
|
||||||
|
self._last_save = now
|
||||||
|
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Step 1: READ organizations from the source index
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
class PitExpired(Exception):
|
||||||
|
"""The point-in-time search context is gone and must be reopened."""
|
||||||
|
|
||||||
|
|
||||||
|
def _scan_query(start_uri: str | None) -> dict[str, Any]:
|
||||||
|
if not start_uri:
|
||||||
|
return {"match_all": {}}
|
||||||
|
# Organizations without a URI sort first and can never satisfy a range
|
||||||
|
# filter, so include them explicitly; already-processed IDs are skipped later.
|
||||||
|
return {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"range": {"uri.keyword": {"gte": start_uri}}},
|
||||||
|
{"bool": {"must_not": {"exists": {"field": "uri.keyword"}}}},
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async def _scan_pages(
|
||||||
|
client: httpx.AsyncClient,
|
||||||
|
url: str,
|
||||||
|
headers: dict[str, str],
|
||||||
|
start_uri: str | None,
|
||||||
|
) -> AsyncIterator[list[Hit]]:
|
||||||
|
"""Open a point-in-time and yield pages of hits, sorted by URI."""
|
||||||
|
response = await client.post(
|
||||||
|
f"{url}/{SOURCE_INDEX}/_pit",
|
||||||
|
params={"keep_alive": PIT_KEEP_ALIVE},
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
pit_id = response.json()["id"]
|
||||||
|
search_after: list[Any] | None = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
payload: dict[str, Any] = {
|
||||||
|
"size": SCAN_PAGE_SIZE,
|
||||||
|
"query": _scan_query(start_uri),
|
||||||
|
"pit": {"id": pit_id, "keep_alive": PIT_KEEP_ALIVE},
|
||||||
|
"sort": [
|
||||||
|
{"uri.keyword": {"order": "asc", "missing": "_first"}},
|
||||||
|
{"_shard_doc": "asc"},
|
||||||
|
],
|
||||||
|
"track_total_hits": False,
|
||||||
|
"_source": ["uri", "staff", "name", "org_name", "organization_name"],
|
||||||
|
}
|
||||||
|
if search_after is not None:
|
||||||
|
payload["search_after"] = search_after
|
||||||
|
|
||||||
|
response = await client.post(f"{url}/_search", json=payload, headers=headers)
|
||||||
|
if response.status_code == 404 and "search_context_missing" in response.text:
|
||||||
|
raise PitExpired
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
result = response.json()
|
||||||
|
hits = result.get("hits", {}).get("hits", [])
|
||||||
|
if not hits:
|
||||||
|
return
|
||||||
|
|
||||||
|
pit_id = result.get("pit_id", pit_id)
|
||||||
|
search_after = hits[-1].get("sort")
|
||||||
|
yield hits
|
||||||
|
if search_after is None or len(hits) < SCAN_PAGE_SIZE:
|
||||||
|
return
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
await client.request(
|
||||||
|
"DELETE", f"{url}/_pit", json={"id": pit_id}, headers=headers
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.warning("Could not close the point-in-time.", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
|
async def scan_organizations(
|
||||||
|
client: httpx.AsyncClient,
|
||||||
|
url: str,
|
||||||
|
headers: dict[str, str],
|
||||||
|
start_after_uri: str | None,
|
||||||
|
) -> AsyncIterator[Hit]:
|
||||||
|
"""Yield organizations one by one, in URI order.
|
||||||
|
|
||||||
|
If the point-in-time expires, reopen it and continue from the last URI seen.
|
||||||
|
Organizations that were already finished are skipped by the caller.
|
||||||
|
"""
|
||||||
|
resume_uri = start_after_uri
|
||||||
|
restarts = 0
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
async with aclosing(_scan_pages(client, url, headers, resume_uri)) as pages:
|
||||||
|
async for page in pages:
|
||||||
|
restarts = 0
|
||||||
|
resume_uri = page[-1].get("_source", {}).get("uri") or resume_uri
|
||||||
|
for hit in page:
|
||||||
|
yield hit
|
||||||
|
return
|
||||||
|
except PitExpired:
|
||||||
|
restarts += 1
|
||||||
|
if restarts > MAX_PIT_RESTARTS:
|
||||||
|
raise RuntimeError("Point-in-time kept expiring; giving up.") from None
|
||||||
|
logger.warning(
|
||||||
|
"Point-in-time expired; reopening from uri=%r (restart %d/%d).",
|
||||||
|
resume_uri,
|
||||||
|
restarts,
|
||||||
|
MAX_PIT_RESTARTS,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Step 3: BUILD one document per (organization, OpenAlex person)
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
def build_hierarchy_lookup(hierarchy: Iterable[Any]) -> HierarchyLookup:
|
||||||
|
"""Map normalized organization links to (display name, path from the root)."""
|
||||||
|
lookup: HierarchyLookup = {}
|
||||||
|
|
||||||
|
def visit(node: Any, ancestors: list[str]) -> None:
|
||||||
|
name = getattr(node, "name_de", None) or getattr(node, "name_en", None)
|
||||||
|
path = [*ancestors, name] if name else ancestors
|
||||||
|
if name:
|
||||||
|
for link in (getattr(node, "link_de", None), getattr(node, "link_en", None)):
|
||||||
|
if normalized := normalize_org_uri(link):
|
||||||
|
lookup[normalized] = (name, path)
|
||||||
|
for child in getattr(node, "children", None) or []:
|
||||||
|
visit(child, path)
|
||||||
|
|
||||||
|
for root in hierarchy:
|
||||||
|
visit(root, [])
|
||||||
|
return lookup
|
||||||
|
|
||||||
|
|
||||||
|
def organization_details(
|
||||||
|
source: dict[str, Any], hierarchy_lookup: HierarchyLookup
|
||||||
|
) -> tuple[str, list[str], str | None]:
|
||||||
|
"""Return (org name, hierarchy path, org URI), with fallbacks for the name."""
|
||||||
|
org_uri = source.get("uri")
|
||||||
|
hierarchy_name, hierarchy_path = hierarchy_lookup.get(
|
||||||
|
normalize_org_uri(org_uri) or "", ("", [])
|
||||||
|
)
|
||||||
|
org_name = (
|
||||||
|
source.get("org_name")
|
||||||
|
or source.get("organization_name")
|
||||||
|
or source.get("name")
|
||||||
|
or hierarchy_name
|
||||||
|
or org_uri
|
||||||
|
or "Unknown organization"
|
||||||
|
)
|
||||||
|
return str(org_name), hierarchy_path, org_uri
|
||||||
|
|
||||||
|
|
||||||
|
def stable_document_id(org_uri: str | None, org_doc_id: str, openalex_id: str) -> str:
|
||||||
|
"""Deterministic ID so re-uploads overwrite instead of duplicating."""
|
||||||
|
org_identity = normalize_org_uri(org_uri) or org_doc_id
|
||||||
|
return hashlib.sha256(f"{org_identity}\0{openalex_id}".encode()).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def _canonical(value: Any) -> str:
|
||||||
|
return json.dumps(value, sort_keys=True, ensure_ascii=False, default=str)
|
||||||
|
|
||||||
|
|
||||||
|
def make_person_documents(
|
||||||
|
source: dict[str, Any],
|
||||||
|
source_doc_id: str,
|
||||||
|
verified_entries: list[dict[str, Any]],
|
||||||
|
hierarchy_lookup: HierarchyLookup,
|
||||||
|
verified_at: str,
|
||||||
|
) -> list[tuple[str, Hit]]:
|
||||||
|
"""Turn verified staff entries into [(doc_id, document)], one per OpenAlex person.
|
||||||
|
|
||||||
|
A person may be matched by several staff entries and several collaborators,
|
||||||
|
so entries and evidence are de-duplicated per person first.
|
||||||
|
"""
|
||||||
|
org_name, hierarchy_path, org_uri = organization_details(source, hierarchy_lookup)
|
||||||
|
|
||||||
|
# openalex_id -> {canonical staff json -> staff dict}
|
||||||
|
staff_by_person: dict[str, dict[str, dict[str, Any]]] = {}
|
||||||
|
# openalex_id -> {(openalex_id, collaborator_id) -> evidence dict}
|
||||||
|
evidence_by_person: dict[str, dict[tuple[Any, Any], dict[str, Any]]] = {}
|
||||||
|
|
||||||
|
for entry in verified_entries:
|
||||||
|
staff = entry["staff"]
|
||||||
|
staff_key = _canonical(staff)
|
||||||
|
for openalex_id in entry["openalex_ids"]:
|
||||||
|
staff_by_person.setdefault(openalex_id, {}).setdefault(staff_key, staff)
|
||||||
|
seen = evidence_by_person.setdefault(openalex_id, {})
|
||||||
|
for evidence in entry["collaboration_evidence"]:
|
||||||
|
if evidence["openalex_id"] == openalex_id:
|
||||||
|
key = (evidence["openalex_id"], evidence.get("collaborator_openalex_id"))
|
||||||
|
seen.setdefault(key, evidence)
|
||||||
|
|
||||||
|
documents: list[tuple[str, Hit]] = []
|
||||||
|
for openalex_id, staff_map in staff_by_person.items():
|
||||||
|
staff_entries = list(staff_map.values())
|
||||||
|
primary_staff = staff_entries[0]
|
||||||
|
document = {
|
||||||
|
"name": primary_staff.get("name"),
|
||||||
|
"org_name": org_name,
|
||||||
|
"org_uri": org_uri,
|
||||||
|
"org_hierarchy_path": hierarchy_path,
|
||||||
|
"openalex_id": openalex_id,
|
||||||
|
"staff": primary_staff,
|
||||||
|
"staff_entries": staff_entries,
|
||||||
|
"source_index": SOURCE_INDEX,
|
||||||
|
"source_org_doc_id": source_doc_id,
|
||||||
|
"verification_method": "collab_graph",
|
||||||
|
"verification_evidence": list(evidence_by_person[openalex_id].values()),
|
||||||
|
"verified_at": verified_at,
|
||||||
|
}
|
||||||
|
doc_id = stable_document_id(org_uri, source_doc_id, openalex_id)
|
||||||
|
documents.append((doc_id, document))
|
||||||
|
return documents
|
||||||
|
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Step 4: UPLOAD documents to the output index
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
async def ensure_output_index(
|
||||||
|
client: httpx.AsyncClient, url: str, headers: dict[str, str]
|
||||||
|
) -> None:
|
||||||
|
"""Create the output index with its mapping if it doesn't exist yet."""
|
||||||
|
head = await client.head(f"{url}/{OUTPUT_INDEX}", headers=headers)
|
||||||
|
if head.status_code == 200:
|
||||||
|
logger.info("Output index %r already exists.", OUTPUT_INDEX)
|
||||||
|
return
|
||||||
|
if head.status_code != 404:
|
||||||
|
head.raise_for_status()
|
||||||
|
|
||||||
|
response = await client.put(
|
||||||
|
f"{url}/{OUTPUT_INDEX}", json={"mappings": INDEX_MAPPING}, headers=headers
|
||||||
|
)
|
||||||
|
if response.status_code == 400 and "resource_already_exists" in response.text:
|
||||||
|
logger.info("Output index %r was created concurrently.", OUTPUT_INDEX)
|
||||||
|
return
|
||||||
|
response.raise_for_status()
|
||||||
|
logger.info("Created output index %r.", OUTPUT_INDEX)
|
||||||
|
|
||||||
|
|
||||||
|
def _bulk_chunk(doc_id: str, document: Hit) -> str:
|
||||||
|
action = json.dumps({"index": {"_index": OUTPUT_INDEX, "_id": doc_id}})
|
||||||
|
return f"{action}\n{json.dumps(document, ensure_ascii=False)}\n"
|
||||||
|
|
||||||
|
|
||||||
|
def _split_batches(items: list[tuple[str, str]]) -> Iterable[list[tuple[str, str]]]:
|
||||||
|
"""Group (doc_id, ndjson) items by document count and payload size."""
|
||||||
|
batch: list[tuple[str, str]] = []
|
||||||
|
size = 0
|
||||||
|
for item in items:
|
||||||
|
item_size = len(item[1].encode("utf-8"))
|
||||||
|
if batch and (len(batch) >= BULK_MAX_DOCS or size + item_size > BULK_MAX_BYTES):
|
||||||
|
yield batch
|
||||||
|
batch, size = [], 0
|
||||||
|
batch.append(item)
|
||||||
|
size += item_size
|
||||||
|
if batch:
|
||||||
|
yield batch
|
||||||
|
|
||||||
|
|
||||||
|
async def _post_bulk(
|
||||||
|
client: httpx.AsyncClient,
|
||||||
|
url: str,
|
||||||
|
api_key: str,
|
||||||
|
batch: list[tuple[str, str]],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
"""Send one bulk request, retrying on network errors and retryable statuses."""
|
||||||
|
body = "".join(chunk for _, chunk in batch).encode("utf-8")
|
||||||
|
headers = make_headers(api_key, "application/x-ndjson")
|
||||||
|
|
||||||
|
async def send() -> dict[str, Any]:
|
||||||
|
response = await client.post(f"{url}/_bulk", content=body, headers=headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
return await retry_async(send, description="Bulk request")
|
||||||
|
|
||||||
|
|
||||||
|
async def bulk_index(
|
||||||
|
client: httpx.AsyncClient,
|
||||||
|
url: str,
|
||||||
|
api_key: str,
|
||||||
|
documents: list[tuple[str, Hit]],
|
||||||
|
) -> tuple[int, list[tuple[str, str]]]:
|
||||||
|
"""Upsert documents. Return (success count, [(doc_id, error), ...]).
|
||||||
|
|
||||||
|
Items rejected with a retryable status (typically 429 under load) are sent
|
||||||
|
again with backoff. Everything else that fails is reported as a failure.
|
||||||
|
"""
|
||||||
|
pending = [(doc_id, _bulk_chunk(doc_id, doc)) for doc_id, doc in documents]
|
||||||
|
succeeded = 0
|
||||||
|
failures: dict[str, str] = {}
|
||||||
|
|
||||||
|
for attempt in range(1, MAX_ATTEMPTS + 1):
|
||||||
|
retry: list[tuple[str, str]] = []
|
||||||
|
|
||||||
|
for batch in _split_batches(pending):
|
||||||
|
result = await _post_bulk(client, url, api_key, batch)
|
||||||
|
items = result.get("items", [])
|
||||||
|
if len(items) != len(batch):
|
||||||
|
raise RuntimeError(
|
||||||
|
"Elasticsearch bulk response item count did not match the request."
|
||||||
|
)
|
||||||
|
|
||||||
|
for (doc_id, chunk), item in zip(batch, items):
|
||||||
|
outcome = item.get("index", {})
|
||||||
|
status = outcome.get("status", 0)
|
||||||
|
error = json.dumps(outcome.get("error", outcome), ensure_ascii=False)
|
||||||
|
if 200 <= status < 300:
|
||||||
|
succeeded += 1
|
||||||
|
failures.pop(doc_id, None)
|
||||||
|
elif status in RETRYABLE_STATUS:
|
||||||
|
retry.append((doc_id, chunk))
|
||||||
|
failures[doc_id] = error
|
||||||
|
else:
|
||||||
|
failures[doc_id] = error
|
||||||
|
|
||||||
|
if not retry:
|
||||||
|
break
|
||||||
|
pending = retry
|
||||||
|
if attempt < MAX_ATTEMPTS:
|
||||||
|
logger.warning(
|
||||||
|
"%d bulk items were rejected; retrying (attempt %d/%d).",
|
||||||
|
len(retry),
|
||||||
|
attempt,
|
||||||
|
MAX_ATTEMPTS,
|
||||||
|
)
|
||||||
|
await asyncio.sleep(backoff_delay(attempt))
|
||||||
|
|
||||||
|
return succeeded, sorted(failures.items())
|
||||||
|
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Processing a single organization (steps 2-4)
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Context:
|
||||||
|
"""Everything `process_organization` needs, bundled in one place."""
|
||||||
|
|
||||||
|
client: httpx.AsyncClient
|
||||||
|
url: str
|
||||||
|
api_key: str
|
||||||
|
hierarchy_lookup: HierarchyLookup
|
||||||
|
stats: Stats
|
||||||
|
dry_run: bool
|
||||||
|
fail_fast: bool
|
||||||
|
verified_at: str
|
||||||
|
|
||||||
|
|
||||||
|
def staff_of(source: dict[str, Any]) -> list[dict[str, Any]]:
|
||||||
|
raw = source.get("staff")
|
||||||
|
if not isinstance(raw, list):
|
||||||
|
return []
|
||||||
|
return [staff for staff in raw if isinstance(staff, dict)]
|
||||||
|
|
||||||
|
|
||||||
|
async def process_organization(hit: Hit, ctx: Context) -> bool:
|
||||||
|
"""Verify one organization's staff and upload the result.
|
||||||
|
|
||||||
|
Returns True if the organization is completely done (nothing to retry).
|
||||||
|
"""
|
||||||
|
doc_id = str(hit.get("_id") or "")
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
label = source.get("uri") or doc_id
|
||||||
|
|
||||||
|
staff_list = staff_of(source)
|
||||||
|
if not staff_list:
|
||||||
|
return True # nothing to verify
|
||||||
|
|
||||||
|
logger.info("Processing organization %s (%d staff entries).", label, len(staff_list))
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Step 2: verify staff against the collaboration graph.
|
||||||
|
verified_entries = await retry_async(
|
||||||
|
lambda: logic.get_verified_staff_with_collab_graph(
|
||||||
|
staff_list,
|
||||||
|
INSTITUTION_URL,
|
||||||
|
max_concurrent_queries=GRAPH_QUERIES_AT_A_TIME,
|
||||||
|
),
|
||||||
|
description=f"Collab-graph verification for {label}",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Step 3: build one document per OpenAlex person.
|
||||||
|
documents = make_person_documents(
|
||||||
|
source, doc_id, verified_entries, ctx.hierarchy_lookup, ctx.verified_at
|
||||||
|
)
|
||||||
|
ctx.stats.person_docs += len(documents)
|
||||||
|
|
||||||
|
if ctx.dry_run:
|
||||||
|
logger.info(
|
||||||
|
"DRY RUN org=%s verified_staff=%d person_org_docs=%d",
|
||||||
|
label,
|
||||||
|
len(verified_entries),
|
||||||
|
len(documents),
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
|
||||||
|
# Step 4: upload.
|
||||||
|
uploaded, failures = await bulk_index(ctx.client, ctx.url, ctx.api_key, documents)
|
||||||
|
ctx.stats.uploaded += uploaded
|
||||||
|
for failed_id, error in failures:
|
||||||
|
ctx.stats.doc_errors += 1
|
||||||
|
logger.error("Failed to index document %s (org %s): %s", failed_id, label, error)
|
||||||
|
return not failures
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Failed processing organization %s (_id=%s).", label, doc_id)
|
||||||
|
if ctx.fail_fast:
|
||||||
|
raise
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Main flow
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
def reset_checkpoint_files(progress_file: Path) -> None:
|
||||||
|
"""Implements --fresh: delete the progress file (and a leftover .tmp file)."""
|
||||||
|
tmp_file = progress_file.with_suffix(progress_file.suffix + ".tmp")
|
||||||
|
existed = progress_file.exists()
|
||||||
|
removed = []
|
||||||
|
for path in (progress_file, tmp_file):
|
||||||
|
try:
|
||||||
|
path.unlink()
|
||||||
|
removed.append(str(path))
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
logger.info(
|
||||||
|
"--fresh: removed %s. Output index %r is kept and will be updated by upserts.",
|
||||||
|
removed,
|
||||||
|
OUTPUT_INDEX,
|
||||||
|
)
|
||||||
|
if existed:
|
||||||
|
logger.warning(
|
||||||
|
"--fresh discarded the existing checkpoint. If a saved job command "
|
||||||
|
"contains --fresh, it restarts from the first organization on every "
|
||||||
|
"run; remove the flag to resume instead."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_progress(args: argparse.Namespace) -> Progress:
|
||||||
|
"""Load (or reset) the checkpoint according to the CLI flags."""
|
||||||
|
if args.fresh:
|
||||||
|
reset_checkpoint_files(args.progress_file)
|
||||||
|
|
||||||
|
progress = Progress.load(args.progress_file, persist=not args.dry_run)
|
||||||
|
if args.ignore_progress:
|
||||||
|
progress.reset()
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"Checkpoint %s: %d finished organizations, resume cursor=%r.",
|
||||||
|
args.progress_file,
|
||||||
|
len(progress.processed_org_ids),
|
||||||
|
progress.last_source_uri,
|
||||||
|
)
|
||||||
|
if not args.dry_run and checkpoint_dir_is_mounted(args.progress_file) is False:
|
||||||
|
logger.warning(
|
||||||
|
"Checkpoint directory %s is not a mounted volume, so progress is lost "
|
||||||
|
"as soon as the container is removed. Set the job's persistent directory "
|
||||||
|
"to %s.",
|
||||||
|
args.progress_file.parent,
|
||||||
|
args.progress_file.parent,
|
||||||
|
)
|
||||||
|
return progress
|
||||||
|
|
||||||
|
|
||||||
|
async def run(args: argparse.Namespace) -> int:
|
||||||
|
# Setup ---------------------------------------------------------------
|
||||||
|
url, api_key = require_es_credentials() # fail fast, before slow work
|
||||||
|
headers = make_headers(api_key)
|
||||||
|
progress = prepare_progress(args)
|
||||||
|
|
||||||
|
hierarchy = await logic.get_hierarchy(INSTITUTION_URL)
|
||||||
|
hierarchy_lookup = build_hierarchy_lookup(hierarchy)
|
||||||
|
logger.info("Loaded %d hierarchy URL mappings for UDE.", len(hierarchy_lookup))
|
||||||
|
|
||||||
|
stats = Stats()
|
||||||
|
organizations_handled = 0 # for --limit
|
||||||
|
cursor_blocked = False # set after the first failure; cursor stops moving
|
||||||
|
last_log = time.monotonic()
|
||||||
|
|
||||||
|
async with httpx.AsyncClient(timeout=httpx.Timeout(90.0)) as client:
|
||||||
|
if not args.dry_run:
|
||||||
|
await ensure_output_index(client, url, headers)
|
||||||
|
|
||||||
|
ctx = Context(
|
||||||
|
client=client,
|
||||||
|
url=url,
|
||||||
|
api_key=api_key,
|
||||||
|
hierarchy_lookup=hierarchy_lookup,
|
||||||
|
stats=stats,
|
||||||
|
dry_run=args.dry_run,
|
||||||
|
fail_fast=args.fail_fast,
|
||||||
|
verified_at=datetime.now(UTC).isoformat(),
|
||||||
|
)
|
||||||
|
|
||||||
|
# Main loop: one organization at a time -----------------------------
|
||||||
|
try:
|
||||||
|
async with aclosing(
|
||||||
|
scan_organizations(client, url, headers, progress.last_source_uri)
|
||||||
|
) as organizations:
|
||||||
|
async for hit in organizations:
|
||||||
|
stats.scanned += 1
|
||||||
|
org_doc_id = str(hit.get("_id") or "")
|
||||||
|
org_uri = hit.get("_source", {}).get("uri")
|
||||||
|
|
||||||
|
# Already uploaded in an earlier run.
|
||||||
|
if org_doc_id in progress.processed_org_ids:
|
||||||
|
if not cursor_blocked:
|
||||||
|
progress.advance_cursor(org_uri)
|
||||||
|
continue
|
||||||
|
|
||||||
|
if args.limit is not None and organizations_handled >= args.limit:
|
||||||
|
logger.info("Reached --limit=%d.", args.limit)
|
||||||
|
break
|
||||||
|
|
||||||
|
organizations_handled += 1
|
||||||
|
if await process_organization(hit, ctx):
|
||||||
|
stats.orgs_done += 1
|
||||||
|
if not args.dry_run:
|
||||||
|
progress.mark_org_done(org_doc_id)
|
||||||
|
if not cursor_blocked:
|
||||||
|
progress.advance_cursor(org_uri)
|
||||||
|
else:
|
||||||
|
stats.orgs_failed += 1
|
||||||
|
cursor_blocked = True # retry this one on the next run
|
||||||
|
|
||||||
|
progress.save()
|
||||||
|
if time.monotonic() - last_log >= PROGRESS_LOG_INTERVAL_S:
|
||||||
|
logger.info("Progress: %s", stats.summary())
|
||||||
|
last_log = time.monotonic()
|
||||||
|
finally:
|
||||||
|
progress.save(force=True)
|
||||||
|
|
||||||
|
logger.info("Finished: %s progress_file=%s", stats.summary(), args.progress_file)
|
||||||
|
return 1 if stats.has_errors else 0
|
||||||
|
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Command line
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args() -> argparse.Namespace:
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Upload UDE OrgMiner persons verified by the collaboration graph."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--progress-file",
|
||||||
|
type=Path,
|
||||||
|
default=DEFAULT_PROGRESS_FILE,
|
||||||
|
help=f"JSON checkpoint file (default: {DEFAULT_PROGRESS_FILE})",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--limit",
|
||||||
|
type=int,
|
||||||
|
default=None,
|
||||||
|
help="Process at most this many not-yet-completed organizations.",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--dry-run",
|
||||||
|
action="store_true",
|
||||||
|
help=(
|
||||||
|
"Verify and count results without creating the index, uploading, "
|
||||||
|
"or writing progress. Still reads existing progress unless "
|
||||||
|
"--ignore-progress is given."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--ignore-progress",
|
||||||
|
action="store_true",
|
||||||
|
help="Start from scratch, ignoring any existing progress file contents.",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--fresh",
|
||||||
|
action="store_true",
|
||||||
|
help=(
|
||||||
|
"Delete the selected JSON progress checkpoint and start from the "
|
||||||
|
"first source organization. Existing output-index documents are kept."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--fail-fast",
|
||||||
|
action="store_true",
|
||||||
|
help="Stop at the first organization-level error instead of continuing.",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
if args.limit is not None and args.limit < 1:
|
||||||
|
parser.error("--limit must be at least 1.")
|
||||||
|
return args
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(asyncio.run(run(parse_args())))
|
||||||
@@ -5773,7 +5773,930 @@
|
|||||||
"link_de": "https://www.uk-essen.de",
|
"link_de": "https://www.uk-essen.de",
|
||||||
"chairs_aggregator": "None",
|
"chairs_aggregator": "None",
|
||||||
"type": "leaf",
|
"type": "leaf",
|
||||||
"color": "green"
|
"color": "green",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"name_de": "Instituten",
|
||||||
|
"name_en": "Institutes",
|
||||||
|
"color": "#3388FF",
|
||||||
|
"type": "institutes",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Department of Medical Intensive Care I",
|
||||||
|
"name_de": "Abteilung für Medizinische Intensivtherapie I",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/medizinische-intensivtherapie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/medizinische-intensivtherapie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "General, Visceral, Vascular and Transplant Surgery",
|
||||||
|
"name_de": "Allgemein-, Viszeral-, Gefäß- und Transplantationschirurgie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/allgemeinchirurgie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/allgemeinchirurgie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Anaesthesiology and Intensive Care Medicine",
|
||||||
|
"name_de": "Anästhesiologie und Intensivmedizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/anaesthesiologie-intensivmedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/anaesthesiologie-intensivmedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Ophthalmology",
|
||||||
|
"name_de": "Augenheilkunde",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/augenheilkunde/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/augenheilkunde/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Dermatology",
|
||||||
|
"name_de": "Dermatologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/dermatologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/dermatologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Endocrinology, Diabetology and Metabolism",
|
||||||
|
"name_de": "Endokrinologie, Diabetologie und Stoffwechsel",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/endokrinologie-diabetologie-stoffwechsel/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/endokrinologie-diabetologie-stoffwechsel/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Gynecology and Obstetrics",
|
||||||
|
"name_de": "Frauenheilkunde und Geburtshilfe",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/frauenheilkunde-geburtshilfe/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/frauenheilkunde-geburtshilfe/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Gastroenterology, Hepatology and Transplantation Medicine",
|
||||||
|
"name_de": "Gastroenterologie, Hepatologie und Transplantationsmedizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/gastroenterologie-hepatologie-transplatationsmedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/gastroenterologie-hepatologie-transplatationsmedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Otorhinolaryngology",
|
||||||
|
"name_de": "Hals- Nasen- und Ohrenheilkunde",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/hals-nasen-ohrenheilkunde/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/hals-nasen-ohrenheilkunde/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Hematology and Stem Cell Transplantation",
|
||||||
|
"name_de": "Hämatologie und Stammzelltransplantation",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/haematologie-stammzelltransplantation/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/haematologie-stammzelltransplantation/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Infectious Diseases and Nephrology",
|
||||||
|
"name_de": "Infektiologie und Nephrologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/infektiologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/infektiologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Cardiology and Angiology",
|
||||||
|
"name_de": "Kardiologie und Angiologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/kardiologie-angiologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/kardiologie-angiologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Pediatrics and Adolescent Medicine",
|
||||||
|
"name_de": "Kinder- und Jugendmedizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/kinder-jugendmedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/kinder-jugendmedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Pediatric Surgery",
|
||||||
|
"name_de": "Kinderchirurgie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/kinderchirurgie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/kinderchirurgie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Medical Oncology",
|
||||||
|
"name_de": "Medizinische Onkologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/medizinische-onkologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/medizinische-onkologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Oral, Maxillofacial and Plastic Facial Surgery",
|
||||||
|
"name_de": "Mund-, Kiefer- und Plastische Gesichtschirurgie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/klinik-fuer-mund-kiefer-und-plastische-gesichtschirurgie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/klinik-fuer-mund-kiefer-und-plastische-gesichtschirurgie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Nephrology",
|
||||||
|
"name_de": "Nephrologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/nephrologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/nephrologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Neurosurgery and Spinal Surgery",
|
||||||
|
"name_de": "Neurochirurgie und Wirbelsäulenchirurgie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/neurochirurgie-wirbelsaeulenchirurgie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/neurochirurgie-wirbelsaeulenchirurgie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Neurology",
|
||||||
|
"name_de": "Neurologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/neurologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/neurologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Nuclear Medicine",
|
||||||
|
"name_de": "Nuklearmedizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/nuklearmedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/nuklearmedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Particle Therapy (WPE)",
|
||||||
|
"name_de": "Partikeltherapie (WPE)",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/partikeltherapie-wpe/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/partikeltherapie-wpe/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Thoracic and Cardiovascular Surgery",
|
||||||
|
"name_de": "Thorax- und Kardiovaskuläre Chirurgie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/thorax-kardiovaskulaere-chirurgie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/thorax-kardiovaskulaere-chirurgie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Tumor Orthopedics and Sarcoma Surgery",
|
||||||
|
"name_de": "Tumororthopädie und Sarkomchirurgie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/tumororthopaedie-sarkomchirurgie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/tumororthopaedie-sarkomchirurgie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Trauma, Hand and Reconstructive Surgery",
|
||||||
|
"name_de": "Unfall-, Hand- und Wiederherstellungschirurgie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/unfall-hand-wiederherstellungschirurgie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/unfall-hand-wiederherstellungschirurgie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Urology",
|
||||||
|
"name_de": "Urologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/urologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/urologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Radiation Therapy",
|
||||||
|
"name_de": "Poliklinik für Strahlentherapie",
|
||||||
|
"link_en": "https://www.uk-essen.de/klinik/strahlentherapie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/klinik/strahlentherapie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Bridge Institute for Experimental Tumor Therapy (BIT)",
|
||||||
|
"name_de": "Brückeninstitut für Experimentelle Tumortherapie (BIT)",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/tumortherapie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/tumortherapie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of General Practice",
|
||||||
|
"name_de": "Institut für Allgemeinmedizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/allgemeinmedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/allgemeinmedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Anatomy",
|
||||||
|
"name_de": "Institut für Anatomie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/anatomie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/anatomie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Diagnostic and Interventional Radiology and Neuroradiology",
|
||||||
|
"name_de": "Institut für Diagnostische und Interventionelle Radiologie und Neuroradiologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/radiologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/radiologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Medical Education",
|
||||||
|
"name_de": "Institut für Didaktik in der Medizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/institut-fuer-didaktik-in-der-medizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/institut-fuer-didaktik-in-der-medizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute for Research on HIV and AIDS-Associated Diseases",
|
||||||
|
"name_de": "Institut für die Erforschung von HIV und AIDS–assoziierten Erkrankungen",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/hiv-forschung/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/hiv-forschung/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Experimental Immunology and Imaging",
|
||||||
|
"name_de": "Institut für Experimentelle Immunologie und Bildgebung",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/experimentelle-immunologie-bildgebung/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/experimentelle-immunologie-bildgebung/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Gender-Sensitive Medicine",
|
||||||
|
"name_de": "Institut für Geschlechtersensible Medizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/institut-fuer-geschlechtersensible-medizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/institut-fuer-geschlechtersensible-medizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Human Genetics",
|
||||||
|
"name_de": "Institut für Humangenetik",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/humangenetik/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/humangenetik/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Immunology",
|
||||||
|
"name_de": "Institut für Immunologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/immunologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/immunologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute for Artificial Intelligence in Medicine (IKIM)",
|
||||||
|
"name_de": "Institut für KI in der Medizin (IKIM)",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/ikim/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/ikim/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Medical Informatics, Biometry and Epidemiology",
|
||||||
|
"name_de": "Institut für Medizinische Informatik, Biometrie und Epidemiologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/informatik-biometrie-epidemiologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/informatik-biometrie-epidemiologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Medical Microbiology",
|
||||||
|
"name_de": "Institut für Medizinische Mikrobiologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/mikrobiologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/mikrobiologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Medical Psychology and Behavioral Immunobiology",
|
||||||
|
"name_de": "Institut für Medizinische Psychologie und Verhaltensimmunbiologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/psychologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/psychologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Molecular Biology (Cancer Research)",
|
||||||
|
"name_de": "Institut für Molekularbiologie (Tumorforschung)",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/molekularbiologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/molekularbiologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Neuropathology",
|
||||||
|
"name_de": "Institut für Neuropathologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/neuropathologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/neuropathologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Pathology",
|
||||||
|
"name_de": "Institut für Pathologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/pathologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/pathologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Pathophysiology",
|
||||||
|
"name_de": "Institut für Pathophysiologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/pathophysiologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/pathophysiologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Patient Experience",
|
||||||
|
"name_de": "Institut für PatientenErleben",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/patientenerleben/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/patientenerleben/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Pharmacology",
|
||||||
|
"name_de": "Institut für Pharmakologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/pharmakologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/pharmakologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Physiology",
|
||||||
|
"name_de": "Institut für Physiologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/physiologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/physiologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Physiological Chemistry",
|
||||||
|
"name_de": "Institut für Physiologische Chemie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/physiologische-chemie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/physiologische-chemie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Forensic Medicine",
|
||||||
|
"name_de": "Institut für Rechtsmedizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/rechtsmedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/rechtsmedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Exercise and Movement Therapy at the West German Cancer Center Essen",
|
||||||
|
"name_de": "Institut für Sport- und Bewegungstherapie am Westdeutschen Tumorzentrum Essen",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/sport-und-bewegungstherapie-WTZ/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/sport-und-bewegungstherapie-WTZ/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Transfusion Medicine",
|
||||||
|
"name_de": "Institut für Transfusionsmedizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/transfusionsmedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/transfusionsmedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Urban Public Health",
|
||||||
|
"name_de": "Institut für Urban Public Health",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/urban-public-health/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/urban-public-health/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Virology",
|
||||||
|
"name_de": "Institut für Virologie",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/virologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/virologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute of Cell Biology (Cancer Research)",
|
||||||
|
"name_de": "Institut für Zellbiologie (Tumorforschung)",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/zellbiologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/zellbiologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Institute for Cell Therapeutic Research",
|
||||||
|
"name_de": "Institut für Zelltherapeutische Forschung",
|
||||||
|
"link_en": "https://www.uk-essen.de/institut/zelltherapeutische-forschung/",
|
||||||
|
"link_de": "https://www.uk-essen.de/institut/zelltherapeutische-forschung/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Breast Center I at the WTZ",
|
||||||
|
"name_de": "Brustzentrum I am WTZ",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/brustzentrum-i/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/brustzentrum-i/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Essen Center for Rare Diseases (EZSE)",
|
||||||
|
"name_de": "Essener Zentrum für seltene Erkrankungen (EZSE)",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/seltene-erkrankungen/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/seltene-erkrankungen/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Essen Vascular Center",
|
||||||
|
"name_de": "Gefäßzentrum Essen",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/gefaesszentrum-essen/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/gefaesszentrum-essen/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Interdisciplinary Pain Center",
|
||||||
|
"name_de": "Interdisziplinäres Schmerzzentrum",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/schmerzzentrum/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/schmerzzentrum/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Lung Cancer Center at the WTZ",
|
||||||
|
"name_de": "Lungenkrebszentrum am WTZ",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/lungenkrebszentrum/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/lungenkrebszentrum/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Palliative Care",
|
||||||
|
"name_de": "Palliativmedizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/palliativmedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/palliativmedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "West German Heart and Vascular Center (WHGZ)",
|
||||||
|
"name_de": "Westdeutsches Herz- und Gefäßzentrum (WHGZ)",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/whgz/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/whgz/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "West German Headache Center",
|
||||||
|
"name_de": "Westdeutsches Kopfschmerzzentrum",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/kopfschmerzzentrum/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/kopfschmerzzentrum/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "West German Gastrointestinal Center",
|
||||||
|
"name_de": "Westdeutsches Magen- und Darmzentrum",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/magen-darmzentrum/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/magen-darmzentrum/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "West German Proton Therapy Center (WPE)",
|
||||||
|
"name_de": "Westdeutsches Protonentherapiezentrum (WPE)",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/protonentherapiezentrum/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/protonentherapiezentrum/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "West German Cancer Center Essen (WTZ)",
|
||||||
|
"name_de": "Westdeutsches Tumorzentrum Essen (WTZ)",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/westdeutsches-tumorzentrum-essen/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/westdeutsches-tumorzentrum-essen/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "West German Center for Infectious Diseases (WZI)",
|
||||||
|
"name_de": "Westdeutsches Zentrum für Infektiologie (WZI)",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/westdeutsches-zentrum-fuer-infektiologie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/westdeutsches-zentrum-fuer-infektiologie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "West German Center for Organ Transplantation (WZO)",
|
||||||
|
"name_de": "Westdeutsches Zentrum für Organtransplantation (WZO)",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/organtransplantationen/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/organtransplantationen/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Metropole Ruhr Center for Intensive Care Medicine (ZIMR)",
|
||||||
|
"name_de": "Zentrum für Intensivmedizin Metropole Ruhr (ZIMR)",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/zimr/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/zimr/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Center for Interdisciplinary Telemedicine and Telecare (ZinTT)",
|
||||||
|
"name_de": "Zentrum für interdisziplinäre Telemedizin und Telecare (ZinTT)",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/telemedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/telemedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Center for Child and Adolescent Medicine",
|
||||||
|
"name_de": "Zentrum für Kinder- und Jugendmedizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/kinder-jugendmedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/kinder-jugendmedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Center for Naturopathy and Planetary Health",
|
||||||
|
"name_de": "Zentrum für Naturheilkunde und Planetare Gesundheit",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/Naturheilkunde/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/Naturheilkunde/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Center for Emergency Medicine",
|
||||||
|
"name_de": "Zentrum für Notfallmedizin",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/notfallmedizin/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/notfallmedizin/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Center for Virtual and Augmented Reality in Medicine (ZvRM)",
|
||||||
|
"name_de": "Zentrum für virtuelle und erweiterte Realität in der Medizin (ZvRM)",
|
||||||
|
"link_en": "https://www.uk-essen.de/zentrum/zentrum-fuer-virtuelle-und-erweiterte-realitaet-in-der-medizin-zvrm/",
|
||||||
|
"link_de": "https://www.uk-essen.de/zentrum/zentrum-fuer-virtuelle-und-erweiterte-realitaet-in-der-medizin-zvrm/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Department of EIMK – Empathic Intercultural Medical Communication",
|
||||||
|
"name_de": "Abteilung EIMK – Empathische Interkulturelle Medizinische Kommunikation",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/abteilung-eimk-empathische-interkulturelle-medizinische-kommunikation/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/abteilung-eimk-empathische-interkulturelle-medizinische-kommunikation/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Pharmacy",
|
||||||
|
"name_de": "Apotheke",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/apotheke/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/apotheke/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Central Division AI and Data Governance",
|
||||||
|
"name_de": "Central Division AI and Data Governance",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/ai-data-governance/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/ai-data-governance/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Data Integration Center (DIZ)",
|
||||||
|
"name_de": "Datenintegrationszentrum (DIZ)",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/datenintegrationszentrum-diz/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/datenintegrationszentrum-diz/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Information Security",
|
||||||
|
"name_de": "Informationssicherheit",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/informationssicherheit/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/informationssicherheit/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Clinical Ethics Committee (KEK)",
|
||||||
|
"name_de": "Klinisches Ethik-Komitee (KEK)",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/klinisches-ethik-komitee-kek/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/klinisches-ethik-komitee-kek/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Hospital Hygiene",
|
||||||
|
"name_de": "Krankenhaushygiene",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/krankenhaushygiene/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/krankenhaushygiene/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Human Resources and Occupational Health Service",
|
||||||
|
"name_de": "Personal- und betriebsärztlicher Dienst",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/personal-betriebsaerztlicher-dienst/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/personal-betriebsaerztlicher-dienst/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Nursing Service",
|
||||||
|
"name_de": "Pflegedienst",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/pflegedienst/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/pflegedienst/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Physiotherapy",
|
||||||
|
"name_de": "Physiotherapie",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/physiotherapie/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/physiotherapie/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Service and Information Center (SIC)",
|
||||||
|
"name_de": "Service- und Informationscenter (SIC)",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/service-und-informationscenter-sic/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/service-und-informationscenter-sic/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Digital Transformation Staff Unit",
|
||||||
|
"name_de": "Stabsstelle Digitale Transformation",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/stabsstelle-digitale-transformation/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/stabsstelle-digitale-transformation/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Quality Management and Clinical Risk Management Staff Unit",
|
||||||
|
"name_de": "Stabsstelle Qualitätsmanagement und klinisches Risikomanagement",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/stabsstelle-qualitaetsmanagement-und-klinisches-risikomanagement/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/stabsstelle-qualitaetsmanagement-und-klinisches-risikomanagement/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "UME Clinical Study Unit",
|
||||||
|
"name_de": "UME-Studieneinheit",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/ume-studieneinheit/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/ume-studieneinheit/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Central Information Technology (ZIT)",
|
||||||
|
"name_de": "Zentrale Informationstechnik (ZIT)",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/zentrale-informationstechnik-zit/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/zentrale-informationstechnik-zit/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Central Animal Laboratory",
|
||||||
|
"name_de": "Zentrales Tierlaboratorium",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/zentrales-tierlaboratorium/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/zentrales-tierlaboratorium/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"faculty_de": "Medizin",
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"name_en": "Central Laboratory",
|
||||||
|
"name_de": "Zentrallabor",
|
||||||
|
"link_en": "https://www.uk-essen.de/gemeinsame-einrichtung/zentrallabor/",
|
||||||
|
"link_de": "https://www.uk-essen.de/gemeinsame-einrichtung/zentrallabor/",
|
||||||
|
"type": "leaf",
|
||||||
|
"color": "green"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"value": 91,
|
||||||
|
"faculty_en": "Medicine",
|
||||||
|
"faculty_de": "Medizin"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"value": 4,
|
"value": 4,
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ ! -d /data/hierarchies ] || [ -z "$(find /data/hierarchies -mindepth 1 -maxdepth 1 -type d -print -quit)" ]; then
|
||||||
|
echo "Initializing empty /data volume from the bundled data..."
|
||||||
|
cp -a /seed-data/. /data/
|
||||||
|
fi
|
||||||
|
|
||||||
cd /home
|
cd /home
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
uvicorn --host "0.0.0.0" --port "8000" inse.main:app --log-config log-config.yaml
|
uvicorn --host "0.0.0.0" --port "8000" inse.main:app --log-config log-config.yaml
|
||||||
@@ -16,4 +23,3 @@ else
|
|||||||
echo "test: Runs tests using pytest."
|
echo "test: Runs tests using pytest."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
LLM_API_URL=
|
||||||
|
LLM_API_KEY=
|
||||||
|
LLM_MODEL=
|
||||||
|
|
||||||
|
# Patent search (EPO + USPTO)
|
||||||
|
PATENT_ELASTICSEARCH_URL=
|
||||||
|
PATENT_ELASTICSEARCH_API_KEY=
|
||||||
|
|
||||||
|
ELASTICSEARCH_URL=
|
||||||
|
ELASTICSEARCH_API_KEY=
|
||||||
|
|
||||||
|
ELASTICSEARCH_INSE_URL=
|
||||||
|
ELASTICSEARCH_INSE_API_KEY=
|
||||||
|
|
||||||
|
# Debugging: Log every outgoing Elasticsearch query (index + payload)
|
||||||
|
PRINT_ES_QUERIES=
|
||||||
|
# Debugging: Log the duration of every Elasticsearch request
|
||||||
|
PRINT_ES_TIMINGS=
|
||||||
|
|
||||||
|
# Sentence Transformers Configuration
|
||||||
|
SENTENCE_TRANSFORMERS_MODEL_NAME=
|
||||||
|
|
||||||
|
TOKEN_ISSUER_ID=
|
||||||
|
TOKEN_HMAC_KEY=
|
||||||
|
|
||||||
|
# Docker-Registry-Login für Background-Jobs (Nexus, nes.uni-due.de)
|
||||||
|
BACKGROUND_JOBS_REGISTRY_USERNAME=
|
||||||
|
BACKGROUND_JOBS_REGISTRY_PASSWORD=
|
||||||
@@ -4,8 +4,9 @@ Database tables and API schemas for the background job runner.
|
|||||||
|
|
||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
from enum import StrEnum
|
from enum import StrEnum
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel, Field as PydanticField, field_validator
|
||||||
from sqlmodel import JSON, Column, Field, SQLModel
|
from sqlmodel import JSON, Column, Field, SQLModel
|
||||||
|
|
||||||
|
|
||||||
@@ -51,6 +52,16 @@ class JobDefinition(SQLModel, table=True):
|
|||||||
sa_column=Column(JSON),
|
sa_column=Column(JSON),
|
||||||
description="Extra environment variables passed to the container.",
|
description="Extra environment variables passed to the container.",
|
||||||
)
|
)
|
||||||
|
persistent_dir: str | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="Absolute path where the container's named persistent volume is mounted.",
|
||||||
|
)
|
||||||
|
stop_timeout_seconds: int = Field(
|
||||||
|
default=10,
|
||||||
|
ge=1,
|
||||||
|
le=600,
|
||||||
|
description="Seconds to wait for graceful container shutdown before killing it.",
|
||||||
|
)
|
||||||
schedule: str | None = Field(
|
schedule: str | None = Field(
|
||||||
default=None,
|
default=None,
|
||||||
description="Cron expression in UTC (e.g. '0 3 * * *'). Null = manual only.",
|
description="Cron expression in UTC (e.g. '0 3 * * *'). Null = manual only.",
|
||||||
@@ -63,6 +74,13 @@ class JobDefinition(SQLModel, table=True):
|
|||||||
)
|
)
|
||||||
created_at: datetime = Field(default_factory=utcnow)
|
created_at: datetime = Field(default_factory=utcnow)
|
||||||
|
|
||||||
|
@field_validator("persistent_dir")
|
||||||
|
@classmethod
|
||||||
|
def validate_persistent_dir(cls, value: str | None) -> str | None:
|
||||||
|
if value is not None and not Path(value).is_absolute():
|
||||||
|
raise ValueError("persistent_dir must be an absolute path.")
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
class JobRun(SQLModel, table=True):
|
class JobRun(SQLModel, table=True):
|
||||||
__tablename__ = "background_job_run"
|
__tablename__ = "background_job_run"
|
||||||
@@ -95,6 +113,15 @@ class JobDefinitionCreateRequest(BaseModel):
|
|||||||
target_index: str = ""
|
target_index: str = ""
|
||||||
schedule: str | None = None
|
schedule: str | None = None
|
||||||
enabled: bool = True
|
enabled: bool = True
|
||||||
|
persistent_dir: str | None = None
|
||||||
|
stop_timeout_seconds: int = PydanticField(default=10, ge=1, le=600)
|
||||||
|
|
||||||
|
@field_validator("persistent_dir")
|
||||||
|
@classmethod
|
||||||
|
def validate_persistent_dir(cls, value: str | None) -> str | None:
|
||||||
|
if value is not None and not Path(value).is_absolute():
|
||||||
|
raise ValueError("persistent_dir must be an absolute path.")
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
class JobDefinitionUpdateRequest(BaseModel):
|
class JobDefinitionUpdateRequest(BaseModel):
|
||||||
@@ -106,6 +133,15 @@ class JobDefinitionUpdateRequest(BaseModel):
|
|||||||
target_index: str | None = None
|
target_index: str | None = None
|
||||||
schedule: str | None = None
|
schedule: str | None = None
|
||||||
enabled: bool | None = None
|
enabled: bool | None = None
|
||||||
|
persistent_dir: str | None = None
|
||||||
|
stop_timeout_seconds: int | None = PydanticField(default=None, ge=1, le=600)
|
||||||
|
|
||||||
|
@field_validator("persistent_dir")
|
||||||
|
@classmethod
|
||||||
|
def validate_persistent_dir(cls, value: str | None) -> str | None:
|
||||||
|
if value is not None and not Path(value).is_absolute():
|
||||||
|
raise ValueError("persistent_dir must be an absolute path.")
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
class BackgroundJobTask(BaseModel):
|
class BackgroundJobTask(BaseModel):
|
||||||
@@ -116,6 +152,8 @@ class BackgroundJobTask(BaseModel):
|
|||||||
image: str | None
|
image: str | None
|
||||||
command: str | None
|
command: str | None
|
||||||
env: dict[str, str]
|
env: dict[str, str]
|
||||||
|
persistent_dir: str | None
|
||||||
|
stop_timeout_seconds: int
|
||||||
schedule: str | None
|
schedule: str | None
|
||||||
enabled: bool
|
enabled: bool
|
||||||
next_run_at: datetime | None
|
next_run_at: datetime | None
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ periodic schedule/reconcile loop.
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
import shlex
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
|
|
||||||
@@ -26,6 +27,10 @@ logger = logging.getLogger(__name__)
|
|||||||
settings = config.get_settings()
|
settings = config.get_settings()
|
||||||
|
|
||||||
RUN_STATE_LOCK = RLock()
|
RUN_STATE_LOCK = RLock()
|
||||||
|
ORGMINER_DEFAULT_PERSISTENT_DIR = "/app/orgminer_pipeline/runs"
|
||||||
|
ORGMINER_VERIFIED_PERSONS_UDE_REPOSITORY = (
|
||||||
|
"inse/jobs/orgminer-verified-persons-ude"
|
||||||
|
)
|
||||||
|
|
||||||
_client: docker.DockerClient | None = None
|
_client: docker.DockerClient | None = None
|
||||||
|
|
||||||
@@ -129,6 +134,22 @@ def is_registry_image(image: str | None) -> bool:
|
|||||||
return bool(image) and image.split("/", 1)[0] == registry_host()
|
return bool(image) and image.split("/", 1)[0] == registry_host()
|
||||||
|
|
||||||
|
|
||||||
|
def uses_nes_credentials(image: str | None) -> bool:
|
||||||
|
"""Only the OrgMiner verified-person job needs direct NES access."""
|
||||||
|
if not image or not is_registry_image(image):
|
||||||
|
return False
|
||||||
|
|
||||||
|
registry, _, image_path = image.partition("/")
|
||||||
|
image_path = image_path.split("@", 1)[0]
|
||||||
|
path_parts = image_path.rsplit("/", 1)
|
||||||
|
repository_name = path_parts[-1].split(":", 1)[0]
|
||||||
|
repository = "/".join([*path_parts[:-1], repository_name])
|
||||||
|
return (
|
||||||
|
registry == registry_host()
|
||||||
|
and repository == ORGMINER_VERIFIED_PERSONS_UDE_REPOSITORY
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def container_name(definition: JobDefinition, run: JobRun) -> str:
|
def container_name(definition: JobDefinition, run: JobRun) -> str:
|
||||||
slug = definition.name.lower()
|
slug = definition.name.lower()
|
||||||
slug = (
|
slug = (
|
||||||
@@ -145,8 +166,71 @@ def resolve_command(definition: JobDefinition):
|
|||||||
return definition.command or None
|
return definition.command or None
|
||||||
|
|
||||||
|
|
||||||
|
def uses_orgminer_auto_resume(definition: JobDefinition) -> bool:
|
||||||
|
"""Return whether the job is the orgminer pipeline in resume mode."""
|
||||||
|
command = definition.command or ""
|
||||||
|
try:
|
||||||
|
command_parts = shlex.split(command)
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
is_orgminer = (
|
||||||
|
"run_pipeline.py" in command_parts
|
||||||
|
or "orgminer_pipeline" in (definition.image or "")
|
||||||
|
or "orgminer_pipeline" in definition.name.lower()
|
||||||
|
)
|
||||||
|
return is_orgminer and "--auto-resume" in command_parts
|
||||||
|
|
||||||
|
|
||||||
|
def persistent_dir(definition: JobDefinition) -> str | None:
|
||||||
|
if definition.persistent_dir is not None:
|
||||||
|
return definition.persistent_dir
|
||||||
|
if uses_orgminer_auto_resume(definition):
|
||||||
|
return ORGMINER_DEFAULT_PERSISTENT_DIR
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def container_volumes(definition: JobDefinition) -> dict[str, dict[str, str]]:
|
||||||
|
volumes = {}
|
||||||
|
data_dir = persistent_dir(definition)
|
||||||
|
if data_dir:
|
||||||
|
volumes[f"bgjob-{definition.id}-data"] = {
|
||||||
|
"bind": data_dir,
|
||||||
|
"mode": "rw",
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_orgminer(definition) and settings.orgminer_data_volume:
|
||||||
|
volumes[settings.orgminer_data_volume] = {
|
||||||
|
"bind": "/data",
|
||||||
|
"mode": "ro",
|
||||||
|
}
|
||||||
|
return volumes
|
||||||
|
|
||||||
|
|
||||||
|
def is_orgminer(definition: JobDefinition) -> bool:
|
||||||
|
command = definition.command or ""
|
||||||
|
return (
|
||||||
|
"run_pipeline.py" in command
|
||||||
|
or "orgminer_pipeline" in (definition.image or "")
|
||||||
|
or "orgminer_pipeline" in definition.name.lower()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def resolve_environment(definition: JobDefinition) -> dict[str, str]:
|
def resolve_environment(definition: JobDefinition) -> dict[str, str]:
|
||||||
base = job_environment() if is_registry_image(resolve_image(definition)) else {}
|
image = resolve_image(definition)
|
||||||
|
base = job_environment() if is_registry_image(image) else {}
|
||||||
|
if uses_nes_credentials(image):
|
||||||
|
nes_environment = {
|
||||||
|
"ELASTICSEARCH_URL": settings.elasticsearch_url,
|
||||||
|
"ELASTICSEARCH_API_KEY": settings.elasticsearch_api_key,
|
||||||
|
}
|
||||||
|
base.update(
|
||||||
|
{
|
||||||
|
key: value
|
||||||
|
for key, value in nes_environment.items()
|
||||||
|
if value
|
||||||
|
}
|
||||||
|
)
|
||||||
return {**base, **(definition.env or {})}
|
return {**base, **(definition.env or {})}
|
||||||
|
|
||||||
|
|
||||||
@@ -200,15 +284,26 @@ def start_run(
|
|||||||
session.refresh(run)
|
session.refresh(run)
|
||||||
return run
|
return run
|
||||||
|
|
||||||
|
run_options: dict[str, object] = {
|
||||||
|
"image": image,
|
||||||
|
"command": resolve_command(definition),
|
||||||
|
"environment": resolve_environment(definition),
|
||||||
|
"detach": True,
|
||||||
|
"name": container_name(definition, run),
|
||||||
|
"remove": False,
|
||||||
|
}
|
||||||
|
data_dir = persistent_dir(definition)
|
||||||
|
volumes = container_volumes(definition)
|
||||||
|
if volumes:
|
||||||
|
run_options["volumes"] = volumes
|
||||||
|
if data_dir and definition.persistent_dir is None:
|
||||||
|
logger.info(
|
||||||
|
"Using orgminer auto-resume data directory '%s' for run %s.",
|
||||||
|
data_dir,
|
||||||
|
run.id,
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
container = get_docker_client().containers.run(
|
container = get_docker_client().containers.run(**run_options)
|
||||||
image=image,
|
|
||||||
command=resolve_command(definition),
|
|
||||||
environment=resolve_environment(definition),
|
|
||||||
detach=True,
|
|
||||||
name=container_name(definition, run),
|
|
||||||
remove=False,
|
|
||||||
)
|
|
||||||
run.container_id = container.id
|
run.container_id = container.id
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
run.status = JobRunStatus.FAILED
|
run.status = JobRunStatus.FAILED
|
||||||
@@ -336,7 +431,16 @@ def _reconcile_runs(session: Session) -> None:
|
|||||||
|
|
||||||
container.reload()
|
container.reload()
|
||||||
if container.status in ("exited", "dead"):
|
if container.status in ("exited", "dead"):
|
||||||
exit_code = container.attrs["State"]["ExitCode"]
|
state = container.attrs.get("State", {})
|
||||||
|
exit_code = state["ExitCode"]
|
||||||
|
logs = container.logs().decode("utf-8", errors="replace")
|
||||||
|
if state.get("OOMKilled"):
|
||||||
|
logs = append_system_log(
|
||||||
|
logs,
|
||||||
|
"The container ran out of memory and was killed by the kernel "
|
||||||
|
f"(exit {exit_code}). No Python traceback is written for this; "
|
||||||
|
"the log above simply stops.",
|
||||||
|
)
|
||||||
new_status = (
|
new_status = (
|
||||||
JobRunStatus.SUCCEEDED if exit_code == 0 else JobRunStatus.FAILED
|
JobRunStatus.SUCCEEDED if exit_code == 0 else JobRunStatus.FAILED
|
||||||
)
|
)
|
||||||
@@ -345,7 +449,7 @@ def _reconcile_runs(session: Session) -> None:
|
|||||||
run,
|
run,
|
||||||
new_status=new_status,
|
new_status=new_status,
|
||||||
exit_code=exit_code,
|
exit_code=exit_code,
|
||||||
logs=container.logs().decode("utf-8", errors="replace"),
|
logs=logs,
|
||||||
)
|
)
|
||||||
if applied:
|
if applied:
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ def _to_task(session: Session, definition: JobDefinition) -> BackgroundJobTask:
|
|||||||
image=definition.image,
|
image=definition.image,
|
||||||
command=definition.command,
|
command=definition.command,
|
||||||
env=definition.env or {},
|
env=definition.env or {},
|
||||||
|
persistent_dir=definition.persistent_dir,
|
||||||
|
stop_timeout_seconds=definition.stop_timeout_seconds,
|
||||||
schedule=definition.schedule,
|
schedule=definition.schedule,
|
||||||
enabled=definition.enabled,
|
enabled=definition.enabled,
|
||||||
next_run_at=definition.next_run_at,
|
next_run_at=definition.next_run_at,
|
||||||
@@ -141,6 +143,8 @@ def create_task(
|
|||||||
target_index=payload.target_index,
|
target_index=payload.target_index,
|
||||||
schedule=payload.schedule,
|
schedule=payload.schedule,
|
||||||
enabled=payload.enabled,
|
enabled=payload.enabled,
|
||||||
|
persistent_dir=payload.persistent_dir,
|
||||||
|
stop_timeout_seconds=payload.stop_timeout_seconds,
|
||||||
)
|
)
|
||||||
if definition.enabled and definition.schedule:
|
if definition.enabled and definition.schedule:
|
||||||
definition.next_run_at = runner.compute_next_run(definition.schedule)
|
definition.next_run_at = runner.compute_next_run(definition.schedule)
|
||||||
@@ -166,6 +170,11 @@ def delete_task(
|
|||||||
).all()
|
).all()
|
||||||
for run in runs:
|
for run in runs:
|
||||||
session.delete(run)
|
session.delete(run)
|
||||||
|
volume_name = f"bgjob-{definition.id}-data"
|
||||||
|
try:
|
||||||
|
runner.get_docker_client().volumes.get(volume_name).remove()
|
||||||
|
except NotFound:
|
||||||
|
pass
|
||||||
session.delete(definition)
|
session.delete(definition)
|
||||||
session.commit()
|
session.commit()
|
||||||
logger.info(
|
logger.info(
|
||||||
@@ -331,7 +340,11 @@ def stop_run(
|
|||||||
stopped_by_request = False
|
stopped_by_request = False
|
||||||
if container.status not in ("exited", "dead"):
|
if container.status not in ("exited", "dead"):
|
||||||
try:
|
try:
|
||||||
container.stop(timeout=2)
|
definition = session.get(JobDefinition, run.definition_id)
|
||||||
|
# Docker stop blocks while waiting and holds RUN_STATE_LOCK for this time.
|
||||||
|
container.stop(
|
||||||
|
timeout=definition.stop_timeout_seconds if definition else 2
|
||||||
|
)
|
||||||
stopped_by_request = True
|
stopped_by_request = True
|
||||||
except APIError as error:
|
except APIError as error:
|
||||||
if error.status_code != 304:
|
if error.status_code != 304:
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
from types import SimpleNamespace
|
||||||
|
|
||||||
|
from . import runner
|
||||||
|
from .model import JobDefinition
|
||||||
|
|
||||||
|
|
||||||
|
def _settings():
|
||||||
|
return SimpleNamespace(
|
||||||
|
background_jobs_image="docker.nes.uni-due.de/inse/background-jobs:latest",
|
||||||
|
elasticsearch_url="https://nes.example/elastic",
|
||||||
|
elasticsearch_api_key="nes-api-key",
|
||||||
|
elasticsearch_inse_url="https://inse.example/elastic",
|
||||||
|
elasticsearch_inse_api_key="inse-api-key",
|
||||||
|
llm_api_url="https://llm.example",
|
||||||
|
llm_api_key="llm-api-key",
|
||||||
|
llm_model="test-model",
|
||||||
|
sentence_transformers_model_name="test-embedding-model",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _job(image: str) -> JobDefinition:
|
||||||
|
return JobDefinition(name="test", image=image)
|
||||||
|
|
||||||
|
|
||||||
|
def test_nes_credentials_are_injected_only_for_verified_person_image(monkeypatch):
|
||||||
|
monkeypatch.setattr(runner, "settings", _settings())
|
||||||
|
verified_image = (
|
||||||
|
"docker.nes.uni-due.de/inse/jobs/orgminer-verified-persons-ude:v1"
|
||||||
|
)
|
||||||
|
regular_image = "docker.nes.uni-due.de/inse/jobs/news-topics:latest"
|
||||||
|
|
||||||
|
verified_environment = runner.resolve_environment(_job(verified_image))
|
||||||
|
regular_environment = runner.resolve_environment(_job(regular_image))
|
||||||
|
|
||||||
|
assert verified_environment["ELASTICSEARCH_URL"] == "https://nes.example/elastic"
|
||||||
|
assert verified_environment["ELASTICSEARCH_API_KEY"] == "nes-api-key"
|
||||||
|
assert regular_environment["ELASTICSEARCH_INSE_API_KEY"] == "inse-api-key"
|
||||||
|
assert "ELASTICSEARCH_URL" not in regular_environment
|
||||||
|
assert "ELASTICSEARCH_API_KEY" not in regular_environment
|
||||||
|
|
||||||
|
|
||||||
|
def test_nes_credentials_are_not_injected_for_non_registry_copy(monkeypatch):
|
||||||
|
monkeypatch.setattr(runner, "settings", _settings())
|
||||||
|
local_image = "localhost/inse/jobs/orgminer-verified-persons-ude:dev"
|
||||||
|
|
||||||
|
environment = runner.resolve_environment(_job(local_image))
|
||||||
|
|
||||||
|
assert "ELASTICSEARCH_URL" not in environment
|
||||||
|
assert "ELASTICSEARCH_API_KEY" not in environment
|
||||||
@@ -12,10 +12,16 @@ from .model import JobRun, JobRunStatus, JobTriggeredBy
|
|||||||
|
|
||||||
class FakeContainer:
|
class FakeContainer:
|
||||||
def __init__(
|
def __init__(
|
||||||
self, *, status: str, exit_code: int, logs: str, stop_error=None
|
self,
|
||||||
|
*,
|
||||||
|
status: str,
|
||||||
|
exit_code: int,
|
||||||
|
logs: str,
|
||||||
|
stop_error=None,
|
||||||
|
oom_killed: bool = False,
|
||||||
):
|
):
|
||||||
self.status = status
|
self.status = status
|
||||||
self.attrs = {"State": {"ExitCode": exit_code}}
|
self.attrs = {"State": {"ExitCode": exit_code, "OOMKilled": oom_killed}}
|
||||||
self._logs = logs
|
self._logs = logs
|
||||||
self.stop_calls = 0
|
self.stop_calls = 0
|
||||||
self.removed = False
|
self.removed = False
|
||||||
@@ -126,6 +132,26 @@ def test_reconciler_keeps_running_container_after_backend_restart(
|
|||||||
assert container.removed is False
|
assert container.removed is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_reconciler_annotates_container_killed_by_oom(session, monkeypatch):
|
||||||
|
run = _run(session)
|
||||||
|
container = FakeContainer(
|
||||||
|
status="exited",
|
||||||
|
exit_code=137,
|
||||||
|
logs="last org: https://www.uni-due.de/zmb",
|
||||||
|
oom_killed=True,
|
||||||
|
)
|
||||||
|
_use_container(monkeypatch, container)
|
||||||
|
|
||||||
|
runner.reconcile_runs(session)
|
||||||
|
session.refresh(run)
|
||||||
|
|
||||||
|
assert run.status == JobRunStatus.FAILED
|
||||||
|
assert run.exit_code == 137
|
||||||
|
assert "last org: https://www.uni-due.de/zmb" in run.logs
|
||||||
|
assert "ran out of memory" in run.logs
|
||||||
|
assert container.removed is True
|
||||||
|
|
||||||
|
|
||||||
def test_failed_docker_stop_leaves_database_run_running(session, monkeypatch):
|
def test_failed_docker_stop_leaves_database_run_running(session, monkeypatch):
|
||||||
run = _run(session)
|
run = _run(session)
|
||||||
container = FakeContainer(
|
container = FakeContainer(
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ class Settings(BaseSettings):
|
|||||||
# Docker SDK inside the service container, which has no `docker login` creds.
|
# Docker SDK inside the service container, which has no `docker login` creds.
|
||||||
background_jobs_registry_username: str | None = None
|
background_jobs_registry_username: str | None = None
|
||||||
background_jobs_registry_password: str | None = None
|
background_jobs_registry_password: str | None = None
|
||||||
|
orgminer_data_volume: str = "smartguide-data"
|
||||||
|
|
||||||
# Sentence Transformers config
|
# Sentence Transformers config
|
||||||
sentence_transformers_model_name: str = "intfloat/multilingual-e5-base"
|
sentence_transformers_model_name: str = "intfloat/multilingual-e5-base"
|
||||||
@@ -92,7 +93,7 @@ class Settings(BaseSettings):
|
|||||||
environment: Literal["dev", "prod"] = "dev"
|
environment: Literal["dev", "prod"] = "dev"
|
||||||
|
|
||||||
token_issuer_id: str | None = None
|
token_issuer_id: str | None = None
|
||||||
token_hmac_key: str | None = None
|
token_hmac_key: str | None = "92fb8c1e6f1e868567552e02cdd3693bca689d80a09ee13207b73ab53f42bb81"
|
||||||
|
|
||||||
skip_otk_validation: bool = True
|
skip_otk_validation: bool = True
|
||||||
# SMTP / email config
|
# SMTP / email config
|
||||||
|
|||||||
@@ -81,6 +81,25 @@ def _migrate_secret_table():
|
|||||||
def create_db_and_tables():
|
def create_db_and_tables():
|
||||||
"""Creates the database and tables based on the SQLModel metadata."""
|
"""Creates the database and tables based on the SQLModel metadata."""
|
||||||
SQLModel.metadata.create_all(engine)
|
SQLModel.metadata.create_all(engine)
|
||||||
|
background_job_columns = {
|
||||||
|
column["name"]
|
||||||
|
for column in inspect(engine).get_columns("background_job_definition")
|
||||||
|
}
|
||||||
|
with engine.begin() as connection:
|
||||||
|
if "persistent_dir" not in background_job_columns:
|
||||||
|
connection.execute(
|
||||||
|
text(
|
||||||
|
"ALTER TABLE background_job_definition "
|
||||||
|
"ADD COLUMN persistent_dir VARCHAR"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if "stop_timeout_seconds" not in background_job_columns:
|
||||||
|
connection.execute(
|
||||||
|
text(
|
||||||
|
"ALTER TABLE background_job_definition "
|
||||||
|
"ADD COLUMN stop_timeout_seconds INTEGER NOT NULL DEFAULT 10"
|
||||||
|
)
|
||||||
|
)
|
||||||
hierarchy_edit_columns = {
|
hierarchy_edit_columns = {
|
||||||
column["name"] for column in inspect(engine).get_columns("hierarchy_edits")
|
column["name"] for column in inspect(engine).get_columns("hierarchy_edits")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,34 @@ class NotFoundException(Exception):
|
|||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
||||||
|
class ResearcherDataUnavailableException(NotFoundException):
|
||||||
|
"""Raised when no multiplicator document exists for an author.
|
||||||
|
|
||||||
|
The ``reason`` tells the client *why* the person is missing, so the UI can
|
||||||
|
explain it instead of showing a generic error page:
|
||||||
|
|
||||||
|
``NOT_INDEXED`` the author belongs to the institution but the pipeline
|
||||||
|
produced no document for them,
|
||||||
|
``OTHER_INSTITUTION`` the author's current affiliations are elsewhere,
|
||||||
|
``UNKNOWN_AUTHOR`` OpenAlex does not know the author at all.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
message: str,
|
||||||
|
*,
|
||||||
|
reason: str,
|
||||||
|
author_id: str | None = None,
|
||||||
|
display_name: str | None = None,
|
||||||
|
author_institution: str | None = None,
|
||||||
|
):
|
||||||
|
super().__init__(message)
|
||||||
|
self.reason = reason
|
||||||
|
self.author_id = author_id
|
||||||
|
self.display_name = display_name
|
||||||
|
self.author_institution = author_institution
|
||||||
|
|
||||||
|
|
||||||
class ElasticsearchException(Exception):
|
class ElasticsearchException(Exception):
|
||||||
"""Base exception for all Elasticsearch integrations."""
|
"""Base exception for all Elasticsearch integrations."""
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,8 @@ def _index_to_cluster(index: ESIndex) -> ESCluster | None:
|
|||||||
ESIndex.DFG_PROJECTS_V2,
|
ESIndex.DFG_PROJECTS_V2,
|
||||||
ESIndex.DFG_INSTITUTES_V2,
|
ESIndex.DFG_INSTITUTES_V2,
|
||||||
ESIndex.PROJECTS_DFG_OPENALEX_TOPICS,
|
ESIndex.PROJECTS_DFG_OPENALEX_TOPICS,
|
||||||
|
ESIndex.MULTIPLICATORS_V1,
|
||||||
|
ESIndex.MULTIPLICATOR_NETWORKS_V1,
|
||||||
}:
|
}:
|
||||||
return ESCluster.INSE
|
return ESCluster.INSE
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ from inse.exceptions import (
|
|||||||
ElasticsearchException,
|
ElasticsearchException,
|
||||||
MissingApiKeyError,
|
MissingApiKeyError,
|
||||||
NotFoundException,
|
NotFoundException,
|
||||||
|
ResearcherDataUnavailableException,
|
||||||
UpstreamAPIException,
|
UpstreamAPIException,
|
||||||
)
|
)
|
||||||
from inse.funders.service import router as funders_service_router
|
from inse.funders.service import router as funders_service_router
|
||||||
@@ -37,6 +38,7 @@ from inse.keywords.service import router as keywords_service_router
|
|||||||
|
|
||||||
# caching
|
# caching
|
||||||
from inse.middleware.etag_cache import ETagCacheMiddleware
|
from inse.middleware.etag_cache import ETagCacheMiddleware
|
||||||
|
from inse.multiplicators.router import router as multiplicators_router
|
||||||
from inse.news.service import router as news_service_router
|
from inse.news.service import router as news_service_router
|
||||||
from inse.organization_management.router import router as organization_management_router
|
from inse.organization_management.router import router as organization_management_router
|
||||||
from inse.patents.keywords.service import router as keywords_patents_router
|
from inse.patents.keywords.service import router as keywords_patents_router
|
||||||
@@ -136,6 +138,7 @@ app.include_router(background_jobs_router)
|
|||||||
app.include_router(orgminer_router)
|
app.include_router(orgminer_router)
|
||||||
|
|
||||||
app.include_router(eu_organizations_router)
|
app.include_router(eu_organizations_router)
|
||||||
|
app.include_router(multiplicators_router)
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
ETagCacheMiddleware,
|
ETagCacheMiddleware,
|
||||||
ttl=600, # 10 minutes expiration time
|
ttl=600, # 10 minutes expiration time
|
||||||
@@ -158,6 +161,23 @@ async def handle_not_found(request: Request, exc: NotFoundException):
|
|||||||
return JSONResponse(status_code=404, content={"message": str(exc)})
|
return JSONResponse(status_code=404, content={"message": str(exc)})
|
||||||
|
|
||||||
|
|
||||||
|
@app.exception_handler(ResearcherDataUnavailableException)
|
||||||
|
async def handle_researcher_unavailable(
|
||||||
|
request: Request, exc: ResearcherDataUnavailableException
|
||||||
|
):
|
||||||
|
"""404 with a machine-readable reason, so the UI can explain the gap."""
|
||||||
|
return JSONResponse(
|
||||||
|
status_code=404,
|
||||||
|
content={
|
||||||
|
"message": str(exc),
|
||||||
|
"reason": exc.reason,
|
||||||
|
"author_id": exc.author_id,
|
||||||
|
"display_name": exc.display_name,
|
||||||
|
"author_institution": exc.author_institution,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.exception_handler(ElasticsearchException)
|
@app.exception_handler(ElasticsearchException)
|
||||||
async def handle_elasticsearch_error(request: Request, exc: ElasticsearchException):
|
async def handle_elasticsearch_error(request: Request, exc: ElasticsearchException):
|
||||||
logger.error("Elasticsearch integration error: %s", str(exc))
|
logger.error("Elasticsearch integration error: %s", str(exc))
|
||||||
|
|||||||
@@ -123,7 +123,10 @@ class ESIndex(StrEnum):
|
|||||||
PROJECTS_CORDIS_EU_H2020_TOPICS = "projects_cordiseu_h2020_openalex_topics"
|
PROJECTS_CORDIS_EU_H2020_TOPICS = "projects_cordiseu_h2020_openalex_topics"
|
||||||
PROJECTS_CORDIS_EU_HEUROPE_TOPICS = "projects_cordiseu_heurope_openalex_topics"
|
PROJECTS_CORDIS_EU_HEUROPE_TOPICS = "projects_cordiseu_heurope_openalex_topics"
|
||||||
PATENTS_OPENALEX_KEYWORDS = "patents_openalex_keywords"
|
PATENTS_OPENALEX_KEYWORDS = "patents_openalex_keywords"
|
||||||
|
|
||||||
|
MULTIPLICATORS_V1 = "multiplicators_v1"
|
||||||
|
MULTIPLICATOR_NETWORKS_V1 = "multiplicator_networks_v1"
|
||||||
|
|
||||||
UDE_ORGANIZATION_CONTENT = "ude_organization_content_august_2025_draft"
|
UDE_ORGANIZATION_CONTENT = "ude_organization_content_august_2025_draft"
|
||||||
TUD_ORGANIZATION_CONTENT = "tud_organization_content_test_genja"
|
TUD_ORGANIZATION_CONTENT = "tud_organization_content_test_genja"
|
||||||
RUB_ORGANIZATION_CONTENT = "placeholder.."
|
RUB_ORGANIZATION_CONTENT = "placeholder.."
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
{
|
||||||
|
"model": "lightgbm_symmetric_founder_classifier_v2",
|
||||||
|
"design": "symmetric landmark (see experiments/src/symmetric.py)",
|
||||||
|
"reference_cohort_size": 9017,
|
||||||
|
"reference_founders": 2349,
|
||||||
|
"oof_roc_auc": 0.8659,
|
||||||
|
"oof_pr_auc": 0.7257,
|
||||||
|
"importance_metric": "mean ROC-AUC drop under feature permutation (out-of-fold)",
|
||||||
|
"importances": [
|
||||||
|
{
|
||||||
|
"feature": "patent_research_area_n.",
|
||||||
|
"importance_mean": 0.1044,
|
||||||
|
"importance_std": 0.01
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "pub_rate",
|
||||||
|
"importance_mean": 0.082,
|
||||||
|
"importance_std": 0.0103
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "first_publication_year",
|
||||||
|
"importance_mean": 0.0548,
|
||||||
|
"importance_std": 0.006
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "industry_collab_at_index",
|
||||||
|
"importance_mean": 0.0455,
|
||||||
|
"importance_std": 0.0047
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "career_age_at_index",
|
||||||
|
"importance_mean": 0.0303,
|
||||||
|
"importance_std": 0.0061
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "patents_at_index",
|
||||||
|
"importance_mean": 0.0279,
|
||||||
|
"importance_std": 0.0037
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "patent_rate",
|
||||||
|
"importance_mean": 0.0226,
|
||||||
|
"importance_std": 0.0028
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "patent_research_area_46",
|
||||||
|
"importance_mean": 0.0207,
|
||||||
|
"importance_std": 0.0047
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "publication_research_area_32",
|
||||||
|
"importance_mean": 0.015,
|
||||||
|
"importance_std": 0.0027
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "years_since_first_grant",
|
||||||
|
"importance_mean": 0.0091,
|
||||||
|
"importance_std": 0.0028
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "grant_research_area_51",
|
||||||
|
"importance_mean": 0.0084,
|
||||||
|
"importance_std": 0.0018
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"feature": "institution_berkeley",
|
||||||
|
"importance_mean": 0.0071,
|
||||||
|
"importance_std": 0.0021
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"horizon_models": [
|
||||||
|
{
|
||||||
|
"horizon_years": 1,
|
||||||
|
"model": "lightgbm_symmetric_p_within_1y_v2",
|
||||||
|
"oof_roc_auc": 0.8614,
|
||||||
|
"oof_pr_auc": 0.7154
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"horizon_years": 3,
|
||||||
|
"model": "lightgbm_symmetric_p_within_3y_v2",
|
||||||
|
"oof_roc_auc": 0.861,
|
||||||
|
"oof_pr_auc": 0.7176
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"horizon_years": 5,
|
||||||
|
"model": "lightgbm_symmetric_p_within_5y_v2",
|
||||||
|
"oof_roc_auc": 0.8535,
|
||||||
|
"oof_pr_auc": 0.7038
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"caveats": [
|
||||||
|
"The top feature patent_research_area_n. is constant across this deployment's cohort (the patent corpus has no IPC-to-FOR mapping, so every patent research area is the unknown token) - it separated classes in training but separates nothing locally.",
|
||||||
|
"Importances describe the trained model on its training distribution, not the local cohort.",
|
||||||
|
"institution_* features were one-hot encoded in the research experiments; the production bundle drops them, so their listed importance does not apply to deployed scores."
|
||||||
|
],
|
||||||
|
"source": "service/scripts/profiling/founding_potential/results/rq1_symmetric/permutation_importance.csv + production/classifier_symmetric/manifest.json"
|
||||||
|
}
|
||||||
@@ -0,0 +1,581 @@
|
|||||||
|
"""Models for the multiplicator and founder-potential indices.
|
||||||
|
|
||||||
|
Two different ranking scales live in the same source document, and the field
|
||||||
|
names here keep them apart:
|
||||||
|
|
||||||
|
*_external_percentile 0-100, ranked against a fixed reference cohort of
|
||||||
|
academics at OTHER universities.
|
||||||
|
*_peer_rank 0-1, ranked against same-university peers in the same
|
||||||
|
career stage.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from enum import StrEnum
|
||||||
|
|
||||||
|
from pydantic import BaseModel, ConfigDict, Field
|
||||||
|
|
||||||
|
from inse.model import Page
|
||||||
|
|
||||||
|
# Dimensions FOR 2-digit division names, matching FOR_NAMES in
|
||||||
|
# scripts/profiling/multipliers/founding_stats.py.
|
||||||
|
FOR_DIVISION_NAMES: dict[str, str] = {
|
||||||
|
"30": "Agricultural, Veterinary & Food Sciences",
|
||||||
|
"31": "Biological Sciences",
|
||||||
|
"32": "Biomedical & Clinical Sciences",
|
||||||
|
"34": "Chemical Sciences",
|
||||||
|
"35": "Commerce, Management, Tourism & Services",
|
||||||
|
"36": "Creative Arts & Writing",
|
||||||
|
"37": "Earth Sciences",
|
||||||
|
"38": "Economics",
|
||||||
|
"40": "Engineering",
|
||||||
|
"41": "Environmental Sciences",
|
||||||
|
"42": "Health Sciences",
|
||||||
|
"44": "Human Society",
|
||||||
|
"46": "Information & Computing Sciences",
|
||||||
|
"49": "Mathematical Sciences",
|
||||||
|
"51": "Physical Sciences",
|
||||||
|
"52": "Psychology",
|
||||||
|
"n.": "unknown / not classified",
|
||||||
|
}
|
||||||
|
|
||||||
|
UNKNOWN_RESEARCH_AREA = "n."
|
||||||
|
|
||||||
|
|
||||||
|
class CareerBucket(StrEnum):
|
||||||
|
EARLY = "Early"
|
||||||
|
EMERGING = "Emerging"
|
||||||
|
ESTABLISHED = "Established"
|
||||||
|
SENIOR = "Senior"
|
||||||
|
|
||||||
|
|
||||||
|
CAREER_BUCKET_ORDER: list[CareerBucket] = [
|
||||||
|
CareerBucket.EARLY,
|
||||||
|
CareerBucket.EMERGING,
|
||||||
|
CareerBucket.ESTABLISHED,
|
||||||
|
CareerBucket.SENIOR,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class MultiplierTag(StrEnum):
|
||||||
|
BRIDGER = "bridger"
|
||||||
|
MENTOR = "mentor"
|
||||||
|
AMPLIFIER = "amplifier"
|
||||||
|
|
||||||
|
|
||||||
|
class PeerRankField(StrEnum):
|
||||||
|
BRIDGER = "bridger"
|
||||||
|
MENTOR = "mentor"
|
||||||
|
AMPLIFIER = "amplifier"
|
||||||
|
MAX = "max"
|
||||||
|
|
||||||
|
|
||||||
|
class FounderSortBy(StrEnum):
|
||||||
|
EXTERNAL_PERCENTILE = "external_percentile"
|
||||||
|
WITHIN_1Y = "within_1y"
|
||||||
|
WITHIN_3Y = "within_3y"
|
||||||
|
WITHIN_5Y = "within_5y"
|
||||||
|
PUBLICATIONS = "publications"
|
||||||
|
PATENTS = "patents"
|
||||||
|
ACTIVE_YEARS = "active_years"
|
||||||
|
|
||||||
|
|
||||||
|
class ResearcherSortBy(StrEnum):
|
||||||
|
BRIDGER = "bridger"
|
||||||
|
MENTOR = "mentor"
|
||||||
|
AMPLIFIER = "amplifier"
|
||||||
|
MAX = "max"
|
||||||
|
|
||||||
|
|
||||||
|
class FounderScreenReason(StrEnum):
|
||||||
|
"""Why a researcher fails the data-quality screen."""
|
||||||
|
|
||||||
|
MERGED_PROFILE = "MERGED_PROFILE"
|
||||||
|
IMPLAUSIBLE_CAREER_LENGTH = "IMPLAUSIBLE_CAREER_LENGTH"
|
||||||
|
UNKNOWN_CAREER_LENGTH = "UNKNOWN_CAREER_LENGTH"
|
||||||
|
THIN_PROFILE = "THIN_PROFILE"
|
||||||
|
OUT_OF_POPULATION = "OUT_OF_POPULATION"
|
||||||
|
|
||||||
|
|
||||||
|
class FunnelStageKey(StrEnum):
|
||||||
|
ALL = "ALL"
|
||||||
|
IN_POPULATION = "IN_POPULATION"
|
||||||
|
NOT_SUSPICIOUS = "NOT_SUSPICIOUS"
|
||||||
|
CAREER_AGE_PLAUSIBLE = "CAREER_AGE_PLAUSIBLE"
|
||||||
|
MIN_PUBLICATIONS = "MIN_PUBLICATIONS"
|
||||||
|
|
||||||
|
|
||||||
|
class ShowcaseKind(StrEnum):
|
||||||
|
BRIDGER = "bridger"
|
||||||
|
MENTOR = "mentor"
|
||||||
|
AMPLIFIER = "amplifier"
|
||||||
|
EXAMPLE = "example"
|
||||||
|
|
||||||
|
|
||||||
|
class ResearcherUnavailableReason(StrEnum):
|
||||||
|
"""Why no multiplicator document exists for a requested author."""
|
||||||
|
|
||||||
|
#: The author is an active member of this university, but the pipeline has
|
||||||
|
#: no document for them yet.
|
||||||
|
NOT_INDEXED = "NOT_INDEXED"
|
||||||
|
#: The author's current affiliations are at other institutions.
|
||||||
|
OTHER_INSTITUTION = "OTHER_INSTITUTION"
|
||||||
|
#: OpenAlex has no author with this id.
|
||||||
|
UNKNOWN_AUTHOR = "UNKNOWN_AUTHOR"
|
||||||
|
|
||||||
|
|
||||||
|
class MultiplicatorsBase(BaseModel):
|
||||||
|
"""Ignores unknown source keys so retired index fields never leak out."""
|
||||||
|
|
||||||
|
model_config = ConfigDict(extra="ignore")
|
||||||
|
|
||||||
|
|
||||||
|
class MultiplierPeerRanks(MultiplicatorsBase):
|
||||||
|
"""Sub-scores, 0-1, ranked within this university and career stage."""
|
||||||
|
|
||||||
|
bridger: float = Field(default=0.0, description="Bridger sub-score (0-1).")
|
||||||
|
mentor: float = Field(default=0.0, description="Mentor sub-score (0-1).")
|
||||||
|
amplifier: float = Field(default=0.0, description="Amplifier sub-score (0-1).")
|
||||||
|
|
||||||
|
|
||||||
|
class MetricValue(MultiplicatorsBase):
|
||||||
|
"""A raw metric next to its peer rank."""
|
||||||
|
|
||||||
|
raw: float | None = Field(
|
||||||
|
default=None, description="The raw metric value in its own units."
|
||||||
|
)
|
||||||
|
peer_rank: float | None = Field(
|
||||||
|
default=None,
|
||||||
|
description=(
|
||||||
|
"Rank of this metric (0-1) against same-university peers in the same "
|
||||||
|
"career stage. Null when the metric does not feed any sub-score."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderTiming(MultiplicatorsBase):
|
||||||
|
"""Sequence-model timing estimate.
|
||||||
|
|
||||||
|
Only present when the models are applicable to this profile; when
|
||||||
|
`timing_applicable` is false this whole object is null, because the estimate
|
||||||
|
is anchored on a publication debut year that is unreliable for merged
|
||||||
|
profiles and outside the 1-20 year career range the models were trained on.
|
||||||
|
"""
|
||||||
|
|
||||||
|
predicted_founding_age: float | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="How many years into a career this activity pattern looks like a founding moment.",
|
||||||
|
)
|
||||||
|
predicted_founding_age_cross_check: float | None = Field(
|
||||||
|
default=None, description="The second model's estimate, as a cross-check."
|
||||||
|
)
|
||||||
|
years_to_founding: float | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="predicted_founding_age minus current_career_age. <= 0 means the profile already looks founding-ready.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderPotential(MultiplicatorsBase):
|
||||||
|
"""Founder-propensity model output for one researcher."""
|
||||||
|
|
||||||
|
external_percentile: float | None = Field(
|
||||||
|
default=None,
|
||||||
|
description=(
|
||||||
|
"Rank (0-100) of this person's founder propensity against a fixed reference "
|
||||||
|
"cohort of ~9,000 academics at other universities. NULL means the person is "
|
||||||
|
"outside the model's scoring population - unscored, NOT zero. Never treat "
|
||||||
|
"null as a low score."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
external_percentile_within_1y: float | None = Field(
|
||||||
|
default=None, description="Same scale, for 'founds within 1 year of the index'."
|
||||||
|
)
|
||||||
|
external_percentile_within_3y: float | None = Field(
|
||||||
|
default=None, description="Same scale, for 'founds within 3 years of the index'."
|
||||||
|
)
|
||||||
|
external_percentile_within_5y: float | None = Field(
|
||||||
|
default=None, description="Same scale, for 'founds within 5 years of the index'."
|
||||||
|
)
|
||||||
|
in_reference_population: bool = Field(
|
||||||
|
default=False,
|
||||||
|
description=(
|
||||||
|
"Whether the model considers this person scoreable (at least 4 publications). "
|
||||||
|
"Below it the training classes come from clashing sampling frames and the "
|
||||||
|
"scores are not evidence, so such people must not be ranked."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
timing_applicable: bool = Field(
|
||||||
|
default=False,
|
||||||
|
description="Whether the sequence timing models apply to this profile. When false, `timing` is null.",
|
||||||
|
)
|
||||||
|
current_career_age: int | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="Scoring year minus first publication year.",
|
||||||
|
)
|
||||||
|
timing: FounderTiming | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="Timing estimate; null when `timing_applicable` is false.",
|
||||||
|
)
|
||||||
|
as_of_year: int | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="The scoring year - the corpus's newest publication year, not the wall clock.",
|
||||||
|
)
|
||||||
|
patent_source: str | None = Field(
|
||||||
|
default=None,
|
||||||
|
description=(
|
||||||
|
"Which patent link quality fed the model's patent features. Scores computed "
|
||||||
|
"under different sources are not comparable."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
classifier_model: str | None = Field(
|
||||||
|
default=None, description="Which model bundle produced these numbers."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderFeatures(MultiplicatorsBase):
|
||||||
|
"""The exact input record the founder model saw, as coach-facing evidence."""
|
||||||
|
|
||||||
|
publications: int = Field(default=0, description="Lifetime publication count at the scoring year.")
|
||||||
|
patents: int = Field(default=0, description="Patent count. 0 means 'nothing found', not 'provably none'.")
|
||||||
|
grants: int = Field(default=0, description="Distinct grant ids acknowledged, raw.")
|
||||||
|
grants_capped: float | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="The de-inflated grant value the model effectively used (consortium lists inflate the raw count).",
|
||||||
|
)
|
||||||
|
industry_collab_papers: int = Field(
|
||||||
|
default=0, description="Works co-authored with at least one company-affiliated author."
|
||||||
|
)
|
||||||
|
linked_patents_to_publications: int = Field(
|
||||||
|
default=0,
|
||||||
|
description="Always 0 here - this corpus has no patent-to-paper citation graph.",
|
||||||
|
)
|
||||||
|
first_publication_year: int | None = Field(default=None)
|
||||||
|
first_patent_year: int | None = Field(default=None)
|
||||||
|
first_grant_year: int | None = Field(default=None)
|
||||||
|
publication_research_area: str | None = Field(
|
||||||
|
default=None, description="Modal Dimensions FOR 2-digit division of the person's works."
|
||||||
|
)
|
||||||
|
publication_research_area_label: str | None = Field(
|
||||||
|
default=None, description="Human-readable name for the code; null if the code is unknown."
|
||||||
|
)
|
||||||
|
grant_research_area: str | None = Field(
|
||||||
|
default=None, description="Modal FOR division of the works the person's grants funded."
|
||||||
|
)
|
||||||
|
grant_research_area_label: str | None = Field(default=None)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderScreen(MultiplicatorsBase):
|
||||||
|
"""Data-quality verdict for a founder candidate."""
|
||||||
|
|
||||||
|
passed: bool = Field(description="Whether the researcher passes every screen rule.")
|
||||||
|
reasons: list[FounderScreenReason] = Field(
|
||||||
|
default=[],
|
||||||
|
description=(
|
||||||
|
"Why the screen failed, in precedence order - reasons[0] is the headline "
|
||||||
|
"reason. Empty when `passed` is true."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ResearcherMetrics(MultiplicatorsBase):
|
||||||
|
"""Raw multiplier metrics paired with their peer ranks."""
|
||||||
|
|
||||||
|
betweenness: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
brokerage: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
constraint: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
field_entropy: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
cross_institution_share: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
strength: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
n_coauthors: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
juniors_mentored: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
junior_progression_rate: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
mentoring_rate: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
last_author_with_junior_first: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
industry_coauthor_share: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
industry_coauthor_share_shrunk: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
patent_count: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
cordis_eu_projects: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
news_mentions: MetricValue = Field(default_factory=MetricValue)
|
||||||
|
|
||||||
|
|
||||||
|
class ResearcherSummary(MultiplicatorsBase):
|
||||||
|
"""Compact researcher row shared by the list endpoints."""
|
||||||
|
|
||||||
|
author_id: str = Field(description="OpenAlex author id, short form (e.g. A5087456839).")
|
||||||
|
display_name: str | None = Field(default=None)
|
||||||
|
career_bucket: CareerBucket | None = Field(
|
||||||
|
default=None, description="Career stage; all peer ranks are computed within it."
|
||||||
|
)
|
||||||
|
active_years: int = Field(default=0, description="Distinct calendar years with at least one publication.")
|
||||||
|
n_works: int = Field(default=0)
|
||||||
|
suspicious_profile: bool = Field(
|
||||||
|
default=False,
|
||||||
|
description="Merged-identity heuristic (debut before 1970 or a span over 60 years). Treat evidence as low confidence.",
|
||||||
|
)
|
||||||
|
tags: list[MultiplierTag] = Field(
|
||||||
|
default=[], description="Archetypes this person qualifies for; a person can hold 0-3."
|
||||||
|
)
|
||||||
|
multiplier_peer_ranks: MultiplierPeerRanks = Field(default_factory=MultiplierPeerRanks)
|
||||||
|
max_multiplier_peer_rank: float = Field(
|
||||||
|
default=0.0, description="Best of the three sub-scores (0-1)."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderCandidate(ResearcherSummary):
|
||||||
|
"""A researcher with their founder-potential block and screen verdict."""
|
||||||
|
|
||||||
|
founder_potential: FounderPotential = Field(default_factory=FounderPotential)
|
||||||
|
founder_features: FounderFeatures = Field(default_factory=FounderFeatures)
|
||||||
|
screen: FounderScreen
|
||||||
|
|
||||||
|
|
||||||
|
class ResearcherDetail(ResearcherSummary):
|
||||||
|
"""Everything the index holds for one researcher."""
|
||||||
|
|
||||||
|
institution_id: str = Field(description="The primary institution this document belongs to.")
|
||||||
|
metrics: ResearcherMetrics = Field(default_factory=ResearcherMetrics)
|
||||||
|
founder_potential: FounderPotential = Field(default_factory=FounderPotential)
|
||||||
|
founder_features: FounderFeatures = Field(default_factory=FounderFeatures)
|
||||||
|
computed_at: str | None = Field(default=None, description="When the pipeline last wrote this document.")
|
||||||
|
config_hash: str | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="Which scoring configuration produced these numbers. Scores are weight-dependent.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderCandidatePage(Page[FounderCandidate]):
|
||||||
|
"""A paginated list of founder candidates."""
|
||||||
|
|
||||||
|
|
||||||
|
class ResearcherSummaryPage(Page[ResearcherSummary]):
|
||||||
|
"""A paginated list of researchers."""
|
||||||
|
|
||||||
|
|
||||||
|
class EgoNetworkNode(MultiplicatorsBase):
|
||||||
|
"""One person in an ego network. No layout coordinates - the client lays out."""
|
||||||
|
|
||||||
|
id: str = Field(description="OpenAlex author id, short form.")
|
||||||
|
name: str | None = Field(default=None)
|
||||||
|
role: str = Field(
|
||||||
|
description=(
|
||||||
|
"One of: ego, mentee, cohort, industry, external. `industry` is ego-relative: "
|
||||||
|
"the person holds a company affiliation on a work shared with the ego (see "
|
||||||
|
"`company_insts`). Typed as a string rather than an enum because the index is "
|
||||||
|
"rebuilt independently of this API."
|
||||||
|
)
|
||||||
|
)
|
||||||
|
inst: str | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="The person's most frequent institution across their works.",
|
||||||
|
)
|
||||||
|
active_years: int = Field(default=0)
|
||||||
|
suspicious: bool = Field(default=False)
|
||||||
|
company_insts: list[str] | None = Field(
|
||||||
|
default=None,
|
||||||
|
description=(
|
||||||
|
"Companies this person was affiliated with on works shared with the ego - "
|
||||||
|
"the basis for the industry role. Present on any role: a mentee or cohort "
|
||||||
|
"member with a company link keeps their role but still carries the names."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class EgoNetworkEdge(MultiplicatorsBase):
|
||||||
|
"""A collaboration tie between two nodes."""
|
||||||
|
|
||||||
|
a: str = Field(description="First author id (lexicographically smaller).")
|
||||||
|
b: str = Field(description="Second author id.")
|
||||||
|
w: float = Field(default=0.0, description="Decayed, team-size-weighted collaboration strength.")
|
||||||
|
n_works: int = Field(default=0, description="Raw shared-work count.")
|
||||||
|
cross: bool = Field(default=False, description="Whether the tie is mostly cross-institution.")
|
||||||
|
first_year: int | None = Field(default=None)
|
||||||
|
last_year: int | None = Field(default=None)
|
||||||
|
|
||||||
|
|
||||||
|
class EgoNetwork(MultiplicatorsBase):
|
||||||
|
"""One researcher's ego co-author network.
|
||||||
|
|
||||||
|
Node and edge positions are deliberately absent: a force layout on the client
|
||||||
|
(e.g. echarts' `graph` series) positions them at render time.
|
||||||
|
"""
|
||||||
|
|
||||||
|
author_id: str
|
||||||
|
display_name: str | None = Field(default=None)
|
||||||
|
career_bucket: CareerBucket | None = Field(default=None)
|
||||||
|
active_years: int = Field(default=0)
|
||||||
|
n_works: int = Field(default=0)
|
||||||
|
suspicious_profile: bool = Field(default=False)
|
||||||
|
tags: list[MultiplierTag] = Field(default=[])
|
||||||
|
multiplier_peer_ranks: MultiplierPeerRanks = Field(default_factory=MultiplierPeerRanks)
|
||||||
|
max_multiplier_peer_rank: float = Field(default=0.0)
|
||||||
|
total_coauthors: int = Field(default=0, description="All co-authors, not just the drawn ones.")
|
||||||
|
cohort_coauthors: int = Field(default=0, description="Co-authors inside this university's cohort.")
|
||||||
|
mentee_count: int = Field(default=0)
|
||||||
|
shown: int = Field(default=0, description="How many co-authors are in `nodes` (excluding the ego).")
|
||||||
|
shown_mentees: int = Field(default=0)
|
||||||
|
nodes: list[EgoNetworkNode] = Field(
|
||||||
|
default=[], description="nodes[0] is always the ego."
|
||||||
|
)
|
||||||
|
edges: list[EgoNetworkEdge] = Field(default=[])
|
||||||
|
computed_at: str | None = Field(default=None)
|
||||||
|
config_hash: str | None = Field(default=None)
|
||||||
|
|
||||||
|
|
||||||
|
class ShowcaseEntry(MultiplicatorsBase):
|
||||||
|
kind: ShowcaseKind = Field(
|
||||||
|
description="Which archetype this person illustrates; 'example' is the top scorer who just misses the tag threshold."
|
||||||
|
)
|
||||||
|
researcher: ResearcherSummary
|
||||||
|
|
||||||
|
|
||||||
|
class Showcase(MultiplicatorsBase):
|
||||||
|
institution_id: str
|
||||||
|
entries: list[ShowcaseEntry] = Field(
|
||||||
|
default=[], description="Up to four entries; fewer if an archetype has no tagged people."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FunnelStage(MultiplicatorsBase):
|
||||||
|
"""One cumulative stage of the data-quality funnel."""
|
||||||
|
|
||||||
|
key: FunnelStageKey
|
||||||
|
label: str = Field(description="Human-readable description of the rule applied at this stage.")
|
||||||
|
count: int = Field(description="How many researchers survive this stage and every earlier one.")
|
||||||
|
lost_from_previous: int = Field(default=0, description="How many the previous stage's set lost here.")
|
||||||
|
share_of_total: float = Field(default=0.0, description="count divided by the stage-0 total (0-1).")
|
||||||
|
|
||||||
|
|
||||||
|
class CareerStageStatistics(MultiplicatorsBase):
|
||||||
|
"""Founder-score distribution for one career stage (or all of them)."""
|
||||||
|
|
||||||
|
career_bucket: str = Field(description="A career stage name, or 'ALL' for the whole cohort.")
|
||||||
|
total: int = Field(default=0)
|
||||||
|
in_population: int = Field(default=0, description="Scoreable researchers - the pool percentiles are drawn from.")
|
||||||
|
screened: int = Field(default=0, description="How many pass the data-quality screen.")
|
||||||
|
shortlist_plain: int = Field(default=0, description="At or above the percentile threshold.")
|
||||||
|
shortlist_robust: int = Field(default=0, description="Also meeting the minimum publication count.")
|
||||||
|
percentile_p50: float | None = Field(default=None, description="Median founder percentile (approximate).")
|
||||||
|
percentile_p90: float | None = Field(default=None)
|
||||||
|
above_75: int = Field(default=0)
|
||||||
|
above_90: int = Field(default=0)
|
||||||
|
robust_percentile_p50: float | None = Field(default=None)
|
||||||
|
robust_percentile_p90: float | None = Field(default=None)
|
||||||
|
robust_above_75: int = Field(default=0)
|
||||||
|
robust_above_90: int = Field(default=0)
|
||||||
|
|
||||||
|
|
||||||
|
class ResearchAreaStatistics(MultiplicatorsBase):
|
||||||
|
"""How one research area is represented in the cohort versus the shortlist."""
|
||||||
|
|
||||||
|
code: str = Field(description="Dimensions FOR 2-digit division code.")
|
||||||
|
label: str | None = Field(default=None, description="Human-readable name; null if the code is unknown.")
|
||||||
|
cohort_count: int = Field(default=0)
|
||||||
|
cohort_share: float = Field(default=0.0, description="Share of the scoreable cohort (0-1).")
|
||||||
|
shortlist_count: int = Field(default=0)
|
||||||
|
shortlist_share: float = Field(default=0.0)
|
||||||
|
robust_count: int = Field(default=0)
|
||||||
|
robust_share: float = Field(default=0.0)
|
||||||
|
ratio: float | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="shortlist_share / cohort_share. Above 1 means over-represented. Null when the area is absent from the cohort.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ArchetypeOverlap(MultiplicatorsBase):
|
||||||
|
"""Overlap between one multiplier archetype and founder potential.
|
||||||
|
|
||||||
|
Counts are NOT mutually exclusive: a person holding two tags is counted under
|
||||||
|
both, so these do not sum to the shortlist size.
|
||||||
|
"""
|
||||||
|
|
||||||
|
tag: MultiplierTag
|
||||||
|
shortlist_count: int = Field(default=0, description="Shortlisted people carrying this tag.")
|
||||||
|
robust_count: int = Field(default=0)
|
||||||
|
soft_shortlist_count: int = Field(
|
||||||
|
default=0, description="Shortlisted people whose sub-score clears the softer threshold."
|
||||||
|
)
|
||||||
|
soft_robust_count: int = Field(default=0)
|
||||||
|
tagged_in_population: int = Field(
|
||||||
|
default=0, description="Scoreable people carrying this tag - the reverse direction."
|
||||||
|
)
|
||||||
|
tagged_percentile_p50: float | None = Field(default=None)
|
||||||
|
tagged_percentile_p90: float | None = Field(default=None)
|
||||||
|
tagged_above_band: int = Field(
|
||||||
|
default=0, description="Tagged people at or above the `tagged_band` percentile."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderStatisticsProvenance(MultiplicatorsBase):
|
||||||
|
institution_id: str
|
||||||
|
document_count: int = Field(description="Researchers indexed for this institution.")
|
||||||
|
computed_at: str | None = Field(default=None, description="When the pipeline last ran.")
|
||||||
|
config_hash: str | None = Field(default=None)
|
||||||
|
as_of_year: int | None = Field(default=None)
|
||||||
|
patent_sources: list[str] = Field(
|
||||||
|
default=[], description="Distinct patent link qualities present in this cohort."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderStatisticsParameters(MultiplicatorsBase):
|
||||||
|
"""The cutoffs these statistics were computed with, echoed back."""
|
||||||
|
|
||||||
|
percentile_threshold: float
|
||||||
|
min_publications: int
|
||||||
|
soft_peer_rank_threshold: float
|
||||||
|
max_career_age: int
|
||||||
|
tagged_band: float
|
||||||
|
|
||||||
|
|
||||||
|
class FounderStatistics(MultiplicatorsBase):
|
||||||
|
"""Everything the founder dashboard needs, in one response."""
|
||||||
|
|
||||||
|
provenance: FounderStatisticsProvenance
|
||||||
|
parameters: FounderStatisticsParameters
|
||||||
|
funnel: list[FunnelStage] = Field(default=[])
|
||||||
|
overall: CareerStageStatistics
|
||||||
|
career_stages: list[CareerStageStatistics] = Field(default=[])
|
||||||
|
research_areas: list[ResearchAreaStatistics] = Field(default=[])
|
||||||
|
archetypes: list[ArchetypeOverlap] = Field(default=[])
|
||||||
|
untagged_shortlist_count: int = Field(
|
||||||
|
default=0, description="Shortlisted people carrying no archetype tag at all."
|
||||||
|
)
|
||||||
|
untagged_robust_count: int = Field(default=0)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderFeatureImportance(MultiplicatorsBase):
|
||||||
|
feature: str
|
||||||
|
importance_mean: float
|
||||||
|
importance_std: float | None = Field(default=None)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderHorizonModel(MultiplicatorsBase):
|
||||||
|
horizon_years: int
|
||||||
|
model: str
|
||||||
|
oof_roc_auc: float | None = Field(default=None)
|
||||||
|
oof_pr_auc: float | None = Field(default=None)
|
||||||
|
|
||||||
|
|
||||||
|
class FounderModelInfo(MultiplicatorsBase):
|
||||||
|
"""Which model produced the founder scores, and what drives it.
|
||||||
|
|
||||||
|
These numbers describe the trained model itself, not any one university, so
|
||||||
|
they are identical for every caller.
|
||||||
|
"""
|
||||||
|
|
||||||
|
model_config = ConfigDict(extra="ignore", protected_namespaces=())
|
||||||
|
|
||||||
|
model: str = Field(description="The production model bundle name.")
|
||||||
|
design: str | None = Field(default=None)
|
||||||
|
reference_cohort_size: int | None = Field(
|
||||||
|
default=None, description="Rows in the training/reference cohort."
|
||||||
|
)
|
||||||
|
reference_founders: int | None = Field(default=None)
|
||||||
|
oof_roc_auc: float | None = Field(default=None, description="Out-of-fold ROC-AUC.")
|
||||||
|
oof_pr_auc: float | None = Field(default=None, description="Out-of-fold PR-AUC.")
|
||||||
|
importance_metric: str | None = Field(
|
||||||
|
default=None, description="What the importance numbers measure."
|
||||||
|
)
|
||||||
|
importances: list[FounderFeatureImportance] = Field(default=[])
|
||||||
|
horizon_models: list[FounderHorizonModel] = Field(default=[])
|
||||||
|
caveats: list[str] = Field(
|
||||||
|
default=[], description="Deployment caveats that must accompany these numbers."
|
||||||
|
)
|
||||||
|
source: str | None = Field(default=None, description="Where the numbers were exported from.")
|
||||||
@@ -0,0 +1,296 @@
|
|||||||
|
"""Routes for the multiplicator and founder-potential indices.
|
||||||
|
|
||||||
|
Every data route is scoped to the university of the logged-in user's
|
||||||
|
organization, taken from the access token - there is no institution parameter.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
|
from fastapi import APIRouter, Depends, HTTPException, Path, Query, status
|
||||||
|
|
||||||
|
from inse.auth.model import AccessTokenMetadata
|
||||||
|
from inse.auth.service import CurrentUserAccessTokenPayloadDep
|
||||||
|
from inse.model import SortDirection
|
||||||
|
from inse.router_prefixes import RouterPrefixes
|
||||||
|
from inse.tags import Tags
|
||||||
|
|
||||||
|
from . import service
|
||||||
|
from .model import (
|
||||||
|
CareerBucket,
|
||||||
|
EgoNetwork,
|
||||||
|
FounderCandidatePage,
|
||||||
|
FounderModelInfo,
|
||||||
|
FounderSortBy,
|
||||||
|
FounderStatistics,
|
||||||
|
MultiplierTag,
|
||||||
|
PeerRankField,
|
||||||
|
ResearcherDetail,
|
||||||
|
ResearcherSortBy,
|
||||||
|
ResearcherSummaryPage,
|
||||||
|
Showcase,
|
||||||
|
)
|
||||||
|
|
||||||
|
router = APIRouter(prefix=RouterPrefixes.MULTIPLICATORS, tags=[Tags.MULTIPLICATORS])
|
||||||
|
|
||||||
|
|
||||||
|
def _current_institution_id(
|
||||||
|
access_token_metadata: Annotated[AccessTokenMetadata, CurrentUserAccessTokenPayloadDep],
|
||||||
|
) -> str:
|
||||||
|
"""The short OpenAlex institution id of the logged-in user's organization."""
|
||||||
|
raw = access_token_metadata.effective_institution_id
|
||||||
|
short = service.short_openalex_id(raw) if raw else ""
|
||||||
|
if not short:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
|
detail="No OpenAlex institution is assigned to the current organization.",
|
||||||
|
)
|
||||||
|
return short
|
||||||
|
|
||||||
|
|
||||||
|
InstitutionIdDep = Annotated[str, Depends(_current_institution_id)]
|
||||||
|
|
||||||
|
_AUTHOR_ID_PATH = Path(
|
||||||
|
description="The OpenAlex author id, short form (e.g. A5087456839) or full URL."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/founder-statistics",
|
||||||
|
operation_id="getFounderStatistics",
|
||||||
|
summary="Founder-potential statistics for the current user's university: data-quality funnel, "
|
||||||
|
"score distributions per career stage, research-area composition and archetype overlap.",
|
||||||
|
)
|
||||||
|
async def get_founder_statistics(
|
||||||
|
institution_id: InstitutionIdDep,
|
||||||
|
percentile_threshold: Annotated[
|
||||||
|
float,
|
||||||
|
Query(
|
||||||
|
description="Founder percentile (0-100) at or above which a researcher counts as shortlisted.",
|
||||||
|
ge=0,
|
||||||
|
le=100,
|
||||||
|
),
|
||||||
|
] = 90.0,
|
||||||
|
min_publications: Annotated[
|
||||||
|
int,
|
||||||
|
Query(
|
||||||
|
description="Minimum publication count for the robust shortlist and the funnel's last stage.",
|
||||||
|
ge=0,
|
||||||
|
),
|
||||||
|
] = 7,
|
||||||
|
soft_peer_rank_threshold: Annotated[
|
||||||
|
float,
|
||||||
|
Query(
|
||||||
|
description="Sub-score (0-1) at or above which a shortlisted researcher counts as a soft archetype match.",
|
||||||
|
ge=0,
|
||||||
|
le=1,
|
||||||
|
),
|
||||||
|
] = 0.7,
|
||||||
|
max_career_age: Annotated[
|
||||||
|
int,
|
||||||
|
Query(description="Career ages above this count as implausible in the screen.", ge=0),
|
||||||
|
] = 40,
|
||||||
|
tagged_band: Annotated[
|
||||||
|
float,
|
||||||
|
Query(
|
||||||
|
description="Founder percentile band used in the reverse archetype view (how many tagged people exceed it).",
|
||||||
|
ge=0,
|
||||||
|
le=100,
|
||||||
|
),
|
||||||
|
] = 40.0,
|
||||||
|
) -> FounderStatistics:
|
||||||
|
return await service.get_founder_statistics(
|
||||||
|
institution_id=institution_id,
|
||||||
|
percentile_threshold=percentile_threshold,
|
||||||
|
min_publications=min_publications,
|
||||||
|
soft_peer_rank_threshold=soft_peer_rank_threshold,
|
||||||
|
max_career_age=max_career_age,
|
||||||
|
tagged_band=tagged_band,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/founders",
|
||||||
|
operation_id="searchFounderCandidates",
|
||||||
|
summary="Search the current university's researchers by founder potential.",
|
||||||
|
)
|
||||||
|
async def search_founder_candidates(
|
||||||
|
institution_id: InstitutionIdDep,
|
||||||
|
page: Annotated[int, Query(description="The page number to retrieve. (0-based)", ge=0)] = 0,
|
||||||
|
size: Annotated[
|
||||||
|
int, Query(description="The number of researchers to retrieve per page.", ge=1, le=100)
|
||||||
|
] = 25,
|
||||||
|
in_population: Annotated[
|
||||||
|
bool | None,
|
||||||
|
Query(
|
||||||
|
description="Restrict to researchers the model can score. "
|
||||||
|
"Pass true for the scored, false for the unscored, or leave unset for everyone."
|
||||||
|
),
|
||||||
|
] = None,
|
||||||
|
min_external_percentile: Annotated[
|
||||||
|
float | None,
|
||||||
|
Query(description="Minimum founder percentile (0-100, vs the external reference cohort).", ge=0, le=100),
|
||||||
|
] = None,
|
||||||
|
max_external_percentile: Annotated[
|
||||||
|
float | None, Query(description="Maximum founder percentile (0-100).", ge=0, le=100)
|
||||||
|
] = None,
|
||||||
|
career_bucket: Annotated[
|
||||||
|
list[CareerBucket] | None, Query(description="Career stages to include.")
|
||||||
|
] = None,
|
||||||
|
screened: Annotated[
|
||||||
|
bool | None,
|
||||||
|
Query(
|
||||||
|
description="true: only researchers passing the data-quality screen; "
|
||||||
|
"false: only the rejects; unset: everyone."
|
||||||
|
),
|
||||||
|
] = None,
|
||||||
|
min_publications: Annotated[
|
||||||
|
int | None, Query(description="Minimum publication count.", ge=0)
|
||||||
|
] = None,
|
||||||
|
has_patents: Annotated[
|
||||||
|
bool | None, Query(description="Whether the researcher has at least one patent.")
|
||||||
|
] = None,
|
||||||
|
research_area: Annotated[
|
||||||
|
list[str] | None,
|
||||||
|
Query(description="Dimensions FOR 2-digit division codes to include (e.g. 32, 40)."),
|
||||||
|
] = None,
|
||||||
|
tags: Annotated[
|
||||||
|
list[MultiplierTag] | None,
|
||||||
|
Query(description="Multiplier tags to include (any-of semantics)."),
|
||||||
|
] = None,
|
||||||
|
name: Annotated[
|
||||||
|
str | None, Query(description="A name to filter by (prefix matches allowed).")
|
||||||
|
] = None,
|
||||||
|
screen_min_publications: Annotated[
|
||||||
|
int, Query(description="Publication count below which the screen flags a thin profile.", ge=0)
|
||||||
|
] = 7,
|
||||||
|
screen_max_career_age: Annotated[
|
||||||
|
int, Query(description="Career age above which the screen flags an implausible length.", ge=0)
|
||||||
|
] = 40,
|
||||||
|
sort_by: Annotated[
|
||||||
|
FounderSortBy, Query(description="The field to sort by.")
|
||||||
|
] = FounderSortBy.EXTERNAL_PERCENTILE,
|
||||||
|
sort_order: Annotated[
|
||||||
|
SortDirection, Query(description="The order to sort by.")
|
||||||
|
] = SortDirection.DESCENDING,
|
||||||
|
) -> FounderCandidatePage:
|
||||||
|
return await service.search_founder_candidates(
|
||||||
|
institution_id=institution_id,
|
||||||
|
page=page,
|
||||||
|
size=size,
|
||||||
|
in_population=in_population,
|
||||||
|
min_external_percentile=min_external_percentile,
|
||||||
|
max_external_percentile=max_external_percentile,
|
||||||
|
career_bucket=career_bucket,
|
||||||
|
screened=screened,
|
||||||
|
min_publications=min_publications,
|
||||||
|
has_patents=has_patents,
|
||||||
|
research_area=research_area,
|
||||||
|
tags=tags,
|
||||||
|
name=name,
|
||||||
|
screen_min_publications=screen_min_publications,
|
||||||
|
screen_max_career_age=screen_max_career_age,
|
||||||
|
sort_by=sort_by,
|
||||||
|
sort_order=sort_order,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/researchers",
|
||||||
|
operation_id="searchMultiplicatorResearchers",
|
||||||
|
summary="Search the current university's researchers by multiplier archetype "
|
||||||
|
"(bridger / mentor / amplifier).",
|
||||||
|
)
|
||||||
|
async def search_researchers(
|
||||||
|
institution_id: InstitutionIdDep,
|
||||||
|
page: Annotated[int, Query(description="The page number to retrieve. (0-based)", ge=0)] = 0,
|
||||||
|
size: Annotated[
|
||||||
|
int, Query(description="The number of researchers to retrieve per page.", ge=1, le=100)
|
||||||
|
] = 25,
|
||||||
|
tags: Annotated[
|
||||||
|
list[MultiplierTag] | None,
|
||||||
|
Query(description="Multiplier tags to include (any-of semantics)."),
|
||||||
|
] = None,
|
||||||
|
career_bucket: Annotated[
|
||||||
|
list[CareerBucket] | None, Query(description="Career stages to include.")
|
||||||
|
] = None,
|
||||||
|
min_peer_rank: Annotated[
|
||||||
|
float | None,
|
||||||
|
Query(description="Minimum sub-score (0-1, ranked against same-career-stage peers).", ge=0, le=1),
|
||||||
|
] = None,
|
||||||
|
peer_rank_field: Annotated[
|
||||||
|
PeerRankField, Query(description="Which sub-score `min_peer_rank` applies to.")
|
||||||
|
] = PeerRankField.MAX,
|
||||||
|
suspicious_profile: Annotated[
|
||||||
|
bool | None, Query(description="Filter by the merged-profile flag.")
|
||||||
|
] = None,
|
||||||
|
name: Annotated[
|
||||||
|
str | None, Query(description="A name to filter by (prefix matches allowed).")
|
||||||
|
] = None,
|
||||||
|
sort_by: Annotated[
|
||||||
|
ResearcherSortBy, Query(description="The sub-score to sort by.")
|
||||||
|
] = ResearcherSortBy.MAX,
|
||||||
|
sort_order: Annotated[
|
||||||
|
SortDirection, Query(description="The order to sort by.")
|
||||||
|
] = SortDirection.DESCENDING,
|
||||||
|
) -> ResearcherSummaryPage:
|
||||||
|
return await service.search_researchers(
|
||||||
|
institution_id=institution_id,
|
||||||
|
page=page,
|
||||||
|
size=size,
|
||||||
|
tags=tags,
|
||||||
|
career_bucket=career_bucket,
|
||||||
|
min_peer_rank=min_peer_rank,
|
||||||
|
peer_rank_field=peer_rank_field,
|
||||||
|
suspicious_profile=suspicious_profile,
|
||||||
|
name=name,
|
||||||
|
sort_by=sort_by,
|
||||||
|
sort_order=sort_order,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/researchers/{author_id}",
|
||||||
|
operation_id="getMultiplicatorResearcher",
|
||||||
|
summary="Full multiplier and founder-potential detail for one researcher: every raw metric "
|
||||||
|
"next to its peer rank, so a coach can see why the person scored what they scored.",
|
||||||
|
)
|
||||||
|
async def get_researcher(
|
||||||
|
institution_id: InstitutionIdDep,
|
||||||
|
author_id: Annotated[str, _AUTHOR_ID_PATH],
|
||||||
|
) -> ResearcherDetail:
|
||||||
|
return await service.get_researcher_detail(institution_id, author_id)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/researchers/{author_id}/network",
|
||||||
|
operation_id="getMultiplicatorResearcherNetwork",
|
||||||
|
summary="One researcher's ego co-author network (nodes and edges, no layout - "
|
||||||
|
"position them client-side with a force layout).",
|
||||||
|
)
|
||||||
|
async def get_researcher_network(
|
||||||
|
institution_id: InstitutionIdDep,
|
||||||
|
author_id: Annotated[str, _AUTHOR_ID_PATH],
|
||||||
|
) -> EgoNetwork:
|
||||||
|
return await service.get_researcher_network(institution_id, author_id)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/showcase",
|
||||||
|
operation_id="getMultiplicatorShowcase",
|
||||||
|
summary="Four representative researchers: the top bridger, mentor and amplifier, "
|
||||||
|
"plus the best scorer who just misses the tag threshold.",
|
||||||
|
)
|
||||||
|
async def get_showcase(institution_id: InstitutionIdDep) -> Showcase:
|
||||||
|
return await service.get_showcase(institution_id)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/founder-model-info",
|
||||||
|
operation_id="getFounderModelInfo",
|
||||||
|
summary="Which model produced the founder scores: performance and permutation "
|
||||||
|
"importances. Identical for every university.",
|
||||||
|
)
|
||||||
|
async def get_founder_model_info(
|
||||||
|
access_token_metadata: Annotated[AccessTokenMetadata, CurrentUserAccessTokenPayloadDep],
|
||||||
|
) -> FounderModelInfo:
|
||||||
|
return service.get_founder_model_info()
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,996 @@
|
|||||||
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from inse.exceptions import (
|
||||||
|
BadRequestException,
|
||||||
|
NotFoundException,
|
||||||
|
ResearcherDataUnavailableException,
|
||||||
|
)
|
||||||
|
from inse.integrations.elasticsearch import _index_to_cluster
|
||||||
|
from inse.model import ESCluster, ESIndex, SortDirection
|
||||||
|
|
||||||
|
from . import service
|
||||||
|
from .model import (
|
||||||
|
CareerBucket,
|
||||||
|
FounderScreenReason,
|
||||||
|
FounderSortBy,
|
||||||
|
MultiplierTag,
|
||||||
|
PeerRankField,
|
||||||
|
ResearcherSortBy,
|
||||||
|
ResearcherUnavailableReason,
|
||||||
|
ShowcaseKind,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def anyio_backend():
|
||||||
|
return "asyncio"
|
||||||
|
|
||||||
|
|
||||||
|
INSTITUTION = "I62318514"
|
||||||
|
|
||||||
|
|
||||||
|
def _empty_search_response(total: int = 0) -> dict:
|
||||||
|
return {"hits": {"hits": [], "total": {"value": total}}}
|
||||||
|
|
||||||
|
|
||||||
|
def _search_response(sources: list[dict], total: int | None = None) -> dict:
|
||||||
|
return {
|
||||||
|
"hits": {
|
||||||
|
"hits": [{"_source": s} for s in sources],
|
||||||
|
"total": {"value": total if total is not None else len(sources)},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Infrastructure
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def test_index_enums_route_to_the_inse_cluster():
|
||||||
|
# Without this, every query silently targets the NES cluster and surfaces
|
||||||
|
# as a 404 that looks like "no data for this institution".
|
||||||
|
assert _index_to_cluster(ESIndex.MULTIPLICATORS_V1) == ESCluster.INSE
|
||||||
|
assert _index_to_cluster(ESIndex.MULTIPLICATOR_NETWORKS_V1) == ESCluster.INSE
|
||||||
|
|
||||||
|
|
||||||
|
def test_short_id_normalizes_full_openalex_url():
|
||||||
|
assert service.short_openalex_id("https://openalex.org/I62318514") == "I62318514"
|
||||||
|
assert service.short_openalex_id("https://openalex.org/I62318514/") == "I62318514"
|
||||||
|
assert service.short_openalex_id("I62318514") == "I62318514"
|
||||||
|
assert service.short_openalex_id(" A5087456839 ") == "A5087456839"
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Screen: the ES filter and the Python verdict must agree
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def _doc(
|
||||||
|
suspicious: bool = False,
|
||||||
|
career_age: int | None = 10,
|
||||||
|
publications: int = 20,
|
||||||
|
in_population: bool = True,
|
||||||
|
) -> dict:
|
||||||
|
founding: dict = {"in_population": in_population}
|
||||||
|
if career_age is not None:
|
||||||
|
founding["current_career_age"] = career_age
|
||||||
|
return {
|
||||||
|
"suspicious_profile": suspicious,
|
||||||
|
"founding": founding,
|
||||||
|
"founding_features": {"publications": publications},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _matches_screen_clauses(doc: dict, min_publications: int, max_career_age: int) -> bool:
|
||||||
|
"""Evaluates the generated ES clauses in Python, clause semantics included
|
||||||
|
(a range never matches a missing field)."""
|
||||||
|
founding = doc.get("founding") or {}
|
||||||
|
passes_not_suspicious = not doc.get("suspicious_profile")
|
||||||
|
career_age = founding.get("current_career_age")
|
||||||
|
passes_career = career_age is not None and career_age <= max_career_age
|
||||||
|
passes_pubs = (doc.get("founding_features") or {}).get(
|
||||||
|
"publications", 0
|
||||||
|
) >= min_publications
|
||||||
|
return passes_not_suspicious and passes_career and passes_pubs
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"doc",
|
||||||
|
[
|
||||||
|
_doc(), # clean
|
||||||
|
_doc(suspicious=True),
|
||||||
|
_doc(career_age=41),
|
||||||
|
_doc(career_age=None),
|
||||||
|
_doc(publications=3),
|
||||||
|
_doc(suspicious=True, publications=3),
|
||||||
|
_doc(suspicious=True, career_age=50, publications=1),
|
||||||
|
_doc(in_population=False),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_screen_filter_and_verdict_agree(doc):
|
||||||
|
verdict = service.screen_verdict(doc, min_publications=7, max_career_age=40)
|
||||||
|
es_passes = _matches_screen_clauses(doc, min_publications=7, max_career_age=40)
|
||||||
|
# OUT_OF_POPULATION is a verdict-only annotation and not part of the ES
|
||||||
|
# screen clauses (population filtering is its own query parameter).
|
||||||
|
screen_reasons = [
|
||||||
|
r for r in verdict.reasons if r != FounderScreenReason.OUT_OF_POPULATION
|
||||||
|
]
|
||||||
|
assert (not screen_reasons) == es_passes
|
||||||
|
|
||||||
|
|
||||||
|
def test_screen_reason_precedence_matches_report():
|
||||||
|
# "merged profile" outranks "only N papers", as in the reference dashboard.
|
||||||
|
verdict = service.screen_verdict(
|
||||||
|
_doc(suspicious=True, publications=3), min_publications=7, max_career_age=40
|
||||||
|
)
|
||||||
|
assert verdict.reasons[0] == FounderScreenReason.MERGED_PROFILE
|
||||||
|
assert FounderScreenReason.THIN_PROFILE in verdict.reasons
|
||||||
|
|
||||||
|
verdict = service.screen_verdict(
|
||||||
|
_doc(career_age=55, publications=3), min_publications=7, max_career_age=40
|
||||||
|
)
|
||||||
|
assert verdict.reasons[0] == FounderScreenReason.IMPLAUSIBLE_CAREER_LENGTH
|
||||||
|
|
||||||
|
|
||||||
|
def test_screen_unknown_career_length_is_distinct():
|
||||||
|
verdict = service.screen_verdict(_doc(career_age=None), min_publications=7, max_career_age=40)
|
||||||
|
assert verdict.reasons == [FounderScreenReason.UNKNOWN_CAREER_LENGTH]
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# /founders
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founders_builds_expected_filter_clauses():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_empty_search_response()),
|
||||||
|
) as search:
|
||||||
|
await service.search_founder_candidates(
|
||||||
|
INSTITUTION,
|
||||||
|
min_external_percentile=90,
|
||||||
|
career_bucket=[CareerBucket.EMERGING],
|
||||||
|
screened=True,
|
||||||
|
has_patents=True,
|
||||||
|
research_area=["32"],
|
||||||
|
tags=[MultiplierTag.MENTOR],
|
||||||
|
name="Pak",
|
||||||
|
)
|
||||||
|
|
||||||
|
query = search.await_args.kwargs["query"]
|
||||||
|
filters = query["bool"]["filter"]
|
||||||
|
assert {"term": {"institution_id": INSTITUTION}} in filters
|
||||||
|
assert {"term": {"founding.in_population": True}} in filters
|
||||||
|
assert {"range": {"founding.percentile": {"gte": 90}}} in filters
|
||||||
|
assert {"terms": {"career_bucket": ["Emerging"]}} in filters
|
||||||
|
assert {"range": {"founding_features.patents": {"gte": 1}}} in filters
|
||||||
|
assert {"terms": {"founding_features.publication_research_area": ["32"]}} in filters
|
||||||
|
assert {"terms": {"tags": ["mentor"]}} in filters
|
||||||
|
# the three screen clauses
|
||||||
|
assert {"bool": {"must_not": [{"term": {"suspicious_profile": True}}]}} in filters
|
||||||
|
assert {"range": {"founding.current_career_age": {"lte": 40}}} in filters
|
||||||
|
assert {"range": {"founding_features.publications": {"gte": 7}}} in filters
|
||||||
|
assert query["bool"]["must"] == [{"match_phrase_prefix": {"display_name": "Pak"}}]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founders_screened_false_returns_the_rejects_clause():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_empty_search_response()),
|
||||||
|
) as search:
|
||||||
|
await service.search_founder_candidates(INSTITUTION, screened=False)
|
||||||
|
|
||||||
|
filters = search.await_args.kwargs["query"]["bool"]["filter"]
|
||||||
|
rejects = [f for f in filters if "should" in f.get("bool", {})]
|
||||||
|
assert len(rejects) == 1
|
||||||
|
should = rejects[0]["bool"]["should"]
|
||||||
|
assert rejects[0]["bool"]["minimum_should_match"] == 1
|
||||||
|
# each option negates one screen clause
|
||||||
|
assert len(should) == 3
|
||||||
|
assert all("must_not" in option["bool"] for option in should)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founders_sort_uses_missing_last_and_author_id_tiebreaker():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_empty_search_response()),
|
||||||
|
) as search:
|
||||||
|
await service.search_founder_candidates(
|
||||||
|
INSTITUTION, sort_by=FounderSortBy.WITHIN_3Y, sort_order=SortDirection.ASCENDING
|
||||||
|
)
|
||||||
|
|
||||||
|
assert search.await_args.kwargs["sort"] == [
|
||||||
|
{"founding.p_within_3y_percentile": {"order": "asc", "missing": "_last"}},
|
||||||
|
{"author_id": {"order": "asc"}},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founders_out_of_population_percentile_stays_null():
|
||||||
|
source = {
|
||||||
|
"author_id": "A1",
|
||||||
|
"display_name": "Test Person",
|
||||||
|
"career_bucket": "Early",
|
||||||
|
"founding": {"in_population": False},
|
||||||
|
"founding_features": {"publications": 2},
|
||||||
|
}
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_search_response([source])),
|
||||||
|
):
|
||||||
|
page = await service.search_founder_candidates(INSTITUTION, in_population=None)
|
||||||
|
|
||||||
|
candidate = page.elements[0]
|
||||||
|
assert candidate.founder_potential.external_percentile is None # null, not 0.0
|
||||||
|
assert candidate.founder_potential.in_reference_population is False
|
||||||
|
assert FounderScreenReason.OUT_OF_POPULATION in candidate.screen.reasons
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_pagination_beyond_max_result_window_raises_bad_request():
|
||||||
|
with pytest.raises(BadRequestException):
|
||||||
|
await service.search_founder_candidates(INSTITUTION, page=101, size=100)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# /researchers
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_researchers_min_peer_rank_targets_selected_field():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_empty_search_response()),
|
||||||
|
) as search:
|
||||||
|
await service.search_researchers(
|
||||||
|
INSTITUTION,
|
||||||
|
min_peer_rank=0.7,
|
||||||
|
peer_rank_field=PeerRankField.BRIDGER,
|
||||||
|
sort_by=ResearcherSortBy.MENTOR,
|
||||||
|
)
|
||||||
|
|
||||||
|
filters = search.await_args.kwargs["query"]["bool"]["filter"]
|
||||||
|
assert {"range": {"sub_scores.bridger": {"gte": 0.7}}} in filters
|
||||||
|
assert search.await_args.kwargs["sort"][0] == {
|
||||||
|
"sub_scores.mentor": {"order": "desc", "missing": "_last"}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_researchers_default_peer_rank_field_is_max():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_empty_search_response()),
|
||||||
|
) as search:
|
||||||
|
await service.search_researchers(INSTITUTION, min_peer_rank=0.5)
|
||||||
|
|
||||||
|
filters = search.await_args.kwargs["query"]["bool"]["filter"]
|
||||||
|
assert {"range": {"max_sub_score": {"gte": 0.5}}} in filters
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Detail + network (_doc lookups)
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def _detail_source() -> dict:
|
||||||
|
return {
|
||||||
|
"institution_id": INSTITUTION,
|
||||||
|
"author_id": "A5113304257",
|
||||||
|
"display_name": "Test Person",
|
||||||
|
"career_bucket": "Senior",
|
||||||
|
"active_years": 20,
|
||||||
|
"n_works": 150,
|
||||||
|
"suspicious_profile": False,
|
||||||
|
"tags": ["mentor"],
|
||||||
|
"sub_scores": {"bridger": 0.5, "mentor": 0.9, "amplifier": 0.3},
|
||||||
|
"max_sub_score": 0.9,
|
||||||
|
"betweenness": 0.012,
|
||||||
|
"juniors_mentored": 14,
|
||||||
|
"percentiles": {"betweenness": 0.88, "juniors_mentored": 0.95},
|
||||||
|
"founding": {
|
||||||
|
"percentile": 55.2,
|
||||||
|
"in_population": True,
|
||||||
|
"timing_applicable": False,
|
||||||
|
"predicted_founding_age": 8.5,
|
||||||
|
"years_to_founding": -3.1,
|
||||||
|
"current_career_age": 25,
|
||||||
|
# retired v1 fields still present in old documents:
|
||||||
|
"probability": 0.996,
|
||||||
|
"applicable": True,
|
||||||
|
"p_within_2y": 1.0,
|
||||||
|
"models_agree": True,
|
||||||
|
},
|
||||||
|
"founding_features": {
|
||||||
|
"publications": 150,
|
||||||
|
"patents": 2,
|
||||||
|
"publication_research_area": "32",
|
||||||
|
"h_index": 40, # retired v1 field
|
||||||
|
},
|
||||||
|
"computed_at": "2026-08-07T00:00:00Z",
|
||||||
|
"config_hash": "abc123",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_researcher_detail_uses_doc_get_with_composite_id():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": True, "_source": _detail_source()}),
|
||||||
|
) as get:
|
||||||
|
detail = await service.get_researcher_detail(
|
||||||
|
INSTITUTION, "https://openalex.org/A5113304257"
|
||||||
|
)
|
||||||
|
|
||||||
|
assert get.await_args.args[:2] == (
|
||||||
|
ESIndex.MULTIPLICATORS_V1,
|
||||||
|
f"{INSTITUTION}_A5113304257",
|
||||||
|
)
|
||||||
|
assert detail.author_id == "A5113304257"
|
||||||
|
assert detail.career_bucket == CareerBucket.SENIOR
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_researcher_detail_omits_retired_v1_fields():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": True, "_source": _detail_source()}),
|
||||||
|
):
|
||||||
|
detail = await service.get_researcher_detail(INSTITUTION, "A5113304257")
|
||||||
|
|
||||||
|
dumped = detail.model_dump()
|
||||||
|
as_text = str(dumped)
|
||||||
|
assert "probability" not in as_text
|
||||||
|
assert "p_within_2y" not in as_text
|
||||||
|
assert "models_agree" not in as_text
|
||||||
|
assert "h_index" not in as_text
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_researcher_detail_timing_block_is_null_when_not_applicable():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": True, "_source": _detail_source()}),
|
||||||
|
):
|
||||||
|
detail = await service.get_researcher_detail(INSTITUTION, "A5113304257")
|
||||||
|
|
||||||
|
assert detail.founder_potential.timing_applicable is False
|
||||||
|
assert detail.founder_potential.timing is None
|
||||||
|
assert detail.founder_potential.current_career_age == 25 # still visible
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_researcher_detail_pairs_raw_metrics_with_peer_ranks():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": True, "_source": _detail_source()}),
|
||||||
|
):
|
||||||
|
detail = await service.get_researcher_detail(INSTITUTION, "A5113304257")
|
||||||
|
|
||||||
|
assert detail.metrics.betweenness.raw == 0.012
|
||||||
|
assert detail.metrics.betweenness.peer_rank == 0.88
|
||||||
|
assert detail.metrics.juniors_mentored.raw == 14
|
||||||
|
assert detail.metrics.juniors_mentored.peer_rank == 0.95
|
||||||
|
# a metric absent from the doc stays fully null
|
||||||
|
assert detail.metrics.patent_count.raw is None
|
||||||
|
assert detail.metrics.patent_count.peer_rank is None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_researcher_detail_rejects_document_from_another_institution():
|
||||||
|
source = {**_detail_source(), "institution_id": "I999"}
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": True, "_source": source}),
|
||||||
|
):
|
||||||
|
with pytest.raises(NotFoundException):
|
||||||
|
await service.get_researcher_detail(INSTITUTION, "A5113304257")
|
||||||
|
|
||||||
|
|
||||||
|
def _author(author_id: str = "A5113304257", institutions: list[str] | None = None):
|
||||||
|
from inse.models.openalex.author import Author
|
||||||
|
|
||||||
|
return Author(
|
||||||
|
id=f"https://openalex.org/{author_id}",
|
||||||
|
display_name="Test Person",
|
||||||
|
last_known_institutions=[
|
||||||
|
{"id": f"https://openalex.org/I{index}", "display_name": name}
|
||||||
|
for index, name in enumerate(institutions or [])
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_missing_detail_reports_author_of_another_institution():
|
||||||
|
with (
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": False}),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.get_author_by_id",
|
||||||
|
new=AsyncMock(return_value=_author(institutions=["TU Berlin"])),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.author_currently_belongs_to_institution",
|
||||||
|
new=AsyncMock(return_value=False),
|
||||||
|
),
|
||||||
|
):
|
||||||
|
with pytest.raises(ResearcherDataUnavailableException) as excinfo:
|
||||||
|
await service.get_researcher_detail(INSTITUTION, "A5113304257")
|
||||||
|
|
||||||
|
exc = excinfo.value
|
||||||
|
assert exc.reason == ResearcherUnavailableReason.OTHER_INSTITUTION
|
||||||
|
assert exc.author_institution == "TU Berlin"
|
||||||
|
assert exc.display_name == "Test Person"
|
||||||
|
assert exc.author_id == "A5113304257"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_missing_detail_reports_member_that_was_never_indexed():
|
||||||
|
with (
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": False}),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.get_author_by_id",
|
||||||
|
new=AsyncMock(return_value=_author()),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.author_currently_belongs_to_institution",
|
||||||
|
new=AsyncMock(return_value=True),
|
||||||
|
),
|
||||||
|
):
|
||||||
|
with pytest.raises(ResearcherDataUnavailableException) as excinfo:
|
||||||
|
await service.get_researcher_detail(INSTITUTION, "A5113304257")
|
||||||
|
|
||||||
|
assert excinfo.value.reason == ResearcherUnavailableReason.NOT_INDEXED
|
||||||
|
assert excinfo.value.author_institution is None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_missing_detail_treats_listed_member_as_not_indexed():
|
||||||
|
"""A long-retired member fails the activity check but still lists UDE."""
|
||||||
|
from inse.models.openalex.author import Author
|
||||||
|
|
||||||
|
author = Author(
|
||||||
|
id="https://openalex.org/A5113304257",
|
||||||
|
display_name="Test Person",
|
||||||
|
last_known_institutions=[
|
||||||
|
{
|
||||||
|
"id": f"https://openalex.org/{INSTITUTION}",
|
||||||
|
"display_name": "Universität Duisburg-Essen",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
with (
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": False}),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.get_author_by_id",
|
||||||
|
new=AsyncMock(return_value=author),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.author_currently_belongs_to_institution",
|
||||||
|
new=AsyncMock(return_value=False),
|
||||||
|
),
|
||||||
|
):
|
||||||
|
with pytest.raises(ResearcherDataUnavailableException) as excinfo:
|
||||||
|
await service.get_researcher_detail(INSTITUTION, "A5113304257")
|
||||||
|
|
||||||
|
assert excinfo.value.reason == ResearcherUnavailableReason.NOT_INDEXED
|
||||||
|
assert excinfo.value.author_institution is None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_missing_detail_reports_unknown_author():
|
||||||
|
with (
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": False}),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.get_author_by_id",
|
||||||
|
new=AsyncMock(return_value=None),
|
||||||
|
),
|
||||||
|
):
|
||||||
|
with pytest.raises(ResearcherDataUnavailableException) as excinfo:
|
||||||
|
await service.get_researcher_detail(INSTITUTION, "A0000000000")
|
||||||
|
|
||||||
|
assert excinfo.value.reason == ResearcherUnavailableReason.UNKNOWN_AUTHOR
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_missing_detail_survives_a_broken_author_lookup():
|
||||||
|
with (
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": False}),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"inse.multiplicators.service.get_author_by_id",
|
||||||
|
new=AsyncMock(side_effect=RuntimeError("author index unavailable")),
|
||||||
|
),
|
||||||
|
):
|
||||||
|
with pytest.raises(NotFoundException) as excinfo:
|
||||||
|
await service.get_researcher_detail(INSTITUTION, "A5113304257")
|
||||||
|
|
||||||
|
assert isinstance(excinfo.value, ResearcherDataUnavailableException)
|
||||||
|
assert excinfo.value.reason == ResearcherUnavailableReason.UNKNOWN_AUTHOR
|
||||||
|
|
||||||
|
|
||||||
|
def test_unavailable_researcher_maps_to_a_structured_404():
|
||||||
|
"""The specific handler must win over the generic NotFoundException one."""
|
||||||
|
from starlette.applications import Starlette
|
||||||
|
from starlette.requests import Request
|
||||||
|
from starlette.routing import Route
|
||||||
|
from starlette.testclient import TestClient
|
||||||
|
|
||||||
|
from inse.main import handle_not_found, handle_researcher_unavailable
|
||||||
|
|
||||||
|
async def boom(request: Request):
|
||||||
|
raise ResearcherDataUnavailableException(
|
||||||
|
"No multiplicator data.",
|
||||||
|
reason=ResearcherUnavailableReason.OTHER_INSTITUTION,
|
||||||
|
author_id="A5113304257",
|
||||||
|
display_name="Test Person",
|
||||||
|
author_institution="TU Berlin",
|
||||||
|
)
|
||||||
|
|
||||||
|
app = Starlette(routes=[Route("/boom", boom)])
|
||||||
|
app.add_exception_handler(NotFoundException, handle_not_found)
|
||||||
|
app.add_exception_handler(
|
||||||
|
ResearcherDataUnavailableException, handle_researcher_unavailable
|
||||||
|
)
|
||||||
|
|
||||||
|
response = TestClient(app).get("/boom")
|
||||||
|
|
||||||
|
assert response.status_code == 404
|
||||||
|
assert response.json() == {
|
||||||
|
"message": "No multiplicator data.",
|
||||||
|
"reason": "OTHER_INSTITUTION",
|
||||||
|
"author_id": "A5113304257",
|
||||||
|
"display_name": "Test Person",
|
||||||
|
"author_institution": "TU Berlin",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _network_source() -> dict:
|
||||||
|
return {
|
||||||
|
"institution_id": INSTITUTION,
|
||||||
|
"author_id": "A5113304257",
|
||||||
|
"display_name": "Test Person",
|
||||||
|
"ego": {
|
||||||
|
"career_bucket": "Senior",
|
||||||
|
"active_years": 20,
|
||||||
|
"n_works": 150,
|
||||||
|
"suspicious_profile": False,
|
||||||
|
"tags": ["mentor"],
|
||||||
|
"sub_scores": {"bridger": 0.5, "mentor": 0.9, "amplifier": 0.3},
|
||||||
|
"max_sub_score": 0.9,
|
||||||
|
},
|
||||||
|
"total_coauthors": 300,
|
||||||
|
"cohort_coauthors": 120,
|
||||||
|
"mentee_count": 14,
|
||||||
|
"shown": 42,
|
||||||
|
"shown_mentees": 14,
|
||||||
|
"nodes": [
|
||||||
|
{"id": "A5113304257", "name": "Test Person", "role": "ego",
|
||||||
|
"inst": "UDE", "active_years": 20, "suspicious": False},
|
||||||
|
{"id": "A2", "name": "Mentee", "role": "mentee",
|
||||||
|
"inst": "UDE", "active_years": 3, "suspicious": True},
|
||||||
|
{"id": "A3", "name": "Industry Partner", "role": "industry",
|
||||||
|
"inst": "Some University", "active_years": 8, "suspicious": False,
|
||||||
|
"company_insts": ["Acme Corp"]},
|
||||||
|
],
|
||||||
|
"edges": [
|
||||||
|
{"a": "A2", "b": "A5113304257", "w": 1.5, "n_works": 7,
|
||||||
|
"cross": False, "first_year": 2019, "last_year": 2025},
|
||||||
|
],
|
||||||
|
"computed_at": "2026-08-07T00:00:00Z",
|
||||||
|
"config_hash": "abc123",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_researcher_network_returns_nodes_and_edges_verbatim():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(return_value={"found": True, "_source": _network_source()}),
|
||||||
|
) as get:
|
||||||
|
network = await service.get_researcher_network(INSTITUTION, "A5113304257")
|
||||||
|
|
||||||
|
assert get.await_args.args[:2] == (
|
||||||
|
ESIndex.MULTIPLICATOR_NETWORKS_V1,
|
||||||
|
f"{INSTITUTION}_A5113304257",
|
||||||
|
)
|
||||||
|
assert network.nodes[0].role == "ego"
|
||||||
|
assert network.nodes[1].suspicious is True # kept, unlike the report script
|
||||||
|
assert network.nodes[1].company_insts is None
|
||||||
|
assert network.nodes[2].company_insts == ["Acme Corp"] # passed through verbatim
|
||||||
|
assert network.edges[0].last_year == 2025 # kept, unlike the report script
|
||||||
|
# no layout coordinates anywhere - the client lays out
|
||||||
|
dumped = str(network.model_dump())
|
||||||
|
assert "'x'" not in dumped and "'y'" not in dumped
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_researcher_network_missing_document_raises_not_found():
|
||||||
|
from inse.exceptions import ElasticsearchNotFoundException
|
||||||
|
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.get",
|
||||||
|
new=AsyncMock(side_effect=ElasticsearchNotFoundException("missing")),
|
||||||
|
):
|
||||||
|
with pytest.raises(NotFoundException):
|
||||||
|
await service.get_researcher_network(INSTITUTION, "A404")
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Showcase
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def _summary_source(author_id: str, tags: list[str] | None = None) -> dict:
|
||||||
|
return {
|
||||||
|
"author_id": author_id,
|
||||||
|
"display_name": author_id,
|
||||||
|
"career_bucket": "Senior",
|
||||||
|
"tags": tags or [],
|
||||||
|
"sub_scores": {"bridger": 0.9, "mentor": 0.8, "amplifier": 0.4},
|
||||||
|
"max_sub_score": 0.9,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_showcase_issues_one_msearch_with_four_bodies():
|
||||||
|
responses = [
|
||||||
|
_search_response([_summary_source("A1", ["bridger"])]),
|
||||||
|
_search_response([_summary_source("A2", ["mentor"])]),
|
||||||
|
_search_response([_summary_source("A3", ["amplifier"])]),
|
||||||
|
_search_response([_summary_source("A4")]),
|
||||||
|
]
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.msearch",
|
||||||
|
new=AsyncMock(return_value=responses),
|
||||||
|
) as msearch:
|
||||||
|
showcase = await service.get_showcase(INSTITUTION)
|
||||||
|
|
||||||
|
searches = msearch.await_args.args[0]
|
||||||
|
assert len(searches) == 4
|
||||||
|
assert all(index == ESIndex.MULTIPLICATORS_V1 for index, _ in searches)
|
||||||
|
assert all(body["size"] == 5 for _, body in searches)
|
||||||
|
# the near-miss search excludes tagged people and sorts by max_sub_score
|
||||||
|
_, example_body = searches[3]
|
||||||
|
assert example_body["query"]["bool"]["must_not"] == [{"exists": {"field": "tags"}}]
|
||||||
|
assert example_body["sort"] == [{"max_sub_score": {"order": "desc"}}]
|
||||||
|
assert [e.kind for e in showcase.entries] == [
|
||||||
|
ShowcaseKind.BRIDGER,
|
||||||
|
ShowcaseKind.MENTOR,
|
||||||
|
ShowcaseKind.AMPLIFIER,
|
||||||
|
ShowcaseKind.EXAMPLE,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_showcase_deduplicates_people_holding_several_tags():
|
||||||
|
both_tags = _summary_source("A1", ["bridger", "mentor"])
|
||||||
|
responses = [
|
||||||
|
_search_response([both_tags]),
|
||||||
|
_search_response([both_tags, _summary_source("A2", ["mentor"])]),
|
||||||
|
_search_response([_summary_source("A3", ["amplifier"])]),
|
||||||
|
_search_response([_summary_source("A4")]),
|
||||||
|
]
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.msearch",
|
||||||
|
new=AsyncMock(return_value=responses),
|
||||||
|
):
|
||||||
|
showcase = await service.get_showcase(INSTITUTION)
|
||||||
|
|
||||||
|
ids = [e.researcher.author_id for e in showcase.entries]
|
||||||
|
assert ids == ["A1", "A2", "A3", "A4"] # mentor slot takes the second hit
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_showcase_tolerates_missing_categories():
|
||||||
|
responses = [
|
||||||
|
_search_response([_summary_source("A1", ["bridger"])]),
|
||||||
|
_empty_search_response(),
|
||||||
|
_empty_search_response(),
|
||||||
|
_search_response([_summary_source("A4")]),
|
||||||
|
]
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.msearch",
|
||||||
|
new=AsyncMock(return_value=responses),
|
||||||
|
):
|
||||||
|
showcase = await service.get_showcase(INSTITUTION)
|
||||||
|
|
||||||
|
assert [e.kind for e in showcase.entries] == [
|
||||||
|
ShowcaseKind.BRIDGER,
|
||||||
|
ShowcaseKind.EXAMPLE,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_showcase_with_no_documents_raises_not_found():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.msearch",
|
||||||
|
new=AsyncMock(return_value=[_empty_search_response()] * 4),
|
||||||
|
):
|
||||||
|
with pytest.raises(NotFoundException):
|
||||||
|
await service.get_showcase(INSTITUTION)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Founder statistics
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def _stats_response() -> dict:
|
||||||
|
percentile_stats = {"values": {"50.0": 33.1, "90.0": 82.4}}
|
||||||
|
bucket_block = {
|
||||||
|
"screened": {"doc_count": 400},
|
||||||
|
"in_population": {
|
||||||
|
"doc_count": 1000,
|
||||||
|
"percentile_stats": percentile_stats,
|
||||||
|
"above_75": {"doc_count": 120},
|
||||||
|
"above_90": {"doc_count": 60},
|
||||||
|
"robust": {
|
||||||
|
"doc_count": 700,
|
||||||
|
"percentile_stats": percentile_stats,
|
||||||
|
"above_75": {"doc_count": 80},
|
||||||
|
"above_90": {"doc_count": 30},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"shortlist_plain": {"doc_count": 60},
|
||||||
|
"shortlist_robust": {"doc_count": 20},
|
||||||
|
}
|
||||||
|
tag_overlap = {
|
||||||
|
"tags": {"buckets": [{"key": "bridger", "doc_count": 4}]},
|
||||||
|
"no_tag": {"doc_count": 50},
|
||||||
|
"soft_bridger": {"doc_count": 10},
|
||||||
|
"soft_mentor": {"doc_count": 8},
|
||||||
|
"soft_amplifier": {"doc_count": 6},
|
||||||
|
}
|
||||||
|
tagged_block = {
|
||||||
|
"doc_count": 150,
|
||||||
|
"percentile_stats": {"values": {"50.0": 10.0, "90.0": 47.0}},
|
||||||
|
"above_band": {"doc_count": 30},
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"hits": {"hits": [], "total": {"value": 9474}},
|
||||||
|
"aggregations": {
|
||||||
|
"funnel": {
|
||||||
|
"doc_count": 5712,
|
||||||
|
"not_suspicious": {
|
||||||
|
"doc_count": 5317,
|
||||||
|
"career_age_ok": {
|
||||||
|
"doc_count": 4858,
|
||||||
|
"pubs_ok": {"doc_count": 3742},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"by_bucket": {
|
||||||
|
"buckets": [
|
||||||
|
{"key": "Early", "doc_count": 5361, **bucket_block},
|
||||||
|
{"key": "Senior", "doc_count": 1745, **bucket_block},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"overall": {"doc_count": 9474, **bucket_block},
|
||||||
|
"areas": {
|
||||||
|
"doc_count": 5712,
|
||||||
|
"shortlist_total": {"doc_count": 270},
|
||||||
|
"robust_total": {"doc_count": 100},
|
||||||
|
"by_area": {
|
||||||
|
"buckets": [
|
||||||
|
{
|
||||||
|
"key": "32",
|
||||||
|
"doc_count": 2856,
|
||||||
|
"shortlist": {"doc_count": 100},
|
||||||
|
"robust": {"doc_count": 40},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "43", # unknown FOR code
|
||||||
|
"doc_count": 10,
|
||||||
|
"shortlist": {"doc_count": 0},
|
||||||
|
"robust": {"doc_count": 0},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"shortlist": {
|
||||||
|
"doc_count": 270,
|
||||||
|
**tag_overlap,
|
||||||
|
"robust": {"doc_count": 100, **tag_overlap},
|
||||||
|
},
|
||||||
|
"tagged_bridger": tagged_block,
|
||||||
|
"tagged_mentor": tagged_block,
|
||||||
|
"tagged_amplifier": tagged_block,
|
||||||
|
"patent_sources": {
|
||||||
|
"buckets": [{"key": "api+org_patents", "doc_count": 9474}]
|
||||||
|
},
|
||||||
|
"provenance": {
|
||||||
|
"hits": {
|
||||||
|
"hits": [
|
||||||
|
{
|
||||||
|
"_source": {
|
||||||
|
"computed_at": "2026-08-07T12:00:00Z",
|
||||||
|
"config_hash": "abc123def456",
|
||||||
|
"founding": {"as_of_year": 2026},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founder_statistics_issues_a_single_search_with_size_zero():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_stats_response()),
|
||||||
|
) as search:
|
||||||
|
await service.get_founder_statistics(INSTITUTION)
|
||||||
|
|
||||||
|
assert search.await_count == 1
|
||||||
|
body = search.await_args.kwargs["body"]
|
||||||
|
assert body["size"] == 0
|
||||||
|
assert body["query"] == {
|
||||||
|
"bool": {"filter": [{"term": {"institution_id": INSTITUTION}}]}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founder_statistics_funnel_is_cumulative_and_nested():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_stats_response()),
|
||||||
|
) as search:
|
||||||
|
stats = await service.get_founder_statistics(INSTITUTION)
|
||||||
|
|
||||||
|
funnel_agg = search.await_args.kwargs["body"]["aggs"]["funnel"]
|
||||||
|
assert funnel_agg["filter"] == {"term": {"founding.in_population": True}}
|
||||||
|
nested = funnel_agg["aggs"]["not_suspicious"]
|
||||||
|
assert nested["filter"] == {
|
||||||
|
"bool": {"must_not": [{"term": {"suspicious_profile": True}}]}
|
||||||
|
}
|
||||||
|
deeper = nested["aggs"]["career_age_ok"]
|
||||||
|
assert deeper["filter"] == {"range": {"founding.current_career_age": {"lte": 40}}}
|
||||||
|
assert deeper["aggs"]["pubs_ok"]["filter"] == {
|
||||||
|
"range": {"founding_features.publications": {"gte": 7}}
|
||||||
|
}
|
||||||
|
|
||||||
|
counts = [stage.count for stage in stats.funnel]
|
||||||
|
assert counts == [9474, 5712, 5317, 4858, 3742]
|
||||||
|
assert [stage.lost_from_previous for stage in stats.funnel] == [
|
||||||
|
0, 3762, 395, 459, 1116,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founder_statistics_threshold_params_reach_the_dsl():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_stats_response()),
|
||||||
|
) as search:
|
||||||
|
await service.get_founder_statistics(
|
||||||
|
INSTITUTION,
|
||||||
|
percentile_threshold=75,
|
||||||
|
min_publications=3,
|
||||||
|
soft_peer_rank_threshold=0.5,
|
||||||
|
)
|
||||||
|
|
||||||
|
aggs = search.await_args.kwargs["body"]["aggs"]
|
||||||
|
assert aggs["by_bucket"]["aggs"]["shortlist_plain"]["filter"] == {
|
||||||
|
"range": {"founding.percentile": {"gte": 75}}
|
||||||
|
}
|
||||||
|
assert aggs["shortlist"]["aggs"]["soft_mentor"]["filter"] == {
|
||||||
|
"range": {"sub_scores.mentor": {"gte": 0.5}}
|
||||||
|
}
|
||||||
|
assert aggs["funnel"]["aggs"]["not_suspicious"]["aggs"]["career_age_ok"]["aggs"][
|
||||||
|
"pubs_ok"
|
||||||
|
]["filter"] == {"range": {"founding_features.publications": {"gte": 3}}}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founder_statistics_maps_for_codes_to_labels_and_shares():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_stats_response()),
|
||||||
|
):
|
||||||
|
stats = await service.get_founder_statistics(INSTITUTION)
|
||||||
|
|
||||||
|
by_code = {area.code: area for area in stats.research_areas}
|
||||||
|
assert by_code["32"].label == "Biomedical & Clinical Sciences"
|
||||||
|
assert by_code["43"].label is None # unknown code stays visible, not renamed
|
||||||
|
area = by_code["32"]
|
||||||
|
assert area.cohort_share == 0.5 # 2856 / 5712
|
||||||
|
assert area.shortlist_share == round(100 / 270, 4)
|
||||||
|
assert area.ratio == round((100 / 270) / 0.5, 2)
|
||||||
|
assert by_code["43"].ratio is None or by_code["43"].ratio == 0.0
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founder_statistics_ratio_is_none_when_cohort_share_is_zero():
|
||||||
|
response = _stats_response()
|
||||||
|
response["aggregations"]["areas"]["by_area"]["buckets"].append(
|
||||||
|
{"key": "51", "doc_count": 0, "shortlist": {"doc_count": 0}, "robust": {"doc_count": 0}}
|
||||||
|
)
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=response),
|
||||||
|
):
|
||||||
|
stats = await service.get_founder_statistics(INSTITUTION)
|
||||||
|
|
||||||
|
by_code = {area.code: area for area in stats.research_areas}
|
||||||
|
assert by_code["51"].ratio is None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founder_statistics_returns_an_empty_payload_for_unindexed_university():
|
||||||
|
"""A university without data gets 200 + document_count=0, not a 404."""
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value={"hits": {"hits": [], "total": {"value": 0}}}),
|
||||||
|
):
|
||||||
|
stats = await service.get_founder_statistics("TU9")
|
||||||
|
|
||||||
|
assert stats.provenance.institution_id == "TU9"
|
||||||
|
assert stats.provenance.document_count == 0
|
||||||
|
assert stats.overall.career_bucket == "ALL"
|
||||||
|
assert stats.overall.total == 0
|
||||||
|
assert stats.career_stages == []
|
||||||
|
assert stats.research_areas == []
|
||||||
|
assert [stage.count for stage in stats.funnel] == [0, 0, 0, 0, 0]
|
||||||
|
assert {a.tag for a in stats.archetypes} == set(MultiplierTag)
|
||||||
|
assert all(a.tagged_in_population == 0 for a in stats.archetypes)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_founder_statistics_provenance_and_overlap():
|
||||||
|
with patch(
|
||||||
|
"inse.multiplicators.service.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=_stats_response()),
|
||||||
|
):
|
||||||
|
stats = await service.get_founder_statistics(INSTITUTION)
|
||||||
|
|
||||||
|
assert stats.provenance.document_count == 9474
|
||||||
|
assert stats.provenance.config_hash == "abc123def456"
|
||||||
|
assert stats.provenance.as_of_year == 2026
|
||||||
|
assert stats.provenance.patent_sources == ["api+org_patents"]
|
||||||
|
assert stats.overall.career_bucket == "ALL"
|
||||||
|
assert stats.untagged_shortlist_count == 50
|
||||||
|
|
||||||
|
bridger = next(a for a in stats.archetypes if a.tag == MultiplierTag.BRIDGER)
|
||||||
|
assert bridger.shortlist_count == 4
|
||||||
|
assert bridger.soft_shortlist_count == 10
|
||||||
|
assert bridger.tagged_in_population == 150
|
||||||
|
assert bridger.tagged_above_band == 30
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Model info
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def test_founder_model_info_loads_bundled_file():
|
||||||
|
info = service.get_founder_model_info()
|
||||||
|
assert info.model == "lightgbm_symmetric_founder_classifier_v2"
|
||||||
|
assert info.oof_roc_auc == 0.8659
|
||||||
|
assert len(info.importances) == 12
|
||||||
|
assert info.importances[0].feature == "patent_research_area_n."
|
||||||
|
assert any("constant" in caveat for caveat in info.caveats)
|
||||||
|
assert {h.horizon_years for h in info.horizon_models} == {1, 3, 5}
|
||||||
@@ -39,6 +39,21 @@ def strip_openalex_prefix(institution_id: str) -> str:
|
|||||||
return institution_id.rsplit("/", 1)[-1]
|
return institution_id.rsplit("/", 1)[-1]
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_org_uri(uri: str | None) -> str | None:
|
||||||
|
"""Normalize an organization URL so hierarchy links compare reliably.
|
||||||
|
|
||||||
|
Trims whitespace, drops a trailing slash and the common ``/index`` suffix,
|
||||||
|
so ``https://www.example.org/x/``, ``https://www.example.org/x/index`` and
|
||||||
|
``https://www.example.org/x`` all map to the same value.
|
||||||
|
"""
|
||||||
|
if not uri:
|
||||||
|
return None
|
||||||
|
normalized = uri.strip().rstrip("/")
|
||||||
|
if normalized.endswith("/index"):
|
||||||
|
normalized = normalized[: -len("/index")].rstrip("/")
|
||||||
|
return normalized or None
|
||||||
|
|
||||||
|
|
||||||
def full_institution_url(institution_id: str) -> str:
|
def full_institution_url(institution_id: str) -> str:
|
||||||
"""Normalize any institution id form to the full OpenAlex URL form."""
|
"""Normalize any institution id form to the full OpenAlex URL form."""
|
||||||
return f"https://openalex.org/{strip_openalex_prefix(institution_id)}"
|
return f"https://openalex.org/{strip_openalex_prefix(institution_id)}"
|
||||||
|
|||||||
@@ -2,12 +2,16 @@
|
|||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import asyncio
|
import asyncio
|
||||||
from typing import Any, Callable, Optional
|
from typing import Any, Awaitable, Callable, Optional
|
||||||
from inse.integrations.elasticsearch import search
|
from inse.integrations.elasticsearch import search
|
||||||
from inse.utils import normalize_name
|
from inse.utils import normalize_name
|
||||||
from inse.model import ESCluster, ESIndex
|
from inse.model import ESCluster, ESIndex
|
||||||
from inse.authors.v2.service import _build_collaboration_graph
|
from inse.authors.v2.service import (
|
||||||
|
_build_collaboration_graph,
|
||||||
|
_build_collaboration_graph_query,
|
||||||
|
)
|
||||||
from inse.auth.model import Account, Organization
|
from inse.auth.model import Account, Organization
|
||||||
|
from inse import config
|
||||||
from .model import (
|
from .model import (
|
||||||
OrgminerContent,
|
OrgminerContent,
|
||||||
ClassifiedPage,
|
ClassifiedPage,
|
||||||
@@ -133,6 +137,180 @@ async def get_person_collaborator_weights(
|
|||||||
return weights
|
return weights
|
||||||
|
|
||||||
|
|
||||||
|
async def get_collaborator_weights_for_targets(
|
||||||
|
author_id: str,
|
||||||
|
institution_id: str,
|
||||||
|
target_ids: set[str] | frozenset[str] | list[str],
|
||||||
|
) -> dict[str, float]:
|
||||||
|
"""Return ``{collaborator_id: shared_work_weight}`` only for ``target_ids``.
|
||||||
|
|
||||||
|
The collaboration-graph builder expands every pair of authors on every work,
|
||||||
|
which explodes for works with hundreds or thousands of authors. Verification
|
||||||
|
only needs the weights towards the other staff candidates in the same
|
||||||
|
organization, so this asks Elasticsearch for those counts directly.
|
||||||
|
"""
|
||||||
|
targets = sorted(set(target_ids) - {author_id})
|
||||||
|
if not targets:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
query = _build_collaboration_graph_query(
|
||||||
|
raw_oa_author_id=author_id,
|
||||||
|
institution_ids=[institution_id],
|
||||||
|
)
|
||||||
|
body = {
|
||||||
|
"size": 0,
|
||||||
|
"query": query,
|
||||||
|
"aggs": {
|
||||||
|
"collaborators": {
|
||||||
|
"nested": {"path": "authorships"},
|
||||||
|
"aggs": {
|
||||||
|
"targets": {
|
||||||
|
"terms": {
|
||||||
|
"field": "authorships.author.id",
|
||||||
|
"include": targets,
|
||||||
|
"size": len(targets),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
results = await search(
|
||||||
|
body=body,
|
||||||
|
index=ESIndex.OPENALEX_WORKS_WILDCARD,
|
||||||
|
cluster=ESCluster.NES,
|
||||||
|
)
|
||||||
|
buckets = (
|
||||||
|
results.get("aggregations", {})
|
||||||
|
.get("collaborators", {})
|
||||||
|
.get("targets", {})
|
||||||
|
.get("buckets", [])
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
bucket["key"]: float(bucket["doc_count"])
|
||||||
|
for bucket in buckets
|
||||||
|
if bucket.get("key")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async def get_verified_staff_with_collab_graph(
|
||||||
|
staff_list: list[dict[str, Any]],
|
||||||
|
institution_id: str = DEFAULT_INSTITUTION_ID,
|
||||||
|
max_concurrent_queries: int | None = None,
|
||||||
|
) -> list[dict[str, Any]]:
|
||||||
|
"""Return verified staff entries with the OpenAlex IDs and edges proving verification.
|
||||||
|
|
||||||
|
A staff entry is verified when at least one of its OpenAlex author candidates
|
||||||
|
has a collaboration edge to a candidate belonging to a different staff entry
|
||||||
|
in the same organization.
|
||||||
|
|
||||||
|
Only collaborator weights towards the organization's other staff candidates
|
||||||
|
are fetched, so verification memory does not grow with the size of an
|
||||||
|
author's full co-author network.
|
||||||
|
|
||||||
|
``max_concurrent_queries`` bounds the OpenAlex candidate and graph searches.
|
||||||
|
It is useful for batch jobs processing organizations with large staff lists.
|
||||||
|
"""
|
||||||
|
if max_concurrent_queries is not None and max_concurrent_queries < 1:
|
||||||
|
raise ValueError("max_concurrent_queries must be at least 1.")
|
||||||
|
|
||||||
|
query_semaphore = (
|
||||||
|
asyncio.Semaphore(max_concurrent_queries)
|
||||||
|
if max_concurrent_queries is not None
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
|
||||||
|
async def _run_query(operation: Callable[[], Awaitable[Any]]) -> Any:
|
||||||
|
if query_semaphore is None:
|
||||||
|
return await operation()
|
||||||
|
async with query_semaphore:
|
||||||
|
return await operation()
|
||||||
|
|
||||||
|
async def _resolve_staff(staff: dict[str, Any]) -> set[str]:
|
||||||
|
name = staff.get("name")
|
||||||
|
if not name:
|
||||||
|
return set()
|
||||||
|
|
||||||
|
candidate_ids = await _run_query(
|
||||||
|
lambda: resolve_author_candidates(
|
||||||
|
normalize_name(name),
|
||||||
|
institution_id,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return set(candidate_ids)
|
||||||
|
|
||||||
|
async def _get_neighbor_weights(
|
||||||
|
author_id: str, target_ids: set[str]
|
||||||
|
) -> dict[str, float]:
|
||||||
|
return await _run_query(
|
||||||
|
lambda: get_collaborator_weights_for_targets(
|
||||||
|
author_id,
|
||||||
|
institution_id,
|
||||||
|
target_ids,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
candidate_sets = await asyncio.gather(
|
||||||
|
*(_resolve_staff(staff) for staff in staff_list)
|
||||||
|
)
|
||||||
|
|
||||||
|
async def _verify_staff(
|
||||||
|
staff_index: int, own_ids: set[str]
|
||||||
|
) -> dict[str, Any] | None:
|
||||||
|
if not own_ids:
|
||||||
|
return None
|
||||||
|
|
||||||
|
other_ids = (
|
||||||
|
set().union(
|
||||||
|
*(
|
||||||
|
candidate_ids
|
||||||
|
for index, candidate_ids in enumerate(candidate_sets)
|
||||||
|
if index != staff_index
|
||||||
|
)
|
||||||
|
)
|
||||||
|
- own_ids
|
||||||
|
)
|
||||||
|
if not other_ids:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# ``other_ids`` only contains OpenAlex candidates of the other staff
|
||||||
|
# entries in this organization, and every candidate set was resolved
|
||||||
|
# against ``institution_id``. Collaborator weights are therefore
|
||||||
|
# restricted to same-university colleagues; no external co-author can
|
||||||
|
# contribute evidence.
|
||||||
|
author_ids = sorted(own_ids)
|
||||||
|
neighbor_weights = await asyncio.gather(
|
||||||
|
*(_get_neighbor_weights(author_id, other_ids) for author_id in author_ids)
|
||||||
|
)
|
||||||
|
evidence = [
|
||||||
|
{
|
||||||
|
"openalex_id": author_id,
|
||||||
|
"collaborator_openalex_id": collaborator_id,
|
||||||
|
"shared_work_weight": weights[collaborator_id],
|
||||||
|
}
|
||||||
|
for author_id, weights in zip(author_ids, neighbor_weights)
|
||||||
|
for collaborator_id in sorted(weights.keys() & other_ids)
|
||||||
|
]
|
||||||
|
if not evidence:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return {
|
||||||
|
"staff_index": staff_index,
|
||||||
|
"staff": staff_list[staff_index],
|
||||||
|
"openalex_ids": sorted({item["openalex_id"] for item in evidence}),
|
||||||
|
"collaboration_evidence": evidence,
|
||||||
|
}
|
||||||
|
|
||||||
|
checked_entries = await asyncio.gather(
|
||||||
|
*(
|
||||||
|
_verify_staff(staff_index, candidate_ids)
|
||||||
|
for staff_index, candidate_ids in enumerate(candidate_sets)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return [entry for entry in checked_entries if entry is not None]
|
||||||
|
|
||||||
|
|
||||||
async def find_org_for_person(
|
async def find_org_for_person(
|
||||||
name: str,
|
name: str,
|
||||||
institution_id: str = None,
|
institution_id: str = None,
|
||||||
@@ -566,62 +744,14 @@ async def get_orgminer_content_verified_by_collab_graph(
|
|||||||
orgminer_content = hits[0]["_source"]
|
orgminer_content = hits[0]["_source"]
|
||||||
staff_list = orgminer_content.get("staff") or []
|
staff_list = orgminer_content.get("staff") or []
|
||||||
|
|
||||||
async def _resolve_staff(staff: dict) -> set[str]:
|
verified_entries = await get_verified_staff_with_collab_graph(
|
||||||
name = staff.get("name")
|
staff_list,
|
||||||
if not name:
|
institution_id,
|
||||||
return set()
|
|
||||||
|
|
||||||
candidate_ids = await resolve_author_candidates(
|
|
||||||
normalize_name(name),
|
|
||||||
institution_id,
|
|
||||||
)
|
|
||||||
return set(candidate_ids)
|
|
||||||
|
|
||||||
async def _get_neighbor_ids(author_id: str) -> set[str]:
|
|
||||||
collaborator_weights = await get_person_collaborator_weights(
|
|
||||||
author_id,
|
|
||||||
institution_id,
|
|
||||||
)
|
|
||||||
return set(collaborator_weights.keys())
|
|
||||||
|
|
||||||
candidate_sets = await asyncio.gather(
|
|
||||||
*(_resolve_staff(staff) for staff in staff_list)
|
|
||||||
)
|
|
||||||
|
|
||||||
async def _is_verified(staff_index: int) -> bool:
|
|
||||||
own_ids = candidate_sets[staff_index]
|
|
||||||
if not own_ids:
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Candidates belonging to other staff members only.
|
|
||||||
other_ids = (
|
|
||||||
set().union(
|
|
||||||
*(
|
|
||||||
candidate_ids
|
|
||||||
for index, candidate_ids in enumerate(candidate_sets)
|
|
||||||
if index != staff_index
|
|
||||||
)
|
|
||||||
)
|
|
||||||
- own_ids
|
|
||||||
)
|
|
||||||
|
|
||||||
if not other_ids:
|
|
||||||
return False
|
|
||||||
|
|
||||||
neighbor_sets = await asyncio.gather(
|
|
||||||
*(_get_neighbor_ids(author_id) for author_id in own_ids)
|
|
||||||
)
|
|
||||||
|
|
||||||
return any(neighbor_ids & other_ids for neighbor_ids in neighbor_sets)
|
|
||||||
|
|
||||||
verified_flags = await asyncio.gather(
|
|
||||||
*(_is_verified(index) for index in range(len(staff_list)))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
orgminer_content["verified_staff"] = [
|
orgminer_content["verified_staff"] = [
|
||||||
staff
|
entry["staff"]
|
||||||
for staff, is_verified in zip(staff_list, verified_flags)
|
for entry in verified_entries
|
||||||
if is_verified
|
|
||||||
]
|
]
|
||||||
|
|
||||||
return OrgminerContent.from_elastic_hit(orgminer_content)
|
return OrgminerContent.from_elastic_hit(orgminer_content)
|
||||||
@@ -703,4 +833,4 @@ async def get_classified_pages(org_url: str,institution_id: str = DEFAULT_INSTIT
|
|||||||
return ClassifiedPageResponse(
|
return ClassifiedPageResponse(
|
||||||
total=response["hits"]["total"]["value"],
|
total=response["hits"]["total"]["value"],
|
||||||
pages=classified_pages
|
pages=classified_pages
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
from inse.orgminer.institutions_helper import (
|
||||||
|
normalize_org_uri,
|
||||||
|
strip_openalex_prefix,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_normalize_org_uri_matches_equivalent_hierarchy_links():
|
||||||
|
assert (
|
||||||
|
normalize_org_uri(" https://www.uni-due.de/zmb/ ")
|
||||||
|
== "https://www.uni-due.de/zmb"
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
normalize_org_uri("https://www.uni-due.de/zmb/index")
|
||||||
|
== "https://www.uni-due.de/zmb"
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
normalize_org_uri("https://www.uni-due.de/zmb/index/")
|
||||||
|
== "https://www.uni-due.de/zmb"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_normalize_org_uri_returns_none_for_missing_values():
|
||||||
|
assert normalize_org_uri(None) is None
|
||||||
|
assert normalize_org_uri(" ") is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_strip_openalex_prefix_accepts_raw_and_full_author_ids():
|
||||||
|
assert strip_openalex_prefix("A5018971503") == "A5018971503"
|
||||||
|
assert (
|
||||||
|
strip_openalex_prefix("https://openalex.org/A5018971503")
|
||||||
|
== "A5018971503"
|
||||||
|
)
|
||||||
@@ -1,8 +1,170 @@
|
|||||||
|
import asyncio
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from inse.orgminer import logic
|
from inse.orgminer import logic
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_verified_staff_with_collab_graph_returns_matching_ids_and_edges(
|
||||||
|
monkeypatch,
|
||||||
|
):
|
||||||
|
staff = [
|
||||||
|
{"name": "Person One", "email": "one@example.org"},
|
||||||
|
{"name": "Person Two"},
|
||||||
|
]
|
||||||
|
resolved = {
|
||||||
|
"person one": ["https://openalex.org/A1", "https://openalex.org/A2"],
|
||||||
|
"person two": ["https://openalex.org/B1"],
|
||||||
|
}
|
||||||
|
neighbors = {
|
||||||
|
"https://openalex.org/A1": {"https://openalex.org/B1": 2.5},
|
||||||
|
"https://openalex.org/A2": {},
|
||||||
|
"https://openalex.org/B1": {},
|
||||||
|
}
|
||||||
|
|
||||||
|
async def resolve_author_candidates(name, institution_id):
|
||||||
|
return resolved[name]
|
||||||
|
|
||||||
|
async def get_collaborator_weights_for_targets(
|
||||||
|
author_id, institution_id, target_ids
|
||||||
|
):
|
||||||
|
return {
|
||||||
|
collaborator_id: weight
|
||||||
|
for collaborator_id, weight in neighbors[author_id].items()
|
||||||
|
if collaborator_id in target_ids
|
||||||
|
}
|
||||||
|
|
||||||
|
monkeypatch.setattr(logic, "resolve_author_candidates", resolve_author_candidates)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
logic, "get_collaborator_weights_for_targets", get_collaborator_weights_for_targets
|
||||||
|
)
|
||||||
|
|
||||||
|
result = asyncio.run(
|
||||||
|
logic.get_verified_staff_with_collab_graph(staff, "I123")
|
||||||
|
)
|
||||||
|
|
||||||
|
assert result == [
|
||||||
|
{
|
||||||
|
"staff_index": 0,
|
||||||
|
"staff": staff[0],
|
||||||
|
"openalex_ids": ["https://openalex.org/A1"],
|
||||||
|
"collaboration_evidence": [
|
||||||
|
{
|
||||||
|
"openalex_id": "https://openalex.org/A1",
|
||||||
|
"collaborator_openalex_id": "https://openalex.org/B1",
|
||||||
|
"shared_work_weight": 2.5,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_verified_staff_with_collab_graph_respects_query_concurrency(
|
||||||
|
monkeypatch,
|
||||||
|
):
|
||||||
|
staff = [{"name": "Person One"}, {"name": "Person Two"}]
|
||||||
|
active_queries = 0
|
||||||
|
peak_queries = 0
|
||||||
|
|
||||||
|
async def tracked(result):
|
||||||
|
nonlocal active_queries, peak_queries
|
||||||
|
active_queries += 1
|
||||||
|
peak_queries = max(peak_queries, active_queries)
|
||||||
|
try:
|
||||||
|
await asyncio.sleep(0.001)
|
||||||
|
return result
|
||||||
|
finally:
|
||||||
|
active_queries -= 1
|
||||||
|
|
||||||
|
async def resolve_author_candidates(name, institution_id):
|
||||||
|
author_id = "https://openalex.org/A1" if name == "person one" else "https://openalex.org/A2"
|
||||||
|
return await tracked([author_id])
|
||||||
|
|
||||||
|
async def get_collaborator_weights_for_targets(
|
||||||
|
author_id, institution_id, target_ids
|
||||||
|
):
|
||||||
|
neighbor_id = (
|
||||||
|
"https://openalex.org/A2"
|
||||||
|
if author_id == "https://openalex.org/A1"
|
||||||
|
else "https://openalex.org/A1"
|
||||||
|
)
|
||||||
|
return await tracked(
|
||||||
|
{neighbor_id: 1.0} if neighbor_id in target_ids else {}
|
||||||
|
)
|
||||||
|
|
||||||
|
monkeypatch.setattr(logic, "resolve_author_candidates", resolve_author_candidates)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
logic, "get_collaborator_weights_for_targets", get_collaborator_weights_for_targets
|
||||||
|
)
|
||||||
|
|
||||||
|
result = asyncio.run(
|
||||||
|
logic.get_verified_staff_with_collab_graph(
|
||||||
|
staff,
|
||||||
|
"I123",
|
||||||
|
max_concurrent_queries=1,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
assert len(result) == 2
|
||||||
|
assert peak_queries == 1
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_collaborator_weights_for_targets_uses_bounded_aggregation(
|
||||||
|
monkeypatch,
|
||||||
|
):
|
||||||
|
captured = {}
|
||||||
|
|
||||||
|
async def fake_search(**kwargs):
|
||||||
|
captured.update(kwargs)
|
||||||
|
return {
|
||||||
|
"aggregations": {
|
||||||
|
"collaborators": {
|
||||||
|
"targets": {
|
||||||
|
"buckets": [
|
||||||
|
{"key": "https://openalex.org/B1", "doc_count": 7},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
monkeypatch.setattr(logic, "search", fake_search)
|
||||||
|
|
||||||
|
result = asyncio.run(
|
||||||
|
logic.get_collaborator_weights_for_targets(
|
||||||
|
"https://openalex.org/A1",
|
||||||
|
"I123",
|
||||||
|
{"https://openalex.org/B1", "https://openalex.org/A1"},
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
assert result == {"https://openalex.org/B1": 7.0}
|
||||||
|
body = captured["body"]
|
||||||
|
assert body["size"] == 0
|
||||||
|
nested = body["aggs"]["collaborators"]
|
||||||
|
assert nested["nested"] == {"path": "authorships"}
|
||||||
|
assert nested["aggs"]["targets"]["terms"]["include"] == [
|
||||||
|
"https://openalex.org/B1"
|
||||||
|
]
|
||||||
|
assert "query" in body
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_collaborator_weights_for_targets_without_targets_skips_request(
|
||||||
|
monkeypatch,
|
||||||
|
):
|
||||||
|
async def fail_search(**kwargs):
|
||||||
|
raise AssertionError("search must not be called")
|
||||||
|
|
||||||
|
monkeypatch.setattr(logic, "search", fail_search)
|
||||||
|
|
||||||
|
result = asyncio.run(
|
||||||
|
logic.get_collaborator_weights_for_targets(
|
||||||
|
"https://openalex.org/A1", "I123", set()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
assert result == {}
|
||||||
|
|
||||||
|
|
||||||
def test_update_hierarchy_removes_deleted_nodes_and_edit_markers(tmp_path, monkeypatch):
|
def test_update_hierarchy_removes_deleted_nodes_and_edit_markers(tmp_path, monkeypatch):
|
||||||
monkeypatch.setattr(logic, "HIERARCHIES_DIR", tmp_path)
|
monkeypatch.setattr(logic, "HIERARCHIES_DIR", tmp_path)
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,20 @@ from inse.exceptions import (
|
|||||||
NotFoundException,
|
NotFoundException,
|
||||||
)
|
)
|
||||||
from inse.integrations import elasticsearch
|
from inse.integrations import elasticsearch
|
||||||
from inse.model import ESIndex
|
from inse.model import ESCluster, ESIndex
|
||||||
from inse.models.openalex.author import Author
|
from inse.models.openalex.author import Author
|
||||||
from inse.models.openalex.authors_list_response import AuthorsListResponse
|
from inse.models.openalex.authors_list_response import AuthorsListResponse
|
||||||
from inse.models.openalex.meta import Meta
|
from inse.models.openalex.meta import Meta
|
||||||
|
from inse.orgminer.institutions_helper import (
|
||||||
|
DEFAULT_INSTITUTION_ID,
|
||||||
|
normalize_org_uri,
|
||||||
|
strip_openalex_prefix,
|
||||||
|
)
|
||||||
from inse.persons.model import (
|
from inse.persons.model import (
|
||||||
CareerMetrics,
|
CareerMetrics,
|
||||||
CustomAuthor,
|
CustomAuthor,
|
||||||
CustomAuthorsListResponse,
|
CustomAuthorsListResponse,
|
||||||
|
VerifiedOrganization,
|
||||||
)
|
)
|
||||||
from inse.persons.query_builder import build_authors_search_rescored
|
from inse.persons.query_builder import build_authors_search_rescored
|
||||||
from inse.works.logic import enrich_topic_descriptions
|
from inse.works.logic import enrich_topic_descriptions
|
||||||
@@ -32,6 +38,77 @@ from .. import config, util
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
INDEX_NAME = "openalex-authors"
|
INDEX_NAME = "openalex-authors"
|
||||||
UDE_INSTITUTION_ID = "https://openalex.org/I62318514" # Universität Duisburg-Essen
|
UDE_INSTITUTION_ID = "https://openalex.org/I62318514" # Universität Duisburg-Essen
|
||||||
|
VERIFIED_PERSONS_INDEX = "orgminer_verified_persons_ude"
|
||||||
|
VERIFIED_PERSONS_INSTITUTION_ID = DEFAULT_INSTITUTION_ID
|
||||||
|
VERIFIED_PERSON_FIELDS = [
|
||||||
|
"openalex_id",
|
||||||
|
"org_name",
|
||||||
|
"org_uri",
|
||||||
|
"org_hierarchy_path",
|
||||||
|
"verified_at",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
async def get_verified_organizations(author_id: str) -> list[VerifiedOrganization]:
|
||||||
|
"""Return organizations where ``author_id`` is a verified staff member.
|
||||||
|
|
||||||
|
Reads the OrgMiner verified-persons index on the INSE cluster. Documents are
|
||||||
|
keyed by the person's OpenAlex id field (both raw and full-URL forms are
|
||||||
|
accepted), so the lookup does not depend on the index's ``_id`` scheme.
|
||||||
|
|
||||||
|
An unavailable index must not break the person page, so failures are logged
|
||||||
|
and reported as "not verified".
|
||||||
|
"""
|
||||||
|
short_id = strip_openalex_prefix(author_id.strip().rstrip("/"))
|
||||||
|
if not short_id:
|
||||||
|
return []
|
||||||
|
|
||||||
|
query = {
|
||||||
|
"_source": VERIFIED_PERSON_FIELDS,
|
||||||
|
"size": 50,
|
||||||
|
"query": {
|
||||||
|
"terms": {
|
||||||
|
"openalex_id": [short_id, f"https://openalex.org/{short_id}"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sort": [
|
||||||
|
{"verified_at": {"order": "desc", "missing": "_last"}},
|
||||||
|
{"org_name.keyword": {"order": "asc", "missing": "_last"}},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
data = await elasticsearch.search(
|
||||||
|
body=query, index=VERIFIED_PERSONS_INDEX, cluster=ESCluster.INSE
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.exception(
|
||||||
|
"Verified-organization lookup failed for author %r.", author_id
|
||||||
|
)
|
||||||
|
return []
|
||||||
|
|
||||||
|
organizations: dict[str, VerifiedOrganization] = {}
|
||||||
|
for hit in data.get("hits", {}).get("hits", []):
|
||||||
|
source = hit.get("_source") or {}
|
||||||
|
org_uri = normalize_org_uri(source.get("org_uri"))
|
||||||
|
org_name = (source.get("org_name") or "").strip()
|
||||||
|
key = org_uri or org_name.casefold()
|
||||||
|
if not key:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Old sha256-ID and new person-level documents can coexist until the
|
||||||
|
# index is rebuilt. The newest document wins because of the sort above.
|
||||||
|
organizations.setdefault(
|
||||||
|
key,
|
||||||
|
VerifiedOrganization(
|
||||||
|
org_name=org_name or org_uri or "Unbekannte Organisation",
|
||||||
|
org_uri=org_uri,
|
||||||
|
org_hierarchy_path=source.get("org_hierarchy_path") or [],
|
||||||
|
verified_at=source.get("verified_at"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
return list(organizations.values())
|
||||||
|
|
||||||
|
|
||||||
async def find_ude_author_by_name(display_name: str) -> dict | None:
|
async def find_ude_author_by_name(display_name: str) -> dict | None:
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ Data models for persons / authors.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from inse.models.openalex.author import Author
|
from inse.models.openalex.author import Author
|
||||||
@@ -71,6 +73,31 @@ class PersonBio(BaseModel):
|
|||||||
bio: str = Field(description="The generated biography.")
|
bio: str = Field(description="The generated biography.")
|
||||||
|
|
||||||
|
|
||||||
|
class VerifiedOrganization(BaseModel):
|
||||||
|
org_name: str = Field(description="Display name of the verified organization.")
|
||||||
|
org_uri: str | None = Field(
|
||||||
|
default=None, description="Organization URL, normalized for hierarchy matching."
|
||||||
|
)
|
||||||
|
org_hierarchy_path: list[str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="Path from the hierarchy root to the organization node.",
|
||||||
|
)
|
||||||
|
verified_at: datetime | None = Field(
|
||||||
|
default=None, description="When the organization membership was verified."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class VerifiedOrganizationsResponse(BaseModel):
|
||||||
|
institution_id: str | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="OpenAlex institution ID that the verified memberships belong to.",
|
||||||
|
)
|
||||||
|
organizations: list[VerifiedOrganization] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="Organizations where the person has verified staff membership.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class PersonFilters(BaseModel):
|
class PersonFilters(BaseModel):
|
||||||
institution: str | None = None
|
institution: str | None = None
|
||||||
cited_by_count: int | None = None
|
cited_by_count: int | None = None
|
||||||
|
|||||||
@@ -75,6 +75,25 @@ async def get_person_by_id(
|
|||||||
return await logic.get_person_by_id(author_id=id, include=include)
|
return await logic.get_person_by_id(author_id=id, include=include)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/person/{id}/verified-organizations",
|
||||||
|
operation_id="getVerifiedOrganizations",
|
||||||
|
response_model=model.VerifiedOrganizationsResponse,
|
||||||
|
summary="Returns the organizations where a person is a verified staff member.",
|
||||||
|
tags=["Persons"],
|
||||||
|
)
|
||||||
|
async def get_verified_organizations(
|
||||||
|
id: Annotated[
|
||||||
|
str, Path(description="OpenAlex author ID", example=["A5093075883"])
|
||||||
|
],
|
||||||
|
):
|
||||||
|
organizations = await logic.get_verified_organizations(author_id=id)
|
||||||
|
return model.VerifiedOrganizationsResponse(
|
||||||
|
institution_id=logic.VERIFIED_PERSONS_INSTITUTION_ID,
|
||||||
|
organizations=organizations,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/persons/searchByName",
|
"/persons/searchByName",
|
||||||
operation_id="searchPersonsByName",
|
operation_id="searchPersonsByName",
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
import asyncio
|
||||||
|
|
||||||
|
from inse.model import ESCluster
|
||||||
|
from inse.persons import logic, service
|
||||||
|
|
||||||
|
|
||||||
|
def _hit(
|
||||||
|
*,
|
||||||
|
org_name: str,
|
||||||
|
org_uri: str | None,
|
||||||
|
verified_at: str | None = "2026-01-02T03:04:05Z",
|
||||||
|
) -> dict:
|
||||||
|
return {
|
||||||
|
"_source": {
|
||||||
|
"openalex_id": "https://openalex.org/A5018971503",
|
||||||
|
"org_name": org_name,
|
||||||
|
"org_uri": org_uri,
|
||||||
|
"org_hierarchy_path": ["Fakultät", org_name],
|
||||||
|
"verified_at": verified_at,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_verified_organizations_uses_person_id_field_and_deduplicates(monkeypatch):
|
||||||
|
calls: list[dict] = []
|
||||||
|
|
||||||
|
async def fake_search(**kwargs):
|
||||||
|
calls.append(kwargs)
|
||||||
|
return {
|
||||||
|
"hits": {
|
||||||
|
"hits": [
|
||||||
|
_hit(
|
||||||
|
org_name="Zentrum für Mikroskopie",
|
||||||
|
org_uri="https://www.uni-due.de/zmb/",
|
||||||
|
),
|
||||||
|
# Same organization from an older sha256-ID document.
|
||||||
|
_hit(
|
||||||
|
org_name="Zentrum für Mikroskopie",
|
||||||
|
org_uri="https://www.uni-due.de/zmb/index",
|
||||||
|
),
|
||||||
|
_hit(org_name="Institut für Physik", org_uri=None),
|
||||||
|
_hit(org_name="Institut für Physik", org_uri=None),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
monkeypatch.setattr(logic.elasticsearch, "search", fake_search)
|
||||||
|
|
||||||
|
result = asyncio.run(
|
||||||
|
logic.get_verified_organizations("https://openalex.org/A5018971503")
|
||||||
|
)
|
||||||
|
|
||||||
|
assert len(calls) == 1
|
||||||
|
assert calls[0]["index"] == logic.VERIFIED_PERSONS_INDEX
|
||||||
|
assert calls[0]["cluster"] == ESCluster.INSE
|
||||||
|
assert calls[0]["body"]["query"]["terms"]["openalex_id"] == [
|
||||||
|
"A5018971503",
|
||||||
|
"https://openalex.org/A5018971503",
|
||||||
|
]
|
||||||
|
assert [organization.org_name for organization in result] == [
|
||||||
|
"Zentrum für Mikroskopie",
|
||||||
|
"Institut für Physik",
|
||||||
|
]
|
||||||
|
assert result[0].org_uri == "https://www.uni-due.de/zmb"
|
||||||
|
assert result[0].org_hierarchy_path == [
|
||||||
|
"Fakultät",
|
||||||
|
"Zentrum für Mikroskopie",
|
||||||
|
]
|
||||||
|
assert result[0].verified_at is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_verified_organizations_accepts_raw_author_id(monkeypatch):
|
||||||
|
calls: list[dict] = []
|
||||||
|
|
||||||
|
async def fake_search(**kwargs):
|
||||||
|
calls.append(kwargs)
|
||||||
|
return {"hits": {"hits": []}}
|
||||||
|
|
||||||
|
monkeypatch.setattr(logic.elasticsearch, "search", fake_search)
|
||||||
|
|
||||||
|
assert asyncio.run(logic.get_verified_organizations(" A5018971503/ ")) == []
|
||||||
|
assert calls[0]["body"]["query"]["terms"]["openalex_id"] == [
|
||||||
|
"A5018971503",
|
||||||
|
"https://openalex.org/A5018971503",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_verified_organizations_returns_empty_on_search_failure(monkeypatch):
|
||||||
|
async def failing_search(**kwargs):
|
||||||
|
raise RuntimeError("INSE is unavailable")
|
||||||
|
|
||||||
|
monkeypatch.setattr(logic.elasticsearch, "search", failing_search)
|
||||||
|
|
||||||
|
assert asyncio.run(logic.get_verified_organizations("A5018971503")) == []
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_verified_organizations_skips_search_without_author_id(monkeypatch):
|
||||||
|
async def unexpected_search(**kwargs):
|
||||||
|
raise AssertionError("search must not be called without an author id")
|
||||||
|
|
||||||
|
monkeypatch.setattr(logic.elasticsearch, "search", unexpected_search)
|
||||||
|
|
||||||
|
assert asyncio.run(logic.get_verified_organizations(" ")) == []
|
||||||
|
|
||||||
|
|
||||||
|
def test_service_response_includes_verified_data_institution(monkeypatch):
|
||||||
|
async def fake_get_verified_organizations(author_id: str):
|
||||||
|
return []
|
||||||
|
|
||||||
|
monkeypatch.setattr(
|
||||||
|
logic, "get_verified_organizations", fake_get_verified_organizations
|
||||||
|
)
|
||||||
|
|
||||||
|
response = asyncio.run(
|
||||||
|
service.get_verified_organizations(id="A5018971503")
|
||||||
|
)
|
||||||
|
|
||||||
|
assert response.institution_id == logic.VERIFIED_PERSONS_INSTITUTION_ID
|
||||||
|
assert response.organizations == []
|
||||||
@@ -1,7 +1,18 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from inse import config
|
||||||
from inse.projects import eu_cordis_projects_client as eu_cordis_search_client
|
from inse.projects import eu_cordis_projects_client as eu_cordis_search_client
|
||||||
|
|
||||||
|
|
||||||
|
requires_inse_elasticsearch = pytest.mark.skipif(
|
||||||
|
not (
|
||||||
|
config.settings.elasticsearch_inse_url
|
||||||
|
and config.settings.elasticsearch_inse_api_key
|
||||||
|
),
|
||||||
|
reason="INSE Elasticsearch is not configured",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_active_period_filter_matches_projects_overlapping_interval():
|
async def test_active_period_filter_matches_projects_overlapping_interval():
|
||||||
query, _, _ = await eu_cordis_search_client._build_eu_cordis_search_query(
|
query, _, _ = await eu_cordis_search_client._build_eu_cordis_search_query(
|
||||||
@@ -18,6 +29,7 @@ async def test_active_period_filter_matches_projects_overlapping_interval():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_by_title():
|
async def test_search_eu_cordis_projects_by_title():
|
||||||
"""Test searching EU CORDIS projects by title."""
|
"""Test searching EU CORDIS projects by title."""
|
||||||
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
||||||
@@ -35,6 +47,7 @@ async def test_search_eu_cordis_projects_by_title():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_by_keywords():
|
async def test_search_eu_cordis_projects_by_keywords():
|
||||||
"""Test searching EU CORDIS projects by keywords."""
|
"""Test searching EU CORDIS projects by keywords."""
|
||||||
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
||||||
@@ -51,6 +64,7 @@ async def test_search_eu_cordis_projects_by_keywords():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_by_framework_programme():
|
async def test_search_eu_cordis_projects_by_framework_programme():
|
||||||
"""Test filtering EU CORDIS projects by framework programme."""
|
"""Test filtering EU CORDIS projects by framework programme."""
|
||||||
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
||||||
@@ -67,6 +81,7 @@ async def test_search_eu_cordis_projects_by_framework_programme():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_by_status():
|
async def test_search_eu_cordis_projects_by_status():
|
||||||
"""Test filtering EU CORDIS projects by status."""
|
"""Test filtering EU CORDIS projects by status."""
|
||||||
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
||||||
@@ -83,6 +98,7 @@ async def test_search_eu_cordis_projects_by_status():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_by_funding_years():
|
async def test_search_eu_cordis_projects_by_funding_years():
|
||||||
"""Test filtering EU CORDIS projects by funding start years."""
|
"""Test filtering EU CORDIS projects by funding start years."""
|
||||||
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
||||||
@@ -101,6 +117,7 @@ async def test_search_eu_cordis_projects_by_funding_years():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_by_country():
|
async def test_search_eu_cordis_projects_by_country():
|
||||||
"""Test filtering EU CORDIS projects by country."""
|
"""Test filtering EU CORDIS projects by country."""
|
||||||
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
||||||
@@ -120,6 +137,7 @@ async def test_search_eu_cordis_projects_by_country():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_by_organization_name():
|
async def test_search_eu_cordis_projects_by_organization_name():
|
||||||
"""Test filtering EU CORDIS projects by organization name."""
|
"""Test filtering EU CORDIS projects by organization name."""
|
||||||
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
||||||
@@ -139,6 +157,7 @@ async def test_search_eu_cordis_projects_by_organization_name():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_by_organization_id():
|
async def test_search_eu_cordis_projects_by_organization_id():
|
||||||
"""Test filtering EU CORDIS projects by organization ID."""
|
"""Test filtering EU CORDIS projects by organization ID."""
|
||||||
# Use a known organization ID (e.g., Max Planck Society)
|
# Use a known organization ID (e.g., Max Planck Society)
|
||||||
@@ -160,6 +179,7 @@ async def test_search_eu_cordis_projects_by_organization_id():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_by_project_type():
|
async def test_search_eu_cordis_projects_by_project_type():
|
||||||
"""Test filtering EU CORDIS projects by project type (FP7, H2020, HEU)."""
|
"""Test filtering EU CORDIS projects by project type (FP7, H2020, HEU)."""
|
||||||
from inse.projects.model import EuCordisProjectType
|
from inse.projects.model import EuCordisProjectType
|
||||||
@@ -192,6 +212,7 @@ async def test_search_eu_cordis_projects_by_project_type():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_with_sorting():
|
async def test_search_eu_cordis_projects_with_sorting():
|
||||||
"""Test sorting EU CORDIS projects."""
|
"""Test sorting EU CORDIS projects."""
|
||||||
# Test ascending sort by title
|
# Test ascending sort by title
|
||||||
@@ -222,6 +243,7 @@ async def test_search_eu_cordis_projects_with_sorting():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_pagination():
|
async def test_search_eu_cordis_projects_pagination():
|
||||||
"""Test pagination of EU CORDIS project search results."""
|
"""Test pagination of EU CORDIS project search results."""
|
||||||
# Get first page
|
# Get first page
|
||||||
@@ -251,6 +273,7 @@ async def test_search_eu_cordis_projects_pagination():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_get_enriched_cordis_project_by_id():
|
async def test_get_enriched_cordis_project_by_id():
|
||||||
"""Test fetching an enriched EU CORDIS project by ID."""
|
"""Test fetching an enriched EU CORDIS project by ID."""
|
||||||
# Use a known project ID (e.g., an H2020 project)
|
# Use a known project ID (e.g., an H2020 project)
|
||||||
@@ -269,6 +292,7 @@ async def test_get_enriched_cordis_project_by_id():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_get_enriched_cordis_project_by_id_not_found():
|
async def test_get_enriched_cordis_project_by_id_not_found():
|
||||||
"""Test fetching a non-existent EU CORDIS project."""
|
"""Test fetching a non-existent EU CORDIS project."""
|
||||||
project = await eu_cordis_search_client.get_enriched_cordis_project_by_id("nonexistent_id")
|
project = await eu_cordis_search_client.get_enriched_cordis_project_by_id("nonexistent_id")
|
||||||
@@ -286,6 +310,7 @@ async def test_get_enriched_cordis_project_by_id_empty():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_get_dois_by_cordis_eu_project_id():
|
async def test_get_dois_by_cordis_eu_project_id():
|
||||||
"""Test retrieving DOIs for a CORDIS EU project."""
|
"""Test retrieving DOIs for a CORDIS EU project."""
|
||||||
known_id = "101016442" # Example H2020 project ID
|
known_id = "101016442" # Example H2020 project ID
|
||||||
@@ -295,6 +320,7 @@ async def test_get_dois_by_cordis_eu_project_id():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_get_openalex_authors_for_cordis_project_ids():
|
async def test_get_openalex_authors_for_cordis_project_ids():
|
||||||
"""Test retrieving OpenAlex authors for CORDIS project IDs."""
|
"""Test retrieving OpenAlex authors for CORDIS project IDs."""
|
||||||
project_ids = ["101016442"] # Example H2020 project ID
|
project_ids = ["101016442"] # Example H2020 project ID
|
||||||
@@ -312,6 +338,7 @@ async def test_get_openalex_authors_for_cordis_project_ids():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_with_multiple_filters():
|
async def test_search_eu_cordis_projects_with_multiple_filters():
|
||||||
"""Test combining multiple filters in EU CORDIS project search."""
|
"""Test combining multiple filters in EU CORDIS project search."""
|
||||||
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
||||||
@@ -334,6 +361,7 @@ async def test_search_eu_cordis_projects_with_multiple_filters():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_empty_results():
|
async def test_search_eu_cordis_projects_empty_results():
|
||||||
"""Test search that should return no results."""
|
"""Test search that should return no results."""
|
||||||
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
||||||
@@ -347,6 +375,7 @@ async def test_search_eu_cordis_projects_empty_results():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_by_funding_scheme():
|
async def test_search_eu_cordis_projects_by_funding_scheme():
|
||||||
"""Test filtering EU CORDIS projects by funding scheme."""
|
"""Test filtering EU CORDIS projects by funding scheme."""
|
||||||
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
res = await eu_cordis_search_client.search_eu_cordis_projects(
|
||||||
@@ -363,6 +392,7 @@ async def test_search_eu_cordis_projects_by_funding_scheme():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_eu_cordis_projects_with_fuzzy_topic_search():
|
async def test_search_eu_cordis_projects_with_fuzzy_topic_search():
|
||||||
"""Test fuzzy search with OpenAlex topic IDs."""
|
"""Test fuzzy search with OpenAlex topic IDs."""
|
||||||
# This test requires known OpenAlex topic IDs
|
# This test requires known OpenAlex topic IDs
|
||||||
|
|||||||
@@ -2,10 +2,21 @@ from unittest.mock import AsyncMock, patch
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from inse import config
|
||||||
from inse.projects import projects_search_client
|
from inse.projects import projects_search_client
|
||||||
|
|
||||||
|
|
||||||
|
requires_inse_elasticsearch = pytest.mark.skipif(
|
||||||
|
not (
|
||||||
|
config.settings.elasticsearch_inse_url
|
||||||
|
and config.settings.elasticsearch_inse_api_key
|
||||||
|
),
|
||||||
|
reason="INSE Elasticsearch is not configured",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_search_dfg_projects():
|
async def test_search_dfg_projects():
|
||||||
# Test search with name
|
# Test search with name
|
||||||
res = await projects_search_client.search_dfg_projects(
|
res = await projects_search_client.search_dfg_projects(
|
||||||
@@ -51,6 +62,7 @@ async def test_search_dfg_projects_returns_empty_page_without_enrichment_crash()
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
@requires_inse_elasticsearch
|
||||||
async def test_get_dfg_project_by_id():
|
async def test_get_dfg_project_by_id():
|
||||||
# Get by ID of the project we found or a known one
|
# Get by ID of the project we found or a known one
|
||||||
known_id = 164008977
|
known_id = 164008977
|
||||||
|
|||||||
@@ -8,3 +8,4 @@ class RouterPrefixes(StrEnum):
|
|||||||
TOPICS_V2 = "/api/topics/v2"
|
TOPICS_V2 = "/api/topics/v2"
|
||||||
AUTHORS_V2 = "/api/authors/v2"
|
AUTHORS_V2 = "/api/authors/v2"
|
||||||
WORKS_V2 = "/api/works/v2"
|
WORKS_V2 = "/api/works/v2"
|
||||||
|
MULTIPLICATORS = "/api/multiplicators"
|
||||||
|
|||||||
@@ -27,3 +27,5 @@ class Tags(StrEnum):
|
|||||||
BACKGROUND_JOBS = "Background Jobs"
|
BACKGROUND_JOBS = "Background Jobs"
|
||||||
|
|
||||||
BUND_INSTITUTIONS = "BUND Institutions"
|
BUND_INSTITUTIONS = "BUND Institutions"
|
||||||
|
|
||||||
|
MULTIPLICATORS = "Multiplicators"
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ from unittest.mock import AsyncMock, patch
|
|||||||
async def test_search_author_works_passes_institution_filter_to_query():
|
async def test_search_author_works_passes_institution_filter_to_query():
|
||||||
with patch("inse.integrations.elasticsearch.search", new_callable=AsyncMock) as mock_search:
|
with patch("inse.integrations.elasticsearch.search", new_callable=AsyncMock) as mock_search:
|
||||||
mock_search.return_value = {"hits": {"total": {"value": 1}, "hits": []}}
|
mock_search.return_value = {"hits": {"total": {"value": 1}, "hits": []}}
|
||||||
client = OpenAlexWorksSearchClient(index="openalex-works")
|
client = OpenAlexWorksSearchClient(index="openalex-works", api_key="test-key")
|
||||||
|
|
||||||
await client.search_author_works(
|
await client.search_author_works(
|
||||||
"A5023888391",
|
"A5023888391",
|
||||||
@@ -201,7 +201,7 @@ async def test_search_author_works_passes_institution_filter_to_query():
|
|||||||
async def test_search_author_works_passes_topic_filter_to_query():
|
async def test_search_author_works_passes_topic_filter_to_query():
|
||||||
with patch("inse.integrations.elasticsearch.search", new_callable=AsyncMock) as mock_search:
|
with patch("inse.integrations.elasticsearch.search", new_callable=AsyncMock) as mock_search:
|
||||||
mock_search.return_value = {"hits": {"total": {"value": 1}, "hits": []}}
|
mock_search.return_value = {"hits": {"total": {"value": 1}, "hits": []}}
|
||||||
client = OpenAlexWorksSearchClient(index="openalex-works")
|
client = OpenAlexWorksSearchClient(index="openalex-works", api_key="test-key")
|
||||||
|
|
||||||
await client.search_author_works(
|
await client.search_author_works(
|
||||||
"A5023888391",
|
"A5023888391",
|
||||||
@@ -243,7 +243,7 @@ async def test_search_author_works_passes_topic_filter_to_query():
|
|||||||
async def test_search_author_works_calls_elasticsearch_index_with_api_key():
|
async def test_search_author_works_calls_elasticsearch_index_with_api_key():
|
||||||
with patch("inse.integrations.elasticsearch.search", new_callable=AsyncMock) as mock_search:
|
with patch("inse.integrations.elasticsearch.search", new_callable=AsyncMock) as mock_search:
|
||||||
mock_search.return_value = {"hits": {"total": {"value": 0}, "hits": []}}
|
mock_search.return_value = {"hits": {"total": {"value": 0}, "hits": []}}
|
||||||
client = OpenAlexWorksSearchClient(index="openalex-works")
|
client = OpenAlexWorksSearchClient(index="openalex-works", api_key="test-key")
|
||||||
|
|
||||||
result = await client.search_author_works("A5023888391", page=1, size=20)
|
result = await client.search_author_works("A5023888391", page=1, size=20)
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ async def test_search_author_works_calls_elasticsearch_index_with_api_key():
|
|||||||
async def test_search_work_filters_by_work_id():
|
async def test_search_work_filters_by_work_id():
|
||||||
with patch("inse.integrations.elasticsearch.search", new_callable=AsyncMock) as mock_search:
|
with patch("inse.integrations.elasticsearch.search", new_callable=AsyncMock) as mock_search:
|
||||||
mock_search.return_value = {"hits": {"total": {"value": 1}, "hits": []}}
|
mock_search.return_value = {"hits": {"total": {"value": 1}, "hits": []}}
|
||||||
client = OpenAlexWorksSearchClient(index="openalex-works")
|
client = OpenAlexWorksSearchClient(index="openalex-works", api_key="test-key")
|
||||||
|
|
||||||
await client.search_work("W2741809807")
|
await client.search_work("W2741809807")
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ api/funding.service.ts
|
|||||||
api/institutions.service.ts
|
api/institutions.service.ts
|
||||||
api/institutionsV2.service.ts
|
api/institutionsV2.service.ts
|
||||||
api/keywords.service.ts
|
api/keywords.service.ts
|
||||||
|
api/multiplicators.service.ts
|
||||||
api/news.service.ts
|
api/news.service.ts
|
||||||
api/organization.service.ts
|
api/organization.service.ts
|
||||||
api/orgminer.service.ts
|
api/orgminer.service.ts
|
||||||
@@ -38,6 +39,7 @@ model/accessToken.ts
|
|||||||
model/accountPage.ts
|
model/accountPage.ts
|
||||||
model/accountProfile.ts
|
model/accountProfile.ts
|
||||||
model/allPatentsResponse.ts
|
model/allPatentsResponse.ts
|
||||||
|
model/archetypeOverlap.ts
|
||||||
model/author.ts
|
model/author.ts
|
||||||
model/authorAffiliationsInner.ts
|
model/authorAffiliationsInner.ts
|
||||||
model/authorCountsByYearInner.ts
|
model/authorCountsByYearInner.ts
|
||||||
@@ -78,8 +80,10 @@ model/bundProjectHighlight.ts
|
|||||||
model/bundProjectPage.ts
|
model/bundProjectPage.ts
|
||||||
model/bundProjectSummary.ts
|
model/bundProjectSummary.ts
|
||||||
model/bundProjectTopics.ts
|
model/bundProjectTopics.ts
|
||||||
|
model/careerBucket.ts
|
||||||
model/careerMetrics.ts
|
model/careerMetrics.ts
|
||||||
model/careerStage.ts
|
model/careerStage.ts
|
||||||
|
model/careerStageStatistics.ts
|
||||||
model/category.ts
|
model/category.ts
|
||||||
model/categoryBucket.ts
|
model/categoryBucket.ts
|
||||||
model/classifiedPage.ts
|
model/classifiedPage.ts
|
||||||
@@ -127,6 +131,9 @@ model/domain.ts
|
|||||||
model/domainFieldsInner.ts
|
model/domainFieldsInner.ts
|
||||||
model/domainIds.ts
|
model/domainIds.ts
|
||||||
model/edge.ts
|
model/edge.ts
|
||||||
|
model/egoNetwork.ts
|
||||||
|
model/egoNetworkEdge.ts
|
||||||
|
model/egoNetworkNode.ts
|
||||||
model/euCordisEurosciVocSummary.ts
|
model/euCordisEurosciVocSummary.ts
|
||||||
model/euCordisOrganizationSelectorPage.ts
|
model/euCordisOrganizationSelectorPage.ts
|
||||||
model/euCordisOrganizationSelectorSummary.ts
|
model/euCordisOrganizationSelectorSummary.ts
|
||||||
@@ -145,6 +152,20 @@ model/extractedKeywordsLLM.ts
|
|||||||
model/extractedKeywordsResponse.ts
|
model/extractedKeywordsResponse.ts
|
||||||
model/fieldNode.ts
|
model/fieldNode.ts
|
||||||
model/fileUpload.ts
|
model/fileUpload.ts
|
||||||
|
model/founderCandidate.ts
|
||||||
|
model/founderCandidatePage.ts
|
||||||
|
model/founderFeatureImportance.ts
|
||||||
|
model/founderFeatures.ts
|
||||||
|
model/founderHorizonModel.ts
|
||||||
|
model/founderModelInfo.ts
|
||||||
|
model/founderPotential.ts
|
||||||
|
model/founderScreen.ts
|
||||||
|
model/founderScreenReason.ts
|
||||||
|
model/founderSortBy.ts
|
||||||
|
model/founderStatistics.ts
|
||||||
|
model/founderStatisticsParameters.ts
|
||||||
|
model/founderStatisticsProvenance.ts
|
||||||
|
model/founderTiming.ts
|
||||||
model/fp7EurosciVoc.ts
|
model/fp7EurosciVoc.ts
|
||||||
model/fp7LegalBasis.ts
|
model/fp7LegalBasis.ts
|
||||||
model/fp7Organization.ts
|
model/fp7Organization.ts
|
||||||
@@ -158,6 +179,8 @@ model/funderByAuthor.ts
|
|||||||
model/fundersByAuthorResponse.ts
|
model/fundersByAuthorResponse.ts
|
||||||
model/fundingProject.ts
|
model/fundingProject.ts
|
||||||
model/fundingProjectPage.ts
|
model/fundingProjectPage.ts
|
||||||
|
model/funnelStage.ts
|
||||||
|
model/funnelStageKey.ts
|
||||||
model/fwci.ts
|
model/fwci.ts
|
||||||
model/groupByResult.ts
|
model/groupByResult.ts
|
||||||
model/h2020Deliverable.ts
|
model/h2020Deliverable.ts
|
||||||
@@ -227,9 +250,12 @@ model/matchedOfficer.ts
|
|||||||
model/matchedTopic.ts
|
model/matchedTopic.ts
|
||||||
model/mentionedPerson.ts
|
model/mentionedPerson.ts
|
||||||
model/meta.ts
|
model/meta.ts
|
||||||
|
model/metricValue.ts
|
||||||
model/model2YrMeanCitedness.ts
|
model/model2YrMeanCitedness.ts
|
||||||
model/modelField.ts
|
model/modelField.ts
|
||||||
model/models.ts
|
model/models.ts
|
||||||
|
model/multiplierPeerRanks.ts
|
||||||
|
model/multiplierTag.ts
|
||||||
model/newsArticle.ts
|
model/newsArticle.ts
|
||||||
model/newsArticleDetail.ts
|
model/newsArticleDetail.ts
|
||||||
model/newsPage.ts
|
model/newsPage.ts
|
||||||
@@ -249,6 +275,7 @@ model/patentsByAuthorResponse.ts
|
|||||||
model/patentsByInstitutionResponse.ts
|
model/patentsByInstitutionResponse.ts
|
||||||
model/patentsByKeywordsRequest.ts
|
model/patentsByKeywordsRequest.ts
|
||||||
model/patentsByKeywordsResponse.ts
|
model/patentsByKeywordsResponse.ts
|
||||||
|
model/peerRankField.ts
|
||||||
model/personBio.ts
|
model/personBio.ts
|
||||||
model/personBookmarkResponse.ts
|
model/personBookmarkResponse.ts
|
||||||
model/primaryCategoryYearAggregation.ts
|
model/primaryCategoryYearAggregation.ts
|
||||||
@@ -267,9 +294,18 @@ model/rankingResponse.ts
|
|||||||
model/rankingWeights.ts
|
model/rankingWeights.ts
|
||||||
model/rebuildResponse.ts
|
model/rebuildResponse.ts
|
||||||
model/registryHealth.ts
|
model/registryHealth.ts
|
||||||
|
model/researchAreaStatistics.ts
|
||||||
|
model/researcherDetail.ts
|
||||||
|
model/researcherMetrics.ts
|
||||||
|
model/researcherSortBy.ts
|
||||||
|
model/researcherSummary.ts
|
||||||
|
model/researcherSummaryPage.ts
|
||||||
model/saveHierarchyResponse.ts
|
model/saveHierarchyResponse.ts
|
||||||
model/score.ts
|
model/score.ts
|
||||||
model/selectedAuthorsRequest.ts
|
model/selectedAuthorsRequest.ts
|
||||||
|
model/showcase.ts
|
||||||
|
model/showcaseEntry.ts
|
||||||
|
model/showcaseKind.ts
|
||||||
model/sortDirection.ts
|
model/sortDirection.ts
|
||||||
model/startCollaborationGraphResponse.ts
|
model/startCollaborationGraphResponse.ts
|
||||||
model/subfield.ts
|
model/subfield.ts
|
||||||
@@ -320,6 +356,8 @@ model/userRole.ts
|
|||||||
model/validationError.ts
|
model/validationError.ts
|
||||||
model/validationErrorLocInner.ts
|
model/validationErrorLocInner.ts
|
||||||
model/value.ts
|
model/value.ts
|
||||||
|
model/verifiedOrganization.ts
|
||||||
|
model/verifiedOrganizationsResponse.ts
|
||||||
model/work.ts
|
model/work.ts
|
||||||
model/workBiblio.ts
|
model/workBiblio.ts
|
||||||
model/workCitationNormalizedPercentile.ts
|
model/workCitationNormalizedPercentile.ts
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ export * from './institutionsV2.service';
|
|||||||
import { InstitutionsV2Service } from './institutionsV2.service';
|
import { InstitutionsV2Service } from './institutionsV2.service';
|
||||||
export * from './keywords.service';
|
export * from './keywords.service';
|
||||||
import { KeywordsService } from './keywords.service';
|
import { KeywordsService } from './keywords.service';
|
||||||
|
export * from './multiplicators.service';
|
||||||
|
import { MultiplicatorsService } from './multiplicators.service';
|
||||||
export * from './news.service';
|
export * from './news.service';
|
||||||
import { NewsService } from './news.service';
|
import { NewsService } from './news.service';
|
||||||
export * from './organization.service';
|
export * from './organization.service';
|
||||||
@@ -48,4 +50,4 @@ export * from './works.service';
|
|||||||
import { WorksService } from './works.service';
|
import { WorksService } from './works.service';
|
||||||
export * from './worksV2.service';
|
export * from './worksV2.service';
|
||||||
import { WorksV2Service } from './worksV2.service';
|
import { WorksV2Service } from './worksV2.service';
|
||||||
export const APIS = [AuthService, AuthorsV2Service, BUNDInstitutionsService, BackgroundJobsService, BookmarksService, CompanyConnectionsService, DFGInstitutionsService, DFGPersonsService, DashboardService, FundingService, InstitutionsService, InstitutionsV2Service, KeywordsService, NewsService, OrganizationService, OrgminerService, PatentsService, PersonsService, ProjectsService, RankingService, TopicsService, TopicsV2Service, UniversityRankingsService, WorksService, WorksV2Service];
|
export const APIS = [AuthService, AuthorsV2Service, BUNDInstitutionsService, BackgroundJobsService, BookmarksService, CompanyConnectionsService, DFGInstitutionsService, DFGPersonsService, DashboardService, FundingService, InstitutionsService, InstitutionsV2Service, KeywordsService, MultiplicatorsService, NewsService, OrganizationService, OrgminerService, PatentsService, PersonsService, ProjectsService, RankingService, TopicsService, TopicsV2Service, UniversityRankingsService, WorksService, WorksV2Service];
|
||||||
|
|||||||
+1032
-1938
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,18 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import {
|
import { HttpClient, HttpHeaders, HttpParams,
|
||||||
HttpClient,
|
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||||
HttpHeaders,
|
} from '@angular/common/http';
|
||||||
HttpParams,
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
HttpResponse,
|
import { Observable } from 'rxjs';
|
||||||
HttpEvent,
|
|
||||||
HttpParameterCodec,
|
|
||||||
HttpContext,
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { Author } from '../model/author';
|
import { Author } from '../model/author';
|
||||||
@@ -34,613 +28,333 @@ import { HTTPValidationError } from '../model/hTTPValidationError';
|
|||||||
import { StartCollaborationGraphResponse } from '../model/startCollaborationGraphResponse';
|
import { StartCollaborationGraphResponse } from '../model/startCollaborationGraphResponse';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class AuthorsV2Service extends BaseService {
|
export class AuthorsV2Service extends BaseService {
|
||||||
constructor(
|
|
||||||
protected httpClient: HttpClient,
|
|
||||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
|
||||||
@Optional() configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
* Returns a paginated list of authors for a given search term based on their display name.
|
super(basePath, configuration);
|
||||||
* @endpoint get /api/authors/v2/autocomplete/selector
|
|
||||||
* @param query A search term to filter authors by (partial matches allowed).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public autocompleteAuthorsForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<AuthorPage>;
|
|
||||||
public autocompleteAuthorsForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<AuthorPage>>;
|
|
||||||
public autocompleteAuthorsForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<AuthorPage>>;
|
|
||||||
public autocompleteAuthorsForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>query,
|
|
||||||
'query',
|
|
||||||
);
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
/**
|
||||||
options?.context ?? new HttpContext();
|
* Returns a paginated list of authors for a given search term based on their display name.
|
||||||
|
* @endpoint get /api/authors/v2/autocomplete/selector
|
||||||
|
* @param query A search term to filter authors by (partial matches allowed).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public autocompleteAuthorsForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorPage>;
|
||||||
|
public autocompleteAuthorsForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorPage>>;
|
||||||
|
public autocompleteAuthorsForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorPage>>;
|
||||||
|
public autocompleteAuthorsForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>query, 'query');
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let localVarHeaders = this.defaultHeaders;
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/authors/v2/autocomplete/selector`;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
const { basePath, withCredentials } = this.configuration;
|
'application/json'
|
||||||
return this.httpClient.request<AuthorPage>(
|
]);
|
||||||
'get',
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
`${basePath}${localVarPath}`,
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
{
|
}
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
* Returns an author for a given author ID.
|
|
||||||
* @endpoint get /api/authors/v2/{raw_oa_author_id}
|
|
||||||
* @param rawOaAuthorId The ID of the author to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getAuthorById(
|
|
||||||
rawOaAuthorId: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<Author>;
|
|
||||||
public getAuthorById(
|
|
||||||
rawOaAuthorId: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<Author>>;
|
|
||||||
public getAuthorById(
|
|
||||||
rawOaAuthorId: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<Author>>;
|
|
||||||
public getAuthorById(
|
|
||||||
rawOaAuthorId: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Required parameter rawOaAuthorId was null or undefined when calling getAuthorById.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
options?.context ?? new HttpContext();
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarPath = `/api/authors/v2/autocomplete/selector`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
return this.httpClient.request<AuthorPage>('get', `${basePath}${localVarPath}`,
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
{
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
context: localVarHttpContext,
|
||||||
responseType_ = 'text';
|
params: localVarQueryParameters,
|
||||||
} else if (
|
responseType: <any>responseType_,
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
) {
|
headers: localVarHeaders,
|
||||||
responseType_ = 'json';
|
observe: observe,
|
||||||
} else {
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
responseType_ = 'blob';
|
reportProgress: reportProgress
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/authors/v2/${this.configuration.encodeParam({ name: 'rawOaAuthorId', value: rawOaAuthorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Author>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a paginated list of authors for a given list of author IDs.
|
|
||||||
* @endpoint get /api/authors/v2/authors/id
|
|
||||||
* @param authorIds A list of author IDs to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getAuthorsByIds(
|
|
||||||
authorIds?: Array<string>,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<AuthorPage>;
|
|
||||||
public getAuthorsByIds(
|
|
||||||
authorIds?: Array<string>,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<AuthorPage>>;
|
|
||||||
public getAuthorsByIds(
|
|
||||||
authorIds?: Array<string>,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<AuthorPage>>;
|
|
||||||
public getAuthorsByIds(
|
|
||||||
authorIds?: Array<string>,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
if (authorIds) {
|
|
||||||
authorIds.forEach((element) => {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>element,
|
|
||||||
'author_ids',
|
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Returns an author for a given author ID.
|
||||||
|
* @endpoint get /api/authors/v2/{raw_oa_author_id}
|
||||||
|
* @param rawOaAuthorId The ID of the author to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getAuthorById(rawOaAuthorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Author>;
|
||||||
|
public getAuthorById(rawOaAuthorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Author>>;
|
||||||
|
public getAuthorById(rawOaAuthorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Author>>;
|
||||||
|
public getAuthorById(rawOaAuthorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
||||||
|
throw new Error('Required parameter rawOaAuthorId was null or undefined when calling getAuthorById.');
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
let localVarHeaders = this.defaultHeaders;
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
options?.context ?? new HttpContext();
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/authors/v2/authors/id`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<AuthorPage>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
* Returns the status of a collaboration graph generation task.
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
* @endpoint get /api/authors/v2/collaboration-graph/{graph_id}/status
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
* @param graphId The ID of the collaboration graph generation task.
|
responseType_ = 'text';
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
* @param reportProgress flag to report request and response progress.
|
responseType_ = 'json';
|
||||||
*/
|
} else {
|
||||||
public getCollaborationGraphStatus(
|
responseType_ = 'blob';
|
||||||
graphId: string,
|
}
|
||||||
observe?: 'body',
|
}
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<CollaborationGraphStatusResponse>;
|
|
||||||
public getCollaborationGraphStatus(
|
|
||||||
graphId: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<CollaborationGraphStatusResponse>>;
|
|
||||||
public getCollaborationGraphStatus(
|
|
||||||
graphId: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<CollaborationGraphStatusResponse>>;
|
|
||||||
public getCollaborationGraphStatus(
|
|
||||||
graphId: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
if (graphId === null || graphId === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Required parameter graphId was null or undefined when calling getCollaborationGraphStatus.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarPath = `/api/authors/v2/${this.configuration.encodeParam({name: "rawOaAuthorId", value: rawOaAuthorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
return this.httpClient.request<Author>('get', `${basePath}${localVarPath}`,
|
||||||
options?.httpHeaderAccept ??
|
{
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
context: localVarHttpContext,
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
responseType: <any>responseType_,
|
||||||
localVarHeaders = localVarHeaders.set(
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
'Accept',
|
headers: localVarHeaders,
|
||||||
localVarHttpHeaderAcceptSelected,
|
observe: observe,
|
||||||
);
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
}
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
const localVarHttpContext: HttpContext =
|
|
||||||
options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/authors/v2/collaboration-graph/${this.configuration.encodeParam({ name: 'graphId', value: graphId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/status`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<CollaborationGraphStatusResponse>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a collaboration graph for a given author ID.
|
|
||||||
* @endpoint post /api/authors/v2/collaboration-graph
|
|
||||||
* @param rawOaAuthorId The raw OpenAlex author ID for which to retrieve the collaboration graph.
|
|
||||||
* @param yearFrom The starting year to filter the works by (optional).
|
|
||||||
* @param yearTo The ending year to filter the works by (optional).
|
|
||||||
* @param minCollaborators The minimum number of collaborators to filter the works by (optional).
|
|
||||||
* @param maxCollaborators The maximum number of collaborators to filter the works by (optional).
|
|
||||||
* @param topicIds A list of topic IDs to filter the works by (optional).
|
|
||||||
* @param institutionIds A list of institution IDs to filter the works by (optional).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public startCollaborationGraph(
|
|
||||||
rawOaAuthorId: string,
|
|
||||||
yearFrom?: number,
|
|
||||||
yearTo?: number,
|
|
||||||
minCollaborators?: number,
|
|
||||||
maxCollaborators?: number,
|
|
||||||
topicIds?: Array<string>,
|
|
||||||
institutionIds?: Array<string>,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<StartCollaborationGraphResponse>;
|
|
||||||
public startCollaborationGraph(
|
|
||||||
rawOaAuthorId: string,
|
|
||||||
yearFrom?: number,
|
|
||||||
yearTo?: number,
|
|
||||||
minCollaborators?: number,
|
|
||||||
maxCollaborators?: number,
|
|
||||||
topicIds?: Array<string>,
|
|
||||||
institutionIds?: Array<string>,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<StartCollaborationGraphResponse>>;
|
|
||||||
public startCollaborationGraph(
|
|
||||||
rawOaAuthorId: string,
|
|
||||||
yearFrom?: number,
|
|
||||||
yearTo?: number,
|
|
||||||
minCollaborators?: number,
|
|
||||||
maxCollaborators?: number,
|
|
||||||
topicIds?: Array<string>,
|
|
||||||
institutionIds?: Array<string>,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<StartCollaborationGraphResponse>>;
|
|
||||||
public startCollaborationGraph(
|
|
||||||
rawOaAuthorId: string,
|
|
||||||
yearFrom?: number,
|
|
||||||
yearTo?: number,
|
|
||||||
minCollaborators?: number,
|
|
||||||
maxCollaborators?: number,
|
|
||||||
topicIds?: Array<string>,
|
|
||||||
institutionIds?: Array<string>,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Required parameter rawOaAuthorId was null or undefined when calling startCollaborationGraph.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>rawOaAuthorId,
|
|
||||||
'raw_oa_author_id',
|
|
||||||
);
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>yearFrom,
|
|
||||||
'year_from',
|
|
||||||
);
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>yearTo,
|
|
||||||
'year_to',
|
|
||||||
);
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>minCollaborators,
|
|
||||||
'min_collaborators',
|
|
||||||
);
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>maxCollaborators,
|
|
||||||
'max_collaborators',
|
|
||||||
);
|
|
||||||
if (topicIds) {
|
|
||||||
topicIds.forEach((element) => {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>element,
|
|
||||||
'topic_ids',
|
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (institutionIds) {
|
|
||||||
institutionIds.forEach((element) => {
|
/**
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
* Returns a paginated list of authors for a given list of author IDs.
|
||||||
localVarQueryParameters,
|
* @endpoint get /api/authors/v2/authors/id
|
||||||
<any>element,
|
* @param authorIds A list of author IDs to retrieve.
|
||||||
'institution_ids',
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getAuthorsByIds(authorIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorPage>;
|
||||||
|
public getAuthorsByIds(authorIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorPage>>;
|
||||||
|
public getAuthorsByIds(authorIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorPage>>;
|
||||||
|
public getAuthorsByIds(authorIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
if (authorIds) {
|
||||||
|
authorIds.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>element, 'author_ids');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/authors/v2/authors/id`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<AuthorPage>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Returns the status of a collaboration graph generation task.
|
||||||
|
* @endpoint get /api/authors/v2/collaboration-graph/{graph_id}/status
|
||||||
|
* @param graphId The ID of the collaboration graph generation task.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getCollaborationGraphStatus(graphId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CollaborationGraphStatusResponse>;
|
||||||
|
public getCollaborationGraphStatus(graphId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CollaborationGraphStatusResponse>>;
|
||||||
|
public getCollaborationGraphStatus(graphId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CollaborationGraphStatusResponse>>;
|
||||||
|
public getCollaborationGraphStatus(graphId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (graphId === null || graphId === undefined) {
|
||||||
|
throw new Error('Required parameter graphId was null or undefined when calling getCollaborationGraphStatus.');
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
let localVarHeaders = this.defaultHeaders;
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'application/json'
|
||||||
localVarHeaders = localVarHeaders.set(
|
]);
|
||||||
'Accept',
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHttpHeaderAcceptSelected,
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
);
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/authors/v2/collaboration-graph/${this.configuration.encodeParam({name: "graphId", value: graphId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/status`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<CollaborationGraphStatusResponse>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
/**
|
||||||
options?.context ?? new HttpContext();
|
* Returns a collaboration graph for a given author ID.
|
||||||
|
* @endpoint post /api/authors/v2/collaboration-graph
|
||||||
|
* @param rawOaAuthorId The raw OpenAlex author ID for which to retrieve the collaboration graph.
|
||||||
|
* @param yearFrom The starting year to filter the works by (optional).
|
||||||
|
* @param yearTo The ending year to filter the works by (optional).
|
||||||
|
* @param minCollaborators The minimum number of collaborators to filter the works by (optional).
|
||||||
|
* @param maxCollaborators The maximum number of collaborators to filter the works by (optional).
|
||||||
|
* @param topicIds A list of topic IDs to filter the works by (optional).
|
||||||
|
* @param institutionIds A list of institution IDs to filter the works by (optional).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public startCollaborationGraph(rawOaAuthorId: string, yearFrom?: number, yearTo?: number, minCollaborators?: number, maxCollaborators?: number, topicIds?: Array<string>, institutionIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<StartCollaborationGraphResponse>;
|
||||||
|
public startCollaborationGraph(rawOaAuthorId: string, yearFrom?: number, yearTo?: number, minCollaborators?: number, maxCollaborators?: number, topicIds?: Array<string>, institutionIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<StartCollaborationGraphResponse>>;
|
||||||
|
public startCollaborationGraph(rawOaAuthorId: string, yearFrom?: number, yearTo?: number, minCollaborators?: number, maxCollaborators?: number, topicIds?: Array<string>, institutionIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<StartCollaborationGraphResponse>>;
|
||||||
|
public startCollaborationGraph(rawOaAuthorId: string, yearFrom?: number, yearTo?: number, minCollaborators?: number, maxCollaborators?: number, topicIds?: Array<string>, institutionIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
||||||
|
throw new Error('Required parameter rawOaAuthorId was null or undefined when calling startCollaborationGraph.');
|
||||||
|
}
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>rawOaAuthorId, 'raw_oa_author_id');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>yearFrom, 'year_from');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>yearTo, 'year_to');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>minCollaborators, 'min_collaborators');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>maxCollaborators, 'max_collaborators');
|
||||||
|
if (topicIds) {
|
||||||
|
topicIds.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>element, 'topic_ids');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (institutionIds) {
|
||||||
|
institutionIds.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>element, 'institution_ids');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let localVarHeaders = this.defaultHeaders;
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
responseType_ = 'text';
|
'application/json'
|
||||||
} else if (
|
]);
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
) {
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
responseType_ = 'json';
|
}
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
}
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/authors/v2/collaboration-graph`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<StartCollaborationGraphResponse>('post', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarPath = `/api/authors/v2/collaboration-graph`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<StartCollaborationGraphResponse>(
|
|
||||||
'post',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,18 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import {
|
import { HttpClient, HttpHeaders, HttpParams,
|
||||||
HttpClient,
|
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||||
HttpHeaders,
|
} from '@angular/common/http';
|
||||||
HttpParams,
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
HttpResponse,
|
import { Observable } from 'rxjs';
|
||||||
HttpEvent,
|
|
||||||
HttpParameterCodec,
|
|
||||||
HttpContext,
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BundInstitutionSummaryPage } from '../model/bundInstitutionSummaryPage';
|
import { BundInstitutionSummaryPage } from '../model/bundInstitutionSummaryPage';
|
||||||
@@ -28,231 +22,137 @@ import { BundInstitutionSummaryPage } from '../model/bundInstitutionSummaryPage'
|
|||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class BUNDInstitutionsService extends BaseService {
|
export class BUNDInstitutionsService extends BaseService {
|
||||||
constructor(
|
|
||||||
protected httpClient: HttpClient,
|
|
||||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
|
||||||
@Optional() configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
* Returns a list of institutions based on a search term for autocomplete functionality.
|
super(basePath, configuration);
|
||||||
* @endpoint get /api/bund/institutions/autocomplete/selector
|
|
||||||
* @param query A search term to filter institutions by (partial matches allowed).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getBundInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<BundInstitutionSummaryPage>;
|
|
||||||
public getBundInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<BundInstitutionSummaryPage>>;
|
|
||||||
public getBundInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<BundInstitutionSummaryPage>>;
|
|
||||||
public getBundInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>query,
|
|
||||||
'query',
|
|
||||||
);
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
/**
|
||||||
options?.context ?? new HttpContext();
|
* Returns a list of institutions based on a search term for autocomplete functionality.
|
||||||
|
* @endpoint get /api/bund/institutions/autocomplete/selector
|
||||||
|
* @param query A search term to filter institutions by (partial matches allowed).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getBundInstitutionAutocompleteForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<BundInstitutionSummaryPage>;
|
||||||
|
public getBundInstitutionAutocompleteForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<BundInstitutionSummaryPage>>;
|
||||||
|
public getBundInstitutionAutocompleteForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<BundInstitutionSummaryPage>>;
|
||||||
|
public getBundInstitutionAutocompleteForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>query, 'query');
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let localVarHeaders = this.defaultHeaders;
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/bund/institutions/autocomplete/selector`;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
const { basePath, withCredentials } = this.configuration;
|
'application/json'
|
||||||
return this.httpClient.request<BundInstitutionSummaryPage>(
|
]);
|
||||||
'get',
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
`${basePath}${localVarPath}`,
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
{
|
}
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
* Returns a list of institutions based on their names.
|
|
||||||
* @endpoint get /api/bund/institutions/names
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
* @param institutionNames A list of institution names to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
*/
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
public getBundInstitutionsByName(
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
institutionNames?: Array<string>,
|
responseType_ = 'text';
|
||||||
observe?: 'body',
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
reportProgress?: boolean,
|
responseType_ = 'json';
|
||||||
options?: {
|
} else {
|
||||||
httpHeaderAccept?: 'application/json';
|
responseType_ = 'blob';
|
||||||
context?: HttpContext;
|
}
|
||||||
transferCache?: boolean;
|
}
|
||||||
},
|
|
||||||
): Observable<BundInstitutionSummaryPage>;
|
let localVarPath = `/api/bund/institutions/autocomplete/selector`;
|
||||||
public getBundInstitutionsByName(
|
const { basePath, withCredentials } = this.configuration;
|
||||||
institutionNames?: Array<string>,
|
return this.httpClient.request<BundInstitutionSummaryPage>('get', `${basePath}${localVarPath}`,
|
||||||
observe?: 'response',
|
{
|
||||||
reportProgress?: boolean,
|
context: localVarHttpContext,
|
||||||
options?: {
|
params: localVarQueryParameters,
|
||||||
httpHeaderAccept?: 'application/json';
|
responseType: <any>responseType_,
|
||||||
context?: HttpContext;
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
transferCache?: boolean;
|
headers: localVarHeaders,
|
||||||
},
|
observe: observe,
|
||||||
): Observable<HttpResponse<BundInstitutionSummaryPage>>;
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
public getBundInstitutionsByName(
|
reportProgress: reportProgress
|
||||||
institutionNames?: Array<string>,
|
}
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<BundInstitutionSummaryPage>>;
|
|
||||||
public getBundInstitutionsByName(
|
|
||||||
institutionNames?: Array<string>,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
if (institutionNames) {
|
|
||||||
institutionNames.forEach((element) => {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>element,
|
|
||||||
'institution_names',
|
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Returns a list of institutions based on their names.
|
||||||
|
* @endpoint get /api/bund/institutions/names
|
||||||
|
* @param institutionNames A list of institution names to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getBundInstitutionsByName(institutionNames?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<BundInstitutionSummaryPage>;
|
||||||
|
public getBundInstitutionsByName(institutionNames?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<BundInstitutionSummaryPage>>;
|
||||||
|
public getBundInstitutionsByName(institutionNames?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<BundInstitutionSummaryPage>>;
|
||||||
|
public getBundInstitutionsByName(institutionNames?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
options?.httpHeaderAccept ??
|
if (institutionNames) {
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
institutionNames.forEach((element) => {
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarHeaders = localVarHeaders.set(
|
<any>element, 'institution_names');
|
||||||
'Accept',
|
})
|
||||||
localVarHttpHeaderAcceptSelected,
|
}
|
||||||
);
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/bund/institutions/names`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<BundInstitutionSummaryPage>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
|
||||||
options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/bund/institutions/names`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<BundInstitutionSummaryPage>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,18 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import {
|
import { HttpClient, HttpHeaders, HttpParams,
|
||||||
HttpClient,
|
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||||
HttpHeaders,
|
} from '@angular/common/http';
|
||||||
HttpParams,
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
HttpResponse,
|
import { Observable } from 'rxjs';
|
||||||
HttpEvent,
|
|
||||||
HttpParameterCodec,
|
|
||||||
HttpContext,
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { CreatePersonBookmark } from '../model/createPersonBookmark';
|
import { CreatePersonBookmark } from '../model/createPersonBookmark';
|
||||||
@@ -30,375 +24,206 @@ import { HTTPValidationError } from '../model/hTTPValidationError';
|
|||||||
import { PersonBookmarkResponse } from '../model/personBookmarkResponse';
|
import { PersonBookmarkResponse } from '../model/personBookmarkResponse';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class BookmarksService extends BaseService {
|
export class BookmarksService extends BaseService {
|
||||||
constructor(
|
|
||||||
protected httpClient: HttpClient,
|
|
||||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
|
||||||
@Optional() configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
* Bookmark Person
|
super(basePath, configuration);
|
||||||
* @endpoint put /api/bookmarks/persons/{person_id}
|
|
||||||
* @param personId
|
|
||||||
* @param createPersonBookmark
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public bookmarkPerson(
|
|
||||||
personId: string,
|
|
||||||
createPersonBookmark: CreatePersonBookmark,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<PersonBookmarkResponse>;
|
|
||||||
public bookmarkPerson(
|
|
||||||
personId: string,
|
|
||||||
createPersonBookmark: CreatePersonBookmark,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<PersonBookmarkResponse>>;
|
|
||||||
public bookmarkPerson(
|
|
||||||
personId: string,
|
|
||||||
createPersonBookmark: CreatePersonBookmark,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<PersonBookmarkResponse>>;
|
|
||||||
public bookmarkPerson(
|
|
||||||
personId: string,
|
|
||||||
createPersonBookmark: CreatePersonBookmark,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
if (personId === null || personId === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Required parameter personId was null or undefined when calling bookmarkPerson.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (createPersonBookmark === null || createPersonBookmark === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Required parameter createPersonBookmark was null or undefined when calling bookmarkPerson.',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Bookmark Person
|
||||||
|
* @endpoint put /api/bookmarks/persons/{person_id}
|
||||||
|
* @param personId
|
||||||
|
* @param createPersonBookmark
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PersonBookmarkResponse>;
|
||||||
|
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PersonBookmarkResponse>>;
|
||||||
|
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PersonBookmarkResponse>>;
|
||||||
|
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (personId === null || personId === undefined) {
|
||||||
|
throw new Error('Required parameter personId was null or undefined when calling bookmarkPerson.');
|
||||||
|
}
|
||||||
|
if (createPersonBookmark === null || createPersonBookmark === undefined) {
|
||||||
|
throw new Error('Required parameter createPersonBookmark was null or undefined when calling bookmarkPerson.');
|
||||||
|
}
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
let localVarHeaders = this.defaultHeaders;
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
|
||||||
'HTTPBearer',
|
|
||||||
'Authorization',
|
|
||||||
localVarHeaders,
|
|
||||||
'Bearer ',
|
|
||||||
);
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
// authentication (HTTPBearer) required
|
||||||
options?.httpHeaderAccept ??
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
localVarHeaders = localVarHeaders.set(
|
'application/json'
|
||||||
'Accept',
|
]);
|
||||||
localVarHttpHeaderAcceptSelected,
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
const consumes: string[] = [
|
||||||
|
'application/json'
|
||||||
|
];
|
||||||
|
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||||
|
if (httpContentTypeSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/bookmarks/persons/${this.configuration.encodeParam({name: "personId", value: personId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<PersonBookmarkResponse>('put', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
body: createPersonBookmark,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
/**
|
||||||
options?.context ?? new HttpContext();
|
* List Person Bookmarks
|
||||||
|
* @endpoint get /api/bookmarks/persons
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public listPersonBookmarks(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<PersonBookmarkResponse>>;
|
||||||
|
public listPersonBookmarks(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<PersonBookmarkResponse>>>;
|
||||||
|
public listPersonBookmarks(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<PersonBookmarkResponse>>>;
|
||||||
|
public listPersonBookmarks(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// authentication (HTTPBearer) required
|
||||||
const consumes: string[] = ['application/json'];
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
const httpContentTypeSelected: string | undefined =
|
|
||||||
this.configuration.selectHeaderContentType(consumes);
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (httpContentTypeSelected !== undefined) {
|
'application/json'
|
||||||
localVarHeaders = localVarHeaders.set(
|
]);
|
||||||
'Content-Type',
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
httpContentTypeSelected,
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
);
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/bookmarks/persons`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<Array<PersonBookmarkResponse>>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
/**
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
* Remove Person Bookmark
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
* @endpoint delete /api/bookmarks/persons/{person_id}
|
||||||
responseType_ = 'text';
|
* @param personId
|
||||||
} else if (
|
* @param secureFgpAcc
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
) {
|
* @param reportProgress flag to report request and response progress.
|
||||||
responseType_ = 'json';
|
*/
|
||||||
} else {
|
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
||||||
responseType_ = 'blob';
|
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
||||||
}
|
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
||||||
|
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (personId === null || personId === undefined) {
|
||||||
|
throw new Error('Required parameter personId was null or undefined when calling removePersonBookmark.');
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/bookmarks/persons/${this.configuration.encodeParam({name: "personId", value: personId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<any>('delete', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarPath = `/api/bookmarks/persons/${this.configuration.encodeParam({ name: 'personId', value: personId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<PersonBookmarkResponse>(
|
|
||||||
'put',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
body: createPersonBookmark,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List Person Bookmarks
|
|
||||||
* @endpoint get /api/bookmarks/persons
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public listPersonBookmarks(
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<Array<PersonBookmarkResponse>>;
|
|
||||||
public listPersonBookmarks(
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<Array<PersonBookmarkResponse>>>;
|
|
||||||
public listPersonBookmarks(
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<Array<PersonBookmarkResponse>>>;
|
|
||||||
public listPersonBookmarks(
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
|
||||||
'HTTPBearer',
|
|
||||||
'Authorization',
|
|
||||||
localVarHeaders,
|
|
||||||
'Bearer ',
|
|
||||||
);
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
|
||||||
options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/bookmarks/persons`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Array<PersonBookmarkResponse>>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove Person Bookmark
|
|
||||||
* @endpoint delete /api/bookmarks/persons/{person_id}
|
|
||||||
* @param personId
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public removePersonBookmark(
|
|
||||||
personId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any>;
|
|
||||||
public removePersonBookmark(
|
|
||||||
personId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<any>>;
|
|
||||||
public removePersonBookmark(
|
|
||||||
personId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<any>>;
|
|
||||||
public removePersonBookmark(
|
|
||||||
personId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
if (personId === null || personId === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Required parameter personId was null or undefined when calling removePersonBookmark.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
|
||||||
'HTTPBearer',
|
|
||||||
'Authorization',
|
|
||||||
localVarHeaders,
|
|
||||||
'Bearer ',
|
|
||||||
);
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
|
||||||
options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/bookmarks/persons/${this.configuration.encodeParam({ name: 'personId', value: personId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<any>(
|
|
||||||
'delete',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,18 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import {
|
import { HttpClient, HttpHeaders, HttpParams,
|
||||||
HttpClient,
|
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||||
HttpHeaders,
|
} from '@angular/common/http';
|
||||||
HttpParams,
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
HttpResponse,
|
import { Observable } from 'rxjs';
|
||||||
HttpEvent,
|
|
||||||
HttpParameterCodec,
|
|
||||||
HttpContext,
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { CompanyConnectionsAvailability } from '../model/companyConnectionsAvailability';
|
import { CompanyConnectionsAvailability } from '../model/companyConnectionsAvailability';
|
||||||
@@ -30,249 +24,137 @@ import { CompanyConnectionsResponse } from '../model/companyConnectionsResponse'
|
|||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class CompanyConnectionsService extends BaseService {
|
export class CompanyConnectionsService extends BaseService {
|
||||||
constructor(
|
|
||||||
protected httpClient: HttpClient,
|
|
||||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
|
||||||
@Optional() configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
* Check whether company connections are available for an author.
|
super(basePath, configuration);
|
||||||
* @endpoint get /api/inse-service/authors/{author_id}/company-connections/availability
|
|
||||||
* @param authorId
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getCompanyConnectionsAvailability(
|
|
||||||
authorId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<CompanyConnectionsAvailability>;
|
|
||||||
public getCompanyConnectionsAvailability(
|
|
||||||
authorId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<CompanyConnectionsAvailability>>;
|
|
||||||
public getCompanyConnectionsAvailability(
|
|
||||||
authorId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<CompanyConnectionsAvailability>>;
|
|
||||||
public getCompanyConnectionsAvailability(
|
|
||||||
authorId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
if (authorId === null || authorId === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Required parameter authorId was null or undefined when calling getCompanyConnectionsAvailability.',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Check whether company connections are available for an author.
|
||||||
|
* @endpoint get /api/inse-service/authors/{author_id}/company-connections/availability
|
||||||
|
* @param authorId
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getCompanyConnectionsAvailability(authorId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CompanyConnectionsAvailability>;
|
||||||
|
public getCompanyConnectionsAvailability(authorId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CompanyConnectionsAvailability>>;
|
||||||
|
public getCompanyConnectionsAvailability(authorId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CompanyConnectionsAvailability>>;
|
||||||
|
public getCompanyConnectionsAvailability(authorId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (authorId === null || authorId === undefined) {
|
||||||
|
throw new Error('Required parameter authorId was null or undefined when calling getCompanyConnectionsAvailability.');
|
||||||
|
}
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
let localVarHeaders = this.defaultHeaders;
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
|
||||||
'HTTPBearer',
|
|
||||||
'Authorization',
|
|
||||||
localVarHeaders,
|
|
||||||
'Bearer ',
|
|
||||||
);
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
// authentication (HTTPBearer) required
|
||||||
options?.httpHeaderAccept ??
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
localVarHeaders = localVarHeaders.set(
|
'application/json'
|
||||||
'Accept',
|
]);
|
||||||
localVarHttpHeaderAcceptSelected,
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/company-connections/availability`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<CompanyConnectionsAvailability>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
/**
|
||||||
options?.context ?? new HttpContext();
|
* Get possible company connections by OpenAlex author ID.
|
||||||
|
* @endpoint get /api/inse-service/authors/{author_id}/company-connections
|
||||||
|
* @param authorId
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getCompanyConnectionsByAuthor(authorId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CompanyConnectionsResponse>;
|
||||||
|
public getCompanyConnectionsByAuthor(authorId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CompanyConnectionsResponse>>;
|
||||||
|
public getCompanyConnectionsByAuthor(authorId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CompanyConnectionsResponse>>;
|
||||||
|
public getCompanyConnectionsByAuthor(authorId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (authorId === null || authorId === undefined) {
|
||||||
|
throw new Error('Required parameter authorId was null or undefined when calling getCompanyConnectionsByAuthor.');
|
||||||
|
}
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
// authentication (HTTPBearer) required
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
} else if (
|
'application/json'
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
]);
|
||||||
) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
responseType_ = 'json';
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
} else {
|
}
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/company-connections`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<CompanyConnectionsResponse>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/company-connections/availability`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<CompanyConnectionsAvailability>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get possible company connections by OpenAlex author ID.
|
|
||||||
* @endpoint get /api/inse-service/authors/{author_id}/company-connections
|
|
||||||
* @param authorId
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getCompanyConnectionsByAuthor(
|
|
||||||
authorId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<CompanyConnectionsResponse>;
|
|
||||||
public getCompanyConnectionsByAuthor(
|
|
||||||
authorId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<CompanyConnectionsResponse>>;
|
|
||||||
public getCompanyConnectionsByAuthor(
|
|
||||||
authorId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<CompanyConnectionsResponse>>;
|
|
||||||
public getCompanyConnectionsByAuthor(
|
|
||||||
authorId: string,
|
|
||||||
secureFgpAcc?: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
if (authorId === null || authorId === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Required parameter authorId was null or undefined when calling getCompanyConnectionsByAuthor.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
|
||||||
'HTTPBearer',
|
|
||||||
'Authorization',
|
|
||||||
localVarHeaders,
|
|
||||||
'Bearer ',
|
|
||||||
);
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
|
||||||
options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/company-connections`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<CompanyConnectionsResponse>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,18 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import {
|
import { HttpClient, HttpHeaders, HttpParams,
|
||||||
HttpClient,
|
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||||
HttpHeaders,
|
} from '@angular/common/http';
|
||||||
HttpParams,
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
HttpResponse,
|
import { Observable } from 'rxjs';
|
||||||
HttpEvent,
|
|
||||||
HttpParameterCodec,
|
|
||||||
HttpContext,
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { DfgInstitutionSummaryPage } from '../model/dfgInstitutionSummaryPage';
|
import { DfgInstitutionSummaryPage } from '../model/dfgInstitutionSummaryPage';
|
||||||
@@ -28,231 +22,137 @@ import { DfgInstitutionSummaryPage } from '../model/dfgInstitutionSummaryPage';
|
|||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class DFGInstitutionsService extends BaseService {
|
export class DFGInstitutionsService extends BaseService {
|
||||||
constructor(
|
|
||||||
protected httpClient: HttpClient,
|
|
||||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
|
||||||
@Optional() configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
* Returns a list of institutions based on a search term for autocomplete functionality.
|
super(basePath, configuration);
|
||||||
* @endpoint get /api/dfg/institutions/autocomplete/selector
|
|
||||||
* @param query A search term to filter institutions by (partial matches allowed).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getDfgInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<DfgInstitutionSummaryPage>;
|
|
||||||
public getDfgInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<DfgInstitutionSummaryPage>>;
|
|
||||||
public getDfgInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<DfgInstitutionSummaryPage>>;
|
|
||||||
public getDfgInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>query,
|
|
||||||
'query',
|
|
||||||
);
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
/**
|
||||||
options?.context ?? new HttpContext();
|
* Returns a list of institutions based on a search term for autocomplete functionality.
|
||||||
|
* @endpoint get /api/dfg/institutions/autocomplete/selector
|
||||||
|
* @param query A search term to filter institutions by (partial matches allowed).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getDfgInstitutionAutocompleteForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgInstitutionSummaryPage>;
|
||||||
|
public getDfgInstitutionAutocompleteForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgInstitutionSummaryPage>>;
|
||||||
|
public getDfgInstitutionAutocompleteForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgInstitutionSummaryPage>>;
|
||||||
|
public getDfgInstitutionAutocompleteForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>query, 'query');
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let localVarHeaders = this.defaultHeaders;
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/dfg/institutions/autocomplete/selector`;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
const { basePath, withCredentials } = this.configuration;
|
'application/json'
|
||||||
return this.httpClient.request<DfgInstitutionSummaryPage>(
|
]);
|
||||||
'get',
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
`${basePath}${localVarPath}`,
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
{
|
}
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
* Returns a list of institutions based on their IDs.
|
|
||||||
* @endpoint get /api/dfg/institutions/ids
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
* @param institutionIds A list of institution IDs to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
*/
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
public getDfgInstitutionsByIds(
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
institutionIds?: Array<string>,
|
responseType_ = 'text';
|
||||||
observe?: 'body',
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
reportProgress?: boolean,
|
responseType_ = 'json';
|
||||||
options?: {
|
} else {
|
||||||
httpHeaderAccept?: 'application/json';
|
responseType_ = 'blob';
|
||||||
context?: HttpContext;
|
}
|
||||||
transferCache?: boolean;
|
}
|
||||||
},
|
|
||||||
): Observable<DfgInstitutionSummaryPage>;
|
let localVarPath = `/api/dfg/institutions/autocomplete/selector`;
|
||||||
public getDfgInstitutionsByIds(
|
const { basePath, withCredentials } = this.configuration;
|
||||||
institutionIds?: Array<string>,
|
return this.httpClient.request<DfgInstitutionSummaryPage>('get', `${basePath}${localVarPath}`,
|
||||||
observe?: 'response',
|
{
|
||||||
reportProgress?: boolean,
|
context: localVarHttpContext,
|
||||||
options?: {
|
params: localVarQueryParameters,
|
||||||
httpHeaderAccept?: 'application/json';
|
responseType: <any>responseType_,
|
||||||
context?: HttpContext;
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
transferCache?: boolean;
|
headers: localVarHeaders,
|
||||||
},
|
observe: observe,
|
||||||
): Observable<HttpResponse<DfgInstitutionSummaryPage>>;
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
public getDfgInstitutionsByIds(
|
reportProgress: reportProgress
|
||||||
institutionIds?: Array<string>,
|
}
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<DfgInstitutionSummaryPage>>;
|
|
||||||
public getDfgInstitutionsByIds(
|
|
||||||
institutionIds?: Array<string>,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
if (institutionIds) {
|
|
||||||
institutionIds.forEach((element) => {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>element,
|
|
||||||
'institution_ids',
|
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Returns a list of institutions based on their IDs.
|
||||||
|
* @endpoint get /api/dfg/institutions/ids
|
||||||
|
* @param institutionIds A list of institution IDs to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgInstitutionSummaryPage>;
|
||||||
|
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgInstitutionSummaryPage>>;
|
||||||
|
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgInstitutionSummaryPage>>;
|
||||||
|
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
options?.httpHeaderAccept ??
|
if (institutionIds) {
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
institutionIds.forEach((element) => {
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarHeaders = localVarHeaders.set(
|
<any>element, 'institution_ids');
|
||||||
'Accept',
|
})
|
||||||
localVarHttpHeaderAcceptSelected,
|
}
|
||||||
);
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/dfg/institutions/ids`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<DfgInstitutionSummaryPage>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
|
||||||
options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/dfg/institutions/ids`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<DfgInstitutionSummaryPage>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,18 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import {
|
import { HttpClient, HttpHeaders, HttpParams,
|
||||||
HttpClient,
|
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||||
HttpHeaders,
|
} from '@angular/common/http';
|
||||||
HttpParams,
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
HttpResponse,
|
import { Observable } from 'rxjs';
|
||||||
HttpEvent,
|
|
||||||
HttpParameterCodec,
|
|
||||||
HttpContext,
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { DfgPersonSummaryPage } from '../model/dfgPersonSummaryPage';
|
import { DfgPersonSummaryPage } from '../model/dfgPersonSummaryPage';
|
||||||
@@ -28,231 +22,137 @@ import { DfgPersonSummaryPage } from '../model/dfgPersonSummaryPage';
|
|||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class DFGPersonsService extends BaseService {
|
export class DFGPersonsService extends BaseService {
|
||||||
constructor(
|
|
||||||
protected httpClient: HttpClient,
|
|
||||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
|
||||||
@Optional() configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
* Returns a list of persons based on a search term for autocomplete functionality.
|
super(basePath, configuration);
|
||||||
* @endpoint get /api/dfg/persons/autocomplete/selector
|
|
||||||
* @param query A search term to filter persons by (partial matches allowed).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getDfgPersonAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<DfgPersonSummaryPage>;
|
|
||||||
public getDfgPersonAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<DfgPersonSummaryPage>>;
|
|
||||||
public getDfgPersonAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<DfgPersonSummaryPage>>;
|
|
||||||
public getDfgPersonAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>query,
|
|
||||||
'query',
|
|
||||||
);
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
/**
|
||||||
options?.context ?? new HttpContext();
|
* Returns a list of persons based on a search term for autocomplete functionality.
|
||||||
|
* @endpoint get /api/dfg/persons/autocomplete/selector
|
||||||
|
* @param query A search term to filter persons by (partial matches allowed).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getDfgPersonAutocompleteForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgPersonSummaryPage>;
|
||||||
|
public getDfgPersonAutocompleteForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgPersonSummaryPage>>;
|
||||||
|
public getDfgPersonAutocompleteForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgPersonSummaryPage>>;
|
||||||
|
public getDfgPersonAutocompleteForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>query, 'query');
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let localVarHeaders = this.defaultHeaders;
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/dfg/persons/autocomplete/selector`;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
const { basePath, withCredentials } = this.configuration;
|
'application/json'
|
||||||
return this.httpClient.request<DfgPersonSummaryPage>(
|
]);
|
||||||
'get',
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
`${basePath}${localVarPath}`,
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
{
|
}
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
* Returns a list of persons based on their IDs.
|
|
||||||
* @endpoint get /api/dfg/persons/ids
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
* @param personIds A list of person IDs to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
*/
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
public getDfgPersonsByIds(
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
personIds?: Array<string>,
|
responseType_ = 'text';
|
||||||
observe?: 'body',
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
reportProgress?: boolean,
|
responseType_ = 'json';
|
||||||
options?: {
|
} else {
|
||||||
httpHeaderAccept?: 'application/json';
|
responseType_ = 'blob';
|
||||||
context?: HttpContext;
|
}
|
||||||
transferCache?: boolean;
|
}
|
||||||
},
|
|
||||||
): Observable<DfgPersonSummaryPage>;
|
let localVarPath = `/api/dfg/persons/autocomplete/selector`;
|
||||||
public getDfgPersonsByIds(
|
const { basePath, withCredentials } = this.configuration;
|
||||||
personIds?: Array<string>,
|
return this.httpClient.request<DfgPersonSummaryPage>('get', `${basePath}${localVarPath}`,
|
||||||
observe?: 'response',
|
{
|
||||||
reportProgress?: boolean,
|
context: localVarHttpContext,
|
||||||
options?: {
|
params: localVarQueryParameters,
|
||||||
httpHeaderAccept?: 'application/json';
|
responseType: <any>responseType_,
|
||||||
context?: HttpContext;
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
transferCache?: boolean;
|
headers: localVarHeaders,
|
||||||
},
|
observe: observe,
|
||||||
): Observable<HttpResponse<DfgPersonSummaryPage>>;
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
public getDfgPersonsByIds(
|
reportProgress: reportProgress
|
||||||
personIds?: Array<string>,
|
}
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<DfgPersonSummaryPage>>;
|
|
||||||
public getDfgPersonsByIds(
|
|
||||||
personIds?: Array<string>,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
if (personIds) {
|
|
||||||
personIds.forEach((element) => {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>element,
|
|
||||||
'person_ids',
|
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Returns a list of persons based on their IDs.
|
||||||
|
* @endpoint get /api/dfg/persons/ids
|
||||||
|
* @param personIds A list of person IDs to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getDfgPersonsByIds(personIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgPersonSummaryPage>;
|
||||||
|
public getDfgPersonsByIds(personIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgPersonSummaryPage>>;
|
||||||
|
public getDfgPersonsByIds(personIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgPersonSummaryPage>>;
|
||||||
|
public getDfgPersonsByIds(personIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
options?.httpHeaderAccept ??
|
if (personIds) {
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
personIds.forEach((element) => {
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarHeaders = localVarHeaders.set(
|
<any>element, 'person_ids');
|
||||||
'Accept',
|
})
|
||||||
localVarHttpHeaderAcceptSelected,
|
}
|
||||||
);
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/dfg/persons/ids`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<DfgPersonSummaryPage>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
|
||||||
options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/dfg/persons/ids`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<DfgPersonSummaryPage>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,18 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import {
|
import { HttpClient, HttpHeaders, HttpParams,
|
||||||
HttpClient,
|
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||||
HttpHeaders,
|
} from '@angular/common/http';
|
||||||
HttpParams,
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
HttpResponse,
|
import { Observable } from 'rxjs';
|
||||||
HttpEvent,
|
|
||||||
HttpParameterCodec,
|
|
||||||
HttpContext,
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
@@ -30,333 +24,192 @@ import { Institution } from '../model/institution';
|
|||||||
import { InstitutionPageV2 } from '../model/institutionPageV2';
|
import { InstitutionPageV2 } from '../model/institutionPageV2';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class InstitutionsV2Service extends BaseService {
|
export class InstitutionsV2Service extends BaseService {
|
||||||
constructor(
|
|
||||||
protected httpClient: HttpClient,
|
|
||||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
|
||||||
@Optional() configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
* Returns a list of institutions based on a search term for autocomplete functionality.
|
super(basePath, configuration);
|
||||||
* @endpoint get /api/institutions/v2/autocomplete/selector
|
|
||||||
* @param query A search term to filter institutions by (partial matches allowed).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<InstitutionPageV2>;
|
|
||||||
public getInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<InstitutionPageV2>>;
|
|
||||||
public getInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<InstitutionPageV2>>;
|
|
||||||
public getInstitutionAutocompleteForSelector(
|
|
||||||
query?: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>query,
|
|
||||||
'query',
|
|
||||||
);
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
/**
|
||||||
options?.context ?? new HttpContext();
|
* Returns a list of institutions based on a search term for autocomplete functionality.
|
||||||
|
* @endpoint get /api/institutions/v2/autocomplete/selector
|
||||||
|
* @param query A search term to filter institutions by (partial matches allowed).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getInstitutionAutocompleteForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionPageV2>;
|
||||||
|
public getInstitutionAutocompleteForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionPageV2>>;
|
||||||
|
public getInstitutionAutocompleteForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionPageV2>>;
|
||||||
|
public getInstitutionAutocompleteForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>query, 'query');
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let localVarHeaders = this.defaultHeaders;
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (
|
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
|
||||||
) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/institutions/v2/autocomplete/selector`;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
const { basePath, withCredentials } = this.configuration;
|
'application/json'
|
||||||
return this.httpClient.request<InstitutionPageV2>(
|
]);
|
||||||
'get',
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
`${basePath}${localVarPath}`,
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
{
|
}
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
* Returns an institution based on its ID.
|
|
||||||
* @endpoint get /api/institutions/v2/single/{institution_id}
|
|
||||||
* @param institutionId The ID of the institution to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getInstitutionById2(
|
|
||||||
institutionId: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<Institution>;
|
|
||||||
public getInstitutionById2(
|
|
||||||
institutionId: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<Institution>>;
|
|
||||||
public getInstitutionById2(
|
|
||||||
institutionId: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<Institution>>;
|
|
||||||
public getInstitutionById2(
|
|
||||||
institutionId: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
if (institutionId === null || institutionId === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Required parameter institutionId was null or undefined when calling getInstitutionById2.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set(
|
|
||||||
'Accept',
|
|
||||||
localVarHttpHeaderAcceptSelected,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
options?.context ?? new HttpContext();
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarPath = `/api/institutions/v2/autocomplete/selector`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
return this.httpClient.request<InstitutionPageV2>('get', `${basePath}${localVarPath}`,
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
{
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
context: localVarHttpContext,
|
||||||
responseType_ = 'text';
|
params: localVarQueryParameters,
|
||||||
} else if (
|
responseType: <any>responseType_,
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
) {
|
headers: localVarHeaders,
|
||||||
responseType_ = 'json';
|
observe: observe,
|
||||||
} else {
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
responseType_ = 'blob';
|
reportProgress: reportProgress
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/institutions/v2/single/${this.configuration.encodeParam({ name: 'institutionId', value: institutionId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Institution>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of institutions based on their IDs.
|
|
||||||
* @endpoint get /api/institutions/v2/multiple/ids
|
|
||||||
* @param institutionIds A list of institution IDs to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getInstitutionsByIds(
|
|
||||||
institutionIds?: Array<string>,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<InstitutionPageV2>;
|
|
||||||
public getInstitutionsByIds(
|
|
||||||
institutionIds?: Array<string>,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpResponse<InstitutionPageV2>>;
|
|
||||||
public getInstitutionsByIds(
|
|
||||||
institutionIds?: Array<string>,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<HttpEvent<InstitutionPageV2>>;
|
|
||||||
public getInstitutionsByIds(
|
|
||||||
institutionIds?: Array<string>,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false,
|
|
||||||
options?: {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
},
|
|
||||||
): Observable<any> {
|
|
||||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
||||||
if (institutionIds) {
|
|
||||||
institutionIds.forEach((element) => {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(
|
|
||||||
localVarQueryParameters,
|
|
||||||
<any>element,
|
|
||||||
'institution_ids',
|
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Returns an institution based on its ID.
|
||||||
|
* @endpoint get /api/institutions/v2/single/{institution_id}
|
||||||
|
* @param institutionId The ID of the institution to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getInstitutionById2(institutionId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Institution>;
|
||||||
|
public getInstitutionById2(institutionId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Institution>>;
|
||||||
|
public getInstitutionById2(institutionId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Institution>>;
|
||||||
|
public getInstitutionById2(institutionId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (institutionId === null || institutionId === undefined) {
|
||||||
|
throw new Error('Required parameter institutionId was null or undefined when calling getInstitutionById2.');
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
let localVarHeaders = this.defaultHeaders;
|
||||||
options?.httpHeaderAccept ??
|
|
||||||
this.configuration.selectHeaderAccept(['application/json']);
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'application/json'
|
||||||
localVarHeaders = localVarHeaders.set(
|
]);
|
||||||
'Accept',
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHttpHeaderAcceptSelected,
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
);
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/institutions/v2/single/${this.configuration.encodeParam({name: "institutionId", value: institutionId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<Institution>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext =
|
/**
|
||||||
options?.context ?? new HttpContext();
|
* Returns a list of institutions based on their IDs.
|
||||||
|
* @endpoint get /api/institutions/v2/multiple/ids
|
||||||
|
* @param institutionIds A list of institution IDs to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getInstitutionsByIds(institutionIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionPageV2>;
|
||||||
|
public getInstitutionsByIds(institutionIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionPageV2>>;
|
||||||
|
public getInstitutionsByIds(institutionIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionPageV2>>;
|
||||||
|
public getInstitutionsByIds(institutionIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
if (institutionIds) {
|
||||||
|
institutionIds.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>element, 'institution_ids');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let localVarHeaders = this.defaultHeaders;
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
responseType_ = 'text';
|
'application/json'
|
||||||
} else if (
|
]);
|
||||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
) {
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
responseType_ = 'json';
|
}
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
}
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/institutions/v2/multiple/ids`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<InstitutionPageV2>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarPath = `/api/institutions/v2/multiple/ids`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<InstitutionPageV2>(
|
|
||||||
'get',
|
|
||||||
`${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined
|
|
||||||
? { transferCache: localVarTransferCache }
|
|
||||||
: {}),
|
|
||||||
reportProgress: reportProgress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,579 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
|
import { HttpClient, HttpHeaders, HttpParams,
|
||||||
|
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
import { CareerBucket } from '../model/careerBucket';
|
||||||
|
// @ts-ignore
|
||||||
|
import { EgoNetwork } from '../model/egoNetwork';
|
||||||
|
// @ts-ignore
|
||||||
|
import { FounderCandidatePage } from '../model/founderCandidatePage';
|
||||||
|
// @ts-ignore
|
||||||
|
import { FounderModelInfo } from '../model/founderModelInfo';
|
||||||
|
// @ts-ignore
|
||||||
|
import { FounderSortBy } from '../model/founderSortBy';
|
||||||
|
// @ts-ignore
|
||||||
|
import { FounderStatistics } from '../model/founderStatistics';
|
||||||
|
// @ts-ignore
|
||||||
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
// @ts-ignore
|
||||||
|
import { MultiplierTag } from '../model/multiplierTag';
|
||||||
|
// @ts-ignore
|
||||||
|
import { PeerRankField } from '../model/peerRankField';
|
||||||
|
// @ts-ignore
|
||||||
|
import { ResearcherDetail } from '../model/researcherDetail';
|
||||||
|
// @ts-ignore
|
||||||
|
import { ResearcherSortBy } from '../model/researcherSortBy';
|
||||||
|
// @ts-ignore
|
||||||
|
import { ResearcherSummaryPage } from '../model/researcherSummaryPage';
|
||||||
|
// @ts-ignore
|
||||||
|
import { Showcase } from '../model/showcase';
|
||||||
|
// @ts-ignore
|
||||||
|
import { SortDirection } from '../model/sortDirection';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class MultiplicatorsService extends BaseService {
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which model produced the founder scores: performance and permutation importances. Identical for every university.
|
||||||
|
* @endpoint get /api/multiplicators/founder-model-info
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getFounderModelInfo(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<FounderModelInfo>;
|
||||||
|
public getFounderModelInfo(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<FounderModelInfo>>;
|
||||||
|
public getFounderModelInfo(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<FounderModelInfo>>;
|
||||||
|
public getFounderModelInfo(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/multiplicators/founder-model-info`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<FounderModelInfo>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Founder-potential statistics for the current user\'s university: data-quality funnel, score distributions per career stage, research-area composition and archetype overlap.
|
||||||
|
* @endpoint get /api/multiplicators/founder-statistics
|
||||||
|
* @param percentileThreshold Founder percentile (0-100) at or above which a researcher counts as shortlisted.
|
||||||
|
* @param minPublications Minimum publication count for the robust shortlist and the funnel\'s last stage.
|
||||||
|
* @param softPeerRankThreshold Sub-score (0-1) at or above which a shortlisted researcher counts as a soft archetype match.
|
||||||
|
* @param maxCareerAge Career ages above this count as implausible in the screen.
|
||||||
|
* @param taggedBand Founder percentile band used in the reverse archetype view (how many tagged people exceed it).
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getFounderStatistics(percentileThreshold?: number, minPublications?: number, softPeerRankThreshold?: number, maxCareerAge?: number, taggedBand?: number, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<FounderStatistics>;
|
||||||
|
public getFounderStatistics(percentileThreshold?: number, minPublications?: number, softPeerRankThreshold?: number, maxCareerAge?: number, taggedBand?: number, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<FounderStatistics>>;
|
||||||
|
public getFounderStatistics(percentileThreshold?: number, minPublications?: number, softPeerRankThreshold?: number, maxCareerAge?: number, taggedBand?: number, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<FounderStatistics>>;
|
||||||
|
public getFounderStatistics(percentileThreshold?: number, minPublications?: number, softPeerRankThreshold?: number, maxCareerAge?: number, taggedBand?: number, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>percentileThreshold, 'percentile_threshold');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>minPublications, 'min_publications');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>softPeerRankThreshold, 'soft_peer_rank_threshold');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>maxCareerAge, 'max_career_age');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>taggedBand, 'tagged_band');
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/multiplicators/founder-statistics`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<FounderStatistics>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full multiplier and founder-potential detail for one researcher: every raw metric next to its peer rank, so a coach can see why the person scored what they scored.
|
||||||
|
* @endpoint get /api/multiplicators/researchers/{author_id}
|
||||||
|
* @param authorId The OpenAlex author id, short form (e.g. A5087456839) or full URL.
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getMultiplicatorResearcher(authorId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<ResearcherDetail>;
|
||||||
|
public getMultiplicatorResearcher(authorId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ResearcherDetail>>;
|
||||||
|
public getMultiplicatorResearcher(authorId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ResearcherDetail>>;
|
||||||
|
public getMultiplicatorResearcher(authorId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (authorId === null || authorId === undefined) {
|
||||||
|
throw new Error('Required parameter authorId was null or undefined when calling getMultiplicatorResearcher.');
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/multiplicators/researchers/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<ResearcherDetail>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One researcher\'s ego co-author network (nodes and edges, no layout - position them client-side with a force layout).
|
||||||
|
* @endpoint get /api/multiplicators/researchers/{author_id}/network
|
||||||
|
* @param authorId The OpenAlex author id, short form (e.g. A5087456839) or full URL.
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getMultiplicatorResearcherNetwork(authorId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<EgoNetwork>;
|
||||||
|
public getMultiplicatorResearcherNetwork(authorId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<EgoNetwork>>;
|
||||||
|
public getMultiplicatorResearcherNetwork(authorId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<EgoNetwork>>;
|
||||||
|
public getMultiplicatorResearcherNetwork(authorId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (authorId === null || authorId === undefined) {
|
||||||
|
throw new Error('Required parameter authorId was null or undefined when calling getMultiplicatorResearcherNetwork.');
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/multiplicators/researchers/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/network`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<EgoNetwork>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Four representative researchers: the top bridger, mentor and amplifier, plus the best scorer who just misses the tag threshold.
|
||||||
|
* @endpoint get /api/multiplicators/showcase
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getMultiplicatorShowcase(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Showcase>;
|
||||||
|
public getMultiplicatorShowcase(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Showcase>>;
|
||||||
|
public getMultiplicatorShowcase(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Showcase>>;
|
||||||
|
public getMultiplicatorShowcase(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/multiplicators/showcase`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<Showcase>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search the current university\'s researchers by founder potential.
|
||||||
|
* @endpoint get /api/multiplicators/founders
|
||||||
|
* @param page The page number to retrieve. (0-based)
|
||||||
|
* @param size The number of researchers to retrieve per page.
|
||||||
|
* @param inPopulation Restrict to researchers the model can score (default). Pass false for the unscored, or leave unset for everyone.
|
||||||
|
* @param minExternalPercentile Minimum founder percentile (0-100, vs the external reference cohort).
|
||||||
|
* @param maxExternalPercentile Maximum founder percentile (0-100).
|
||||||
|
* @param careerBucket Career stages to include.
|
||||||
|
* @param screened true: only researchers passing the data-quality screen; false: only the rejects; unset: everyone.
|
||||||
|
* @param minPublications Minimum publication count.
|
||||||
|
* @param hasPatents Whether the researcher has at least one patent.
|
||||||
|
* @param researchArea Dimensions FOR 2-digit division codes to include (e.g. 32, 40).
|
||||||
|
* @param tags Multiplier tags to include (any-of semantics).
|
||||||
|
* @param name A name to filter by (prefix matches allowed).
|
||||||
|
* @param screenMinPublications Publication count below which the screen flags a thin profile.
|
||||||
|
* @param screenMaxCareerAge Career age above which the screen flags an implausible length.
|
||||||
|
* @param sortBy The field to sort by.
|
||||||
|
* @param sortOrder The order to sort by.
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public searchFounderCandidates(page?: number, size?: number, inPopulation?: boolean, minExternalPercentile?: number, maxExternalPercentile?: number, careerBucket?: Array<CareerBucket>, screened?: boolean, minPublications?: number, hasPatents?: boolean, researchArea?: Array<string>, tags?: Array<MultiplierTag>, name?: string, screenMinPublications?: number, screenMaxCareerAge?: number, sortBy?: FounderSortBy, sortOrder?: SortDirection, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<FounderCandidatePage>;
|
||||||
|
public searchFounderCandidates(page?: number, size?: number, inPopulation?: boolean, minExternalPercentile?: number, maxExternalPercentile?: number, careerBucket?: Array<CareerBucket>, screened?: boolean, minPublications?: number, hasPatents?: boolean, researchArea?: Array<string>, tags?: Array<MultiplierTag>, name?: string, screenMinPublications?: number, screenMaxCareerAge?: number, sortBy?: FounderSortBy, sortOrder?: SortDirection, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<FounderCandidatePage>>;
|
||||||
|
public searchFounderCandidates(page?: number, size?: number, inPopulation?: boolean, minExternalPercentile?: number, maxExternalPercentile?: number, careerBucket?: Array<CareerBucket>, screened?: boolean, minPublications?: number, hasPatents?: boolean, researchArea?: Array<string>, tags?: Array<MultiplierTag>, name?: string, screenMinPublications?: number, screenMaxCareerAge?: number, sortBy?: FounderSortBy, sortOrder?: SortDirection, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<FounderCandidatePage>>;
|
||||||
|
public searchFounderCandidates(page?: number, size?: number, inPopulation?: boolean, minExternalPercentile?: number, maxExternalPercentile?: number, careerBucket?: Array<CareerBucket>, screened?: boolean, minPublications?: number, hasPatents?: boolean, researchArea?: Array<string>, tags?: Array<MultiplierTag>, name?: string, screenMinPublications?: number, screenMaxCareerAge?: number, sortBy?: FounderSortBy, sortOrder?: SortDirection, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>page, 'page');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>size, 'size');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>inPopulation, 'in_population');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>minExternalPercentile, 'min_external_percentile');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>maxExternalPercentile, 'max_external_percentile');
|
||||||
|
if (careerBucket) {
|
||||||
|
careerBucket.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>element, 'career_bucket');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>screened, 'screened');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>minPublications, 'min_publications');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>hasPatents, 'has_patents');
|
||||||
|
if (researchArea) {
|
||||||
|
researchArea.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>element, 'research_area');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (tags) {
|
||||||
|
tags.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>element, 'tags');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>name, 'name');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>screenMinPublications, 'screen_min_publications');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>screenMaxCareerAge, 'screen_max_career_age');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>sortBy, 'sort_by');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>sortOrder, 'sort_order');
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/multiplicators/founders`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<FounderCandidatePage>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search the current university\'s researchers by multiplier archetype (bridger / mentor / amplifier).
|
||||||
|
* @endpoint get /api/multiplicators/researchers
|
||||||
|
* @param page The page number to retrieve. (0-based)
|
||||||
|
* @param size The number of researchers to retrieve per page.
|
||||||
|
* @param tags Multiplier tags to include (any-of semantics).
|
||||||
|
* @param careerBucket Career stages to include.
|
||||||
|
* @param minPeerRank Minimum sub-score (0-1, ranked against same-career-stage peers).
|
||||||
|
* @param peerRankField Which sub-score `min_peer_rank` applies to.
|
||||||
|
* @param suspiciousProfile Filter by the merged-profile flag.
|
||||||
|
* @param name A name to filter by (prefix matches allowed).
|
||||||
|
* @param sortBy The sub-score to sort by.
|
||||||
|
* @param sortOrder The order to sort by.
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public searchMultiplicatorResearchers(page?: number, size?: number, tags?: Array<MultiplierTag>, careerBucket?: Array<CareerBucket>, minPeerRank?: number, peerRankField?: PeerRankField, suspiciousProfile?: boolean, name?: string, sortBy?: ResearcherSortBy, sortOrder?: SortDirection, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<ResearcherSummaryPage>;
|
||||||
|
public searchMultiplicatorResearchers(page?: number, size?: number, tags?: Array<MultiplierTag>, careerBucket?: Array<CareerBucket>, minPeerRank?: number, peerRankField?: PeerRankField, suspiciousProfile?: boolean, name?: string, sortBy?: ResearcherSortBy, sortOrder?: SortDirection, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ResearcherSummaryPage>>;
|
||||||
|
public searchMultiplicatorResearchers(page?: number, size?: number, tags?: Array<MultiplierTag>, careerBucket?: Array<CareerBucket>, minPeerRank?: number, peerRankField?: PeerRankField, suspiciousProfile?: boolean, name?: string, sortBy?: ResearcherSortBy, sortOrder?: SortDirection, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ResearcherSummaryPage>>;
|
||||||
|
public searchMultiplicatorResearchers(page?: number, size?: number, tags?: Array<MultiplierTag>, careerBucket?: Array<CareerBucket>, minPeerRank?: number, peerRankField?: PeerRankField, suspiciousProfile?: boolean, name?: string, sortBy?: ResearcherSortBy, sortOrder?: SortDirection, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>page, 'page');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>size, 'size');
|
||||||
|
if (tags) {
|
||||||
|
tags.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>element, 'tags');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (careerBucket) {
|
||||||
|
careerBucket.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>element, 'career_bucket');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>minPeerRank, 'min_peer_rank');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>peerRankField, 'peer_rank_field');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>suspiciousProfile, 'suspicious_profile');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>name, 'name');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>sortBy, 'sort_by');
|
||||||
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
|
<any>sortOrder, 'sort_order');
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/multiplicators/researchers`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<ResearcherSummaryPage>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+716
-1540
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2251,8 +2251,8 @@ export class OrgminerService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submits a suggestion or, for managers, updates the active hierarchy.
|
* Creates or updates a hierarchy suggestion.
|
||||||
* Users submit suggestions (max. 3 per account and day); managers update the active hierarchy.
|
* Admins can create one suggestion and update it until it is reviewed.
|
||||||
* @endpoint post /api/orgminer/save-hierarchy
|
* @endpoint post /api/orgminer/save-hierarchy
|
||||||
* @param requestBody
|
* @param requestBody
|
||||||
* @param secureFgpAcc
|
* @param secureFgpAcc
|
||||||
@@ -2379,8 +2379,8 @@ export class OrgminerService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submits a suggestion or, for managers, updates the active hierarchy.
|
* Creates or updates a hierarchy suggestion.
|
||||||
* Users submit suggestions (max. 3 per account and day); managers update the active hierarchy.
|
* Admins can create one suggestion and update it until it is reviewed.
|
||||||
* @endpoint post /api/orgminer/save-hierarchy
|
* @endpoint post /api/orgminer/save-hierarchy
|
||||||
* @param requestBody
|
* @param requestBody
|
||||||
* @param secureFgpAcc
|
* @param secureFgpAcc
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+1131
-2300
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user