Compare commits
133
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdf5fabd45 | ||
|
|
db604feb37 | ||
|
|
cd0e98ec5f | ||
|
|
42685ae44f | ||
|
|
9be024bb13 | ||
|
|
87b7e207e3 | ||
|
|
8eaa9c2420 | ||
|
|
87b02ed0a4 | ||
|
|
a6d30dd897 | ||
|
|
134055b8b9 | ||
|
|
be72d28bda | ||
|
|
2bfb877e77 | ||
|
|
48e33e7fe5 | ||
|
|
f469594c17 | ||
|
|
3e115619a6 | ||
|
|
13b2fb3350 | ||
|
|
d26ddb8cb4 | ||
|
|
269c1a7a55 | ||
|
|
1c6dbb540f | ||
|
|
cf9a5df4e9 | ||
|
|
d120c62576 | ||
|
|
213edf8a5f | ||
|
|
c277fcfece | ||
|
|
8efbbf1f1a | ||
|
|
9ad6d5cd8c | ||
|
|
77540e4002 | ||
|
|
fd3ceb54aa | ||
|
|
7baeab92c2 | ||
|
|
0c526be983 | ||
|
|
53f5440d01 | ||
|
|
e86a19f800 | ||
|
|
61fd920a9f | ||
|
|
7eed7e6614 | ||
|
|
e34e1fe3d5 | ||
|
|
2418821691 | ||
|
|
058c92227a | ||
|
|
bf38147acc | ||
|
|
3f23845c89 | ||
|
|
52e70a5b24 | ||
|
|
d502431102 | ||
|
|
3533b994d0 | ||
|
|
5d22f4831a | ||
|
|
8130192a44 | ||
|
|
bda7aff447 | ||
|
|
82421c1040 | ||
|
|
0723bb5c5b | ||
|
|
e4dbe07436 | ||
|
|
19c6574945 | ||
|
|
0b750d27e7 | ||
|
|
398ea7b56c | ||
|
|
0176eea873 | ||
|
|
b0e8c86743 | ||
|
|
03a2954c72 | ||
|
|
b9d382c78a | ||
|
|
78a8e5d919 | ||
|
|
f9f6a58ad5 | ||
|
|
5cc110174a | ||
|
|
c3ec93fba1 | ||
|
|
169b825195 | ||
|
|
0a3bf72e14 | ||
|
|
eb94fc5942 | ||
|
|
e868c4a47e | ||
|
|
e1f58d6380 | ||
|
|
1cf80ae074 | ||
|
|
8261c0a52f | ||
|
|
e76bd217ac | ||
|
|
c74d0b5b87 | ||
|
|
a69f014413 | ||
|
|
cabf819e94 | ||
|
|
c243088752 | ||
|
|
1dd032a66c | ||
|
|
9f03c92bc1 | ||
|
|
86bced4940 | ||
|
|
4461b26270 | ||
|
|
19fd2ac86d | ||
|
|
e9ba874103 | ||
|
|
dfb1413b05 | ||
|
|
b5d03c84c4 | ||
|
|
ef41c0ad96 | ||
|
|
a07fadc30e | ||
|
|
4bf351cf66 | ||
|
|
f55a37867c | ||
|
|
ae42bc46ed | ||
|
|
c38355c817 | ||
|
|
0c004f0cdf | ||
|
|
16c0b399c8 | ||
|
|
3867540a4c | ||
|
|
32cab01a8b | ||
|
|
2b606b8473 | ||
|
|
e0ac41da91 | ||
|
|
86bed62ac0 | ||
|
|
1eaf8f8c8f | ||
|
|
0c3db967b0 | ||
|
|
04eb0f0185 | ||
|
|
b2d965d604 | ||
|
|
92c4edfb4f | ||
|
|
79f2aa0263 | ||
|
|
5878edc4cd | ||
|
|
f4122263dd | ||
|
|
20faff13ec | ||
|
|
73315457a6 | ||
|
|
2703f46575 | ||
|
|
261f97eee0 | ||
|
|
f4b8d0884c | ||
|
|
1ddc5c42c5 | ||
|
|
47fb41105a | ||
|
|
4394ced772 | ||
|
|
15fc57da51 | ||
|
|
3c910fa0e4 | ||
|
|
c1cba4bd4c | ||
|
|
d43c406820 | ||
|
|
398df55f50 | ||
|
|
5888a71b36 | ||
|
|
c707064dfb | ||
|
|
8e56b59122 | ||
|
|
6fa5792e5e | ||
|
|
116492baca | ||
|
|
b1fee136ce | ||
|
|
95ce3a47fc | ||
|
|
195fd2d55b | ||
|
|
5d13b07c73 | ||
|
|
d8aca8ee3e | ||
|
|
495c7d34e5 | ||
|
|
39fdb23942 | ||
|
|
0d2c7f93be | ||
|
|
7c68a5cd71 | ||
|
|
b69fe4e15c | ||
|
|
873e4bbbec | ||
|
|
f2cf83f63b | ||
|
|
512356e106 | ||
|
|
309fecf008 | ||
|
|
29c954227f | ||
|
|
1f70f9fe2d |
@@ -38,6 +38,7 @@ def add_entry(index: str, entry: dict):
|
|||||||
"news_id": entry["news_id"],
|
"news_id": entry["news_id"],
|
||||||
"relevant": int(entry["relevant"]),
|
"relevant": int(entry["relevant"]),
|
||||||
"authors": entry["authors"],
|
"authors": entry["authors"],
|
||||||
|
"keywords": entry.get("keywords", []),
|
||||||
}
|
}
|
||||||
|
|
||||||
response_data = _send_es_request("POST", endpoint, payload=document_body)
|
response_data = _send_es_request("POST", endpoint, payload=document_body)
|
||||||
@@ -47,6 +48,13 @@ def add_entry(index: str, entry: dict):
|
|||||||
|
|
||||||
return created_id
|
return created_id
|
||||||
|
|
||||||
|
def update_entry(index: str, document_id: str, partial_doc: dict):
|
||||||
|
|
||||||
|
encoded_document_id = quote(document_id, safe="")
|
||||||
|
endpoint = f"{INSE_URL}/{index}/_update/{encoded_document_id}"
|
||||||
|
|
||||||
|
return _send_es_request("POST", endpoint, payload={"doc": partial_doc})
|
||||||
|
|
||||||
def get_entry(index: str, document_id: str) -> dict:
|
def get_entry(index: str, document_id: str) -> dict:
|
||||||
|
|
||||||
encoded_document_id = quote(document_id, safe="")
|
encoded_document_id = quote(document_id, safe="")
|
||||||
@@ -104,3 +112,17 @@ def delete_all_entries(index: str):
|
|||||||
}
|
}
|
||||||
|
|
||||||
return _send_es_request("POST", endpoint, payload=payload)
|
return _send_es_request("POST", endpoint, payload=payload)
|
||||||
|
|
||||||
|
def remove_field_all(index: str, field: str):
|
||||||
|
|
||||||
|
endpoint = f"{INSE_URL}/{index}/_update_by_query"
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"query": {"exists": {"field": field}},
|
||||||
|
"script": {
|
||||||
|
"source": f"ctx._source.remove('{field}')",
|
||||||
|
"lang": "painless",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return _send_es_request("POST", endpoint, payload=payload)
|
||||||
@@ -23,6 +23,17 @@ SYSTEM_PROMPT_NAMES = ("""
|
|||||||
Gib keine Erklärungen und kein Markdown aus, nur das JSON.
|
Gib keine Erklärungen und kein Markdown aus, nur das JSON.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
SYSTEM_PROMPT_KEYWORDS = ("""
|
||||||
|
Extrahiere aus dem nachfolgenden Campus-Aktuell-Artikel der Universität Duisburg-Essen die wichtigsten Schlagwörter (Keywords).
|
||||||
|
Wähle ausschließlich Begriffe oder Phrasen, die tatsächlich im Text vorkommen. Erfinde keine Begriffe, verallgemeinere nicht und nenne keine Oberbegriffe, die nicht im Text stehen.
|
||||||
|
Übersetze keine Begriffe – verwende ausschließlich Wörter und Phrasen in der Sprache des Artikels.
|
||||||
|
Gib jedes Schlagwort in seiner Grundform an: Bei deutschen Begriffen Substantive im Nominativ Singular; bei englischen Begriffen Substantive im Singular. Verwende den Plural nur, wenn der Begriff üblicherweise im Plural gebraucht wird.
|
||||||
|
Vermeide Redundanz: Wenn zwei mögliche Schlagwörter dieselbe Wortbasis teilen (z.B. „Forschung" und „Forschungsprojekt"), nenne nur den spezifischeren Begriff.
|
||||||
|
Nenne maximal sechs prägnante Begriffe oder kurze Phrasen. Konzentriere dich auf inhaltlich zentrale Begriffe, nicht auf Personennamen oder Datumsangaben.
|
||||||
|
Antworte ausschließlich mit gültigem JSON in exakt diesem Format: {\"keywords\": [\"Schlagwort\", \"Schlagwort\"]}
|
||||||
|
Gib keine Erklärungen und kein Markdown aus, nur das JSON.
|
||||||
|
""")
|
||||||
|
|
||||||
_client = OpenAI(
|
_client = OpenAI(
|
||||||
base_url=LLM_BASE_URL,
|
base_url=LLM_BASE_URL,
|
||||||
api_key=LLM_API_KEY,
|
api_key=LLM_API_KEY,
|
||||||
@@ -62,3 +73,14 @@ def extract_names(text: str) -> list[str]:
|
|||||||
return data.get("person", [])
|
return data.get("person", [])
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def extract_keywords(text: str) -> list[str]:
|
||||||
|
result = call(SYSTEM_PROMPT_KEYWORDS, text)
|
||||||
|
if result is None:
|
||||||
|
return []
|
||||||
|
try:
|
||||||
|
import json
|
||||||
|
data = json.loads(result)
|
||||||
|
return data.get("keywords", [])
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
return []
|
||||||
|
|||||||
@@ -16,10 +16,12 @@ def sync_single_news(news_id, max_retries=3):
|
|||||||
news_text = es_client.get_entry("aktuell", news_id)["_source"]["full_content"]
|
news_text = es_client.get_entry("aktuell", news_id)["_source"]["full_content"]
|
||||||
is_news_relevant = llm_client.is_news_relevant(news_text)
|
is_news_relevant = llm_client.is_news_relevant(news_text)
|
||||||
authors = llm_client.extract_names(news_text)
|
authors = llm_client.extract_names(news_text)
|
||||||
|
keywords = llm_client.extract_keywords(news_text)
|
||||||
new_entry = {
|
new_entry = {
|
||||||
"news_id": news_id,
|
"news_id": news_id,
|
||||||
"relevant": is_news_relevant,
|
"relevant": is_news_relevant,
|
||||||
"authors": authors,
|
"authors": authors,
|
||||||
|
"keywords": keywords,
|
||||||
}
|
}
|
||||||
es_client.add_entry("aktuell_postproc", new_entry)
|
es_client.add_entry("aktuell_postproc", new_entry)
|
||||||
return True
|
return True
|
||||||
@@ -32,6 +34,25 @@ def sync_single_news(news_id, max_retries=3):
|
|||||||
print(f"Error: {news_id} - {error}")
|
print(f"Error: {news_id} - {error}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def update_keywords_single(postproc_entry, max_retries=3):
|
||||||
|
doc_id = postproc_entry["_id"]
|
||||||
|
news_id = postproc_entry["_source"]["news_id"]
|
||||||
|
attempt = 0
|
||||||
|
while attempt < max_retries:
|
||||||
|
try:
|
||||||
|
news_text = es_client.get_entry("aktuell", news_id)["_source"]["full_content"]
|
||||||
|
keywords = llm_client.extract_keywords(news_text)
|
||||||
|
es_client.update_entry("aktuell_postproc", doc_id, {"keywords": keywords})
|
||||||
|
return True
|
||||||
|
except Exception as error:
|
||||||
|
attempt += 1
|
||||||
|
print(f"Warning updating keywords for news_id {news_id} (Attempt {attempt}/{max_retries})")
|
||||||
|
if attempt < max_retries:
|
||||||
|
time.sleep(1)
|
||||||
|
else:
|
||||||
|
print(f"Error: {news_id} - {error}")
|
||||||
|
return False
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Synchronize news articles from 'aktuell' index to 'aktuell_postproc' index with relevance and author extraction using LLM.")
|
parser = argparse.ArgumentParser(description="Synchronize news articles from 'aktuell' index to 'aktuell_postproc' index with relevance and author extraction using LLM.")
|
||||||
|
|
||||||
@@ -47,6 +68,18 @@ def main():
|
|||||||
help="Sync only missing entries from 'aktuell' to 'aktuell_postproc'.",
|
help="Sync only missing entries from 'aktuell' to 'aktuell_postproc'.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--update-keywords",
|
||||||
|
action="store_true",
|
||||||
|
help="Add 'keywords' to existing 'aktuell_postproc' entries that don't have them yet (keeps relevant/authors).",
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--reset-keywords",
|
||||||
|
action="store_true",
|
||||||
|
help="Remove the 'keywords' field from all 'aktuell_postproc' entries (keeps relevant/authors). Run before re-extracting with a new prompt.",
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--stats",
|
"--stats",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
@@ -60,11 +93,22 @@ def main():
|
|||||||
help="Number of threads for --sync-delta (Default: 4).",
|
help="Number of threads for --sync-delta (Default: 4).",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--limit",
|
||||||
|
type=int,
|
||||||
|
default=None,
|
||||||
|
help="Process at most this many entries (used by --update-keywords, e.g. for a smoke test).",
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.delete_all:
|
if args.delete_all:
|
||||||
es_client.delete_all_entries("aktuell_postproc")
|
es_client.delete_all_entries("aktuell_postproc")
|
||||||
|
|
||||||
|
if args.reset_keywords:
|
||||||
|
result = es_client.remove_field_all("aktuell_postproc", "keywords")
|
||||||
|
print(f"Removed 'keywords' from {result.get('updated', 0)} entries.")
|
||||||
|
|
||||||
if args.sync_delta:
|
if args.sync_delta:
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
aktuell_ids_raw = es_client.get_all_entries("aktuell", fields=["_id"])
|
aktuell_ids_raw = es_client.get_all_entries("aktuell", fields=["_id"])
|
||||||
@@ -97,22 +141,57 @@ def main():
|
|||||||
print(f"Sync DONE: {succeeded} entries synced.")
|
print(f"Sync DONE: {succeeded} entries synced.")
|
||||||
print(f"Time taken: {end_time - start_time} seconds.")
|
print(f"Time taken: {end_time - start_time} seconds.")
|
||||||
|
|
||||||
|
if args.update_keywords:
|
||||||
|
start_time = time.time()
|
||||||
|
postproc_entries = es_client.get_all_entries("aktuell_postproc", fields=["news_id", "keywords"])
|
||||||
|
|
||||||
|
pending = [entry for entry in postproc_entries if not entry["_source"].get("keywords")]
|
||||||
|
print(f"Number of entries without keywords: {len(pending)}")
|
||||||
|
|
||||||
|
if args.limit is not None:
|
||||||
|
pending = pending[:args.limit]
|
||||||
|
|
||||||
|
total = len(pending)
|
||||||
|
print(f"Processing {total} entries.")
|
||||||
|
|
||||||
|
processed = 0
|
||||||
|
succeeded = 0
|
||||||
|
progress_lock = threading.Lock()
|
||||||
|
|
||||||
|
with ThreadPoolExecutor(max_workers=args.threads) as executor:
|
||||||
|
futures = [executor.submit(update_keywords_single, entry) for entry in pending]
|
||||||
|
for future in as_completed(futures):
|
||||||
|
was_successful = future.result()
|
||||||
|
with progress_lock:
|
||||||
|
processed += 1
|
||||||
|
if was_successful:
|
||||||
|
succeeded += 1
|
||||||
|
print(f"Update keywords: {processed} / {total}")
|
||||||
|
|
||||||
|
end_time = time.time()
|
||||||
|
print(f"Update keywords DONE: {succeeded} entries updated.")
|
||||||
|
print(f"Time taken: {end_time - start_time} seconds.")
|
||||||
|
|
||||||
if args.stats:
|
if args.stats:
|
||||||
aktuell_entries = es_client.get_all_entries("aktuell", fields=["_id"])
|
aktuell_entries = es_client.get_all_entries("aktuell", fields=["_id"])
|
||||||
print(f"Total entries in 'aktuell': {len(aktuell_entries)}")
|
print(f"Total entries in 'aktuell': {len(aktuell_entries)}")
|
||||||
|
|
||||||
postproc_entries = es_client.get_all_entries("aktuell_postproc", fields=["_id", "news_id", "relevant", "authors"])
|
postproc_entries = es_client.get_all_entries("aktuell_postproc", fields=["_id", "news_id", "relevant", "authors", "keywords"])
|
||||||
total_entries = len(postproc_entries)
|
total_entries = len(postproc_entries)
|
||||||
relevant_count = sum(1 for entry in postproc_entries if entry["_source"]["relevant"] == 1)
|
relevant_count = sum(1 for entry in postproc_entries if entry["_source"]["relevant"] == 1)
|
||||||
irrelevant_count = total_entries - relevant_count
|
irrelevant_count = total_entries - relevant_count
|
||||||
news_with_extracted_names = sum(1 for entry in postproc_entries if entry["_source"]["authors"])
|
news_with_extracted_names = sum(1 for entry in postproc_entries if entry["_source"]["authors"])
|
||||||
news_without_extracted_names = total_entries - news_with_extracted_names
|
news_without_extracted_names = total_entries - news_with_extracted_names
|
||||||
|
news_with_keywords = sum(1 for entry in postproc_entries if entry["_source"].get("keywords"))
|
||||||
|
news_without_keywords = total_entries - news_with_keywords
|
||||||
|
|
||||||
print(f"Total entries in 'aktuell_postproc': {total_entries}")
|
print(f"Total entries in 'aktuell_postproc': {total_entries}")
|
||||||
print(f"Relevant entries: {relevant_count}")
|
print(f"Relevant entries: {relevant_count}")
|
||||||
print(f"Irrelevant entries: {irrelevant_count}")
|
print(f"Irrelevant entries: {irrelevant_count}")
|
||||||
print(f"Entries with extracted names: {news_with_extracted_names}")
|
print(f"Entries with extracted names: {news_with_extracted_names}")
|
||||||
print(f"Entries without extracted names: {news_without_extracted_names}")
|
print(f"Entries without extracted names: {news_without_extracted_names}")
|
||||||
|
print(f"Entries with keywords: {news_with_keywords}")
|
||||||
|
print(f"Entries without keywords: {news_without_keywords}")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
File diff suppressed because one or more lines are too long
@@ -17,6 +17,7 @@ class AccountProfile(BaseModel):
|
|||||||
email: str
|
email: str
|
||||||
name: str
|
name: str
|
||||||
role: UserRole
|
role: UserRole
|
||||||
|
permissions: list[str] = Field(default_factory=list)
|
||||||
organization_id: uuid.UUID
|
organization_id: uuid.UUID
|
||||||
organization_name: str
|
organization_name: str
|
||||||
deleted: bool
|
deleted: bool
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from sqlmodel import Session, func, or_, select
|
|||||||
|
|
||||||
from inse.auth import service as auth_service
|
from inse.auth import service as auth_service
|
||||||
from inse.auth.model import AccessTokenMetadata, Account, Organization, UserRole
|
from inse.auth.model import AccessTokenMetadata, Account, Organization, UserRole
|
||||||
|
from inse.auth.permissions import Permission, get_permission_values, has_permission
|
||||||
|
|
||||||
from .model import (
|
from .model import (
|
||||||
AccountPage,
|
AccountPage,
|
||||||
@@ -16,8 +17,12 @@ from .model import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _is_admin(role: UserRole) -> bool:
|
def _can_read_accounts(role: UserRole) -> bool:
|
||||||
return role in {UserRole.SUPER_ADMIN, UserRole.ADMIN}
|
return has_permission(role, Permission.READ_ACCOUNTS)
|
||||||
|
|
||||||
|
|
||||||
|
def _can_manage_accounts(role: UserRole) -> bool:
|
||||||
|
return has_permission(role, Permission.MANAGE_ACCOUNTS)
|
||||||
|
|
||||||
|
|
||||||
def _role_allowed_for_editor(editor_role: UserRole, role: UserRole) -> bool:
|
def _role_allowed_for_editor(editor_role: UserRole, role: UserRole) -> bool:
|
||||||
@@ -35,6 +40,7 @@ def _account_to_profile(account: Account, token: AccessTokenMetadata) -> Account
|
|||||||
email=account.email,
|
email=account.email,
|
||||||
name=account.name,
|
name=account.name,
|
||||||
role=account.role,
|
role=account.role,
|
||||||
|
permissions=get_permission_values(token.effective_role),
|
||||||
organization_id=account.organization_id,
|
organization_id=account.organization_id,
|
||||||
organization_name=organization_name,
|
organization_name=organization_name,
|
||||||
deleted=account.deleted,
|
deleted=account.deleted,
|
||||||
@@ -109,11 +115,7 @@ def list_accounts(
|
|||||||
search: Optional[str] = None,
|
search: Optional[str] = None,
|
||||||
organization_id: Optional[uuid.UUID] = None,
|
organization_id: Optional[uuid.UUID] = None,
|
||||||
) -> AccountPage:
|
) -> AccountPage:
|
||||||
if access_token.effective_role not in {
|
if not _can_read_accounts(access_token.effective_role):
|
||||||
UserRole.SUPER_ADMIN,
|
|
||||||
UserRole.ADMIN,
|
|
||||||
UserRole.MANAGER,
|
|
||||||
}:
|
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN,
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
detail="Only managers and admins can list accounts.",
|
detail="Only managers and admins can list accounts.",
|
||||||
@@ -160,7 +162,7 @@ def create_account(
|
|||||||
access_token: AccessTokenMetadata,
|
access_token: AccessTokenMetadata,
|
||||||
payload: CreateAccountRequest,
|
payload: CreateAccountRequest,
|
||||||
) -> AccountProfile:
|
) -> AccountProfile:
|
||||||
if not _is_admin(access_token.effective_role):
|
if not _can_manage_accounts(access_token.effective_role):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN,
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
detail="Only admins can create accounts.",
|
detail="Only admins can create accounts.",
|
||||||
@@ -241,7 +243,7 @@ def update_account(
|
|||||||
_ensure_account_in_editor_scope(account, access_token)
|
_ensure_account_in_editor_scope(account, access_token)
|
||||||
|
|
||||||
is_self_update = account.id == access_token.effective_account_id
|
is_self_update = account.id == access_token.effective_account_id
|
||||||
can_admin_update = _is_admin(access_token.effective_role)
|
can_admin_update = _can_manage_accounts(access_token.effective_role)
|
||||||
|
|
||||||
if not can_admin_update and not is_self_update:
|
if not can_admin_update and not is_self_update:
|
||||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||||
@@ -314,7 +316,7 @@ def delete_account(
|
|||||||
_ensure_account_in_editor_scope(account, access_token)
|
_ensure_account_in_editor_scope(account, access_token)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
not _is_admin(access_token.effective_role)
|
not _can_manage_accounts(access_token.effective_role)
|
||||||
or account.id == access_token.effective_account_id
|
or account.id == access_token.effective_account_id
|
||||||
):
|
):
|
||||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ from enum import StrEnum
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
from sqlalchemy import UniqueConstraint
|
||||||
from sqlmodel import Field, Relationship, SQLModel
|
from sqlmodel import Field, Relationship, SQLModel
|
||||||
|
|
||||||
|
|
||||||
@@ -20,6 +21,11 @@ class TokenType(StrEnum):
|
|||||||
ACCESS_TOKEN = "ACCESS_TOKEN"
|
ACCESS_TOKEN = "ACCESS_TOKEN"
|
||||||
|
|
||||||
|
|
||||||
|
class SecretPurpose(StrEnum):
|
||||||
|
LOGIN_OTK = "LOGIN_OTK"
|
||||||
|
PASSWORD_RESET = "PASSWORD_RESET"
|
||||||
|
|
||||||
|
|
||||||
class Durable(SQLModel):
|
class Durable(SQLModel):
|
||||||
deleted: bool = Field(
|
deleted: bool = Field(
|
||||||
default=False,
|
default=False,
|
||||||
@@ -106,6 +112,9 @@ class Account(Durable, table=True):
|
|||||||
|
|
||||||
|
|
||||||
class Secret(SQLModel, table=True):
|
class Secret(SQLModel, table=True):
|
||||||
|
__table_args__ = (
|
||||||
|
UniqueConstraint("account_id", "purpose", name="uq_secret_account_purpose"),
|
||||||
|
)
|
||||||
id: uuid.UUID | None = Field(
|
id: uuid.UUID | None = Field(
|
||||||
default_factory=uuid.uuid4,
|
default_factory=uuid.uuid4,
|
||||||
primary_key=True,
|
primary_key=True,
|
||||||
@@ -113,10 +122,16 @@ class Secret(SQLModel, table=True):
|
|||||||
)
|
)
|
||||||
account_id: uuid.UUID = Field(
|
account_id: uuid.UUID = Field(
|
||||||
foreign_key="account.id",
|
foreign_key="account.id",
|
||||||
unique=True, # Ensure that each account can have only one associated secret
|
index=True,
|
||||||
nullable=False,
|
nullable=False,
|
||||||
description="The unique identifier of the account associated with this secret.",
|
description="The unique identifier of the account associated with this secret.",
|
||||||
)
|
)
|
||||||
|
purpose: SecretPurpose = Field(
|
||||||
|
default=SecretPurpose.LOGIN_OTK,
|
||||||
|
index=True,
|
||||||
|
nullable=False,
|
||||||
|
description="The purpose of the secret, such as login OTK or password reset.",
|
||||||
|
)
|
||||||
secret_value: str = Field(
|
secret_value: str = Field(
|
||||||
index=False,
|
index=False,
|
||||||
nullable=False,
|
nullable=False,
|
||||||
@@ -127,6 +142,16 @@ class Secret(SQLModel, table=True):
|
|||||||
nullable=False,
|
nullable=False,
|
||||||
description="The timestamp indicating when the secret will expire.",
|
description="The timestamp indicating when the secret will expire.",
|
||||||
)
|
)
|
||||||
|
request_count: int = Field(
|
||||||
|
default=0,
|
||||||
|
nullable=False,
|
||||||
|
description="The number of password reset requests in the current rate-limit window.",
|
||||||
|
)
|
||||||
|
request_window_started_at: datetime | None = Field(
|
||||||
|
default=None,
|
||||||
|
index=True,
|
||||||
|
description="The start timestamp of the current password reset request window.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BaseTokenData(BaseModel):
|
class BaseTokenData(BaseModel):
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
from enum import StrEnum
|
||||||
|
|
||||||
|
from fastapi import HTTPException, status
|
||||||
|
|
||||||
|
from inse.auth.model import UserRole
|
||||||
|
|
||||||
|
|
||||||
|
class Permission(StrEnum):
|
||||||
|
MANAGE_ORGANIZATIONS = "MANAGE_ORGANIZATIONS"
|
||||||
|
READ_ACCOUNTS = "READ_ACCOUNTS"
|
||||||
|
MANAGE_ACCOUNTS = "MANAGE_ACCOUNTS"
|
||||||
|
|
||||||
|
|
||||||
|
ROLE_PERMISSIONS: dict[UserRole, set[Permission]] = {
|
||||||
|
UserRole.SUPER_ADMIN: {
|
||||||
|
Permission.MANAGE_ORGANIZATIONS,
|
||||||
|
Permission.READ_ACCOUNTS,
|
||||||
|
Permission.MANAGE_ACCOUNTS,
|
||||||
|
},
|
||||||
|
UserRole.ADMIN: {
|
||||||
|
Permission.READ_ACCOUNTS,
|
||||||
|
Permission.MANAGE_ACCOUNTS,
|
||||||
|
},
|
||||||
|
UserRole.MANAGER: {
|
||||||
|
Permission.READ_ACCOUNTS,
|
||||||
|
},
|
||||||
|
UserRole.USER: set(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def has_permission(role: UserRole, permission: Permission) -> bool:
|
||||||
|
return permission in ROLE_PERMISSIONS.get(role, set())
|
||||||
|
|
||||||
|
|
||||||
|
def require_permission(role: UserRole, permission: Permission) -> None:
|
||||||
|
if not has_permission(role, permission):
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
|
detail="Missing permission.",
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_permission_values(role: UserRole) -> list[str]:
|
||||||
|
permissions = ROLE_PERMISSIONS.get(role, set())
|
||||||
|
return [permission.value for permission in permissions]
|
||||||
@@ -46,6 +46,46 @@ async def request_otk(
|
|||||||
return auth_service.request_otk(session=session, email=email, password=password)
|
return auth_service.request_otk(session=session, email=email, password=password)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post(
|
||||||
|
"/request-password-reset",
|
||||||
|
summary="Request Password Reset",
|
||||||
|
description="Request a one-time password reset link for the given email address.",
|
||||||
|
operation_id="requestPasswordReset",
|
||||||
|
responses={
|
||||||
|
status.HTTP_200_OK: {"description": "Password reset requested successfully."}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
async def request_password_reset(
|
||||||
|
session: SessionDep,
|
||||||
|
email: Annotated[str, Body(embed=True, description="User's email address")],
|
||||||
|
):
|
||||||
|
return auth_service.request_password_reset(session=session, email=email)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post(
|
||||||
|
"/reset-password",
|
||||||
|
summary="Reset Password",
|
||||||
|
description="Reset the user's password using a one-time password reset token.",
|
||||||
|
operation_id="resetPassword",
|
||||||
|
responses={status.HTTP_200_OK: {"description": "Password reset successfully."}},
|
||||||
|
)
|
||||||
|
async def reset_password(
|
||||||
|
session: SessionDep,
|
||||||
|
reset_token: Annotated[
|
||||||
|
str, Body(description="Password reset token from the reset link")
|
||||||
|
],
|
||||||
|
new_password: Annotated[
|
||||||
|
str,
|
||||||
|
Body(description="New password", min_length=8, example="NewPassword123"),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
return auth_service.reset_password(
|
||||||
|
session=session,
|
||||||
|
reset_token=reset_token,
|
||||||
|
new_password=new_password,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
@router.post(
|
||||||
"/login",
|
"/login",
|
||||||
summary="Login with One-Time Key",
|
summary="Login with One-Time Key",
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ from argon2 import PasswordHasher
|
|||||||
from argon2.exceptions import InvalidHashError, VerificationError, VerifyMismatchError
|
from argon2.exceptions import InvalidHashError, VerificationError, VerifyMismatchError
|
||||||
from fastapi import Cookie, Depends, HTTPException, Response, status
|
from fastapi import Cookie, Depends, HTTPException, Response, status
|
||||||
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
||||||
|
from sqlmodel import Session, func, select
|
||||||
|
|
||||||
|
from inse.auth.email_service import send_email
|
||||||
from inse.auth.model import (
|
from inse.auth.model import (
|
||||||
AccessResponse,
|
AccessResponse,
|
||||||
AccessToken,
|
AccessToken,
|
||||||
@@ -22,19 +25,21 @@ from inse.auth.model import (
|
|||||||
OtkResponse,
|
OtkResponse,
|
||||||
RefreshTokenMetadata,
|
RefreshTokenMetadata,
|
||||||
Secret,
|
Secret,
|
||||||
|
SecretPurpose,
|
||||||
TokenType,
|
TokenType,
|
||||||
UserRole,
|
UserRole,
|
||||||
)
|
)
|
||||||
from inse.config import get_settings
|
from inse.config import get_settings
|
||||||
from inse.database import get_session
|
from inse.database import get_session
|
||||||
from sqlmodel import Session, select, func
|
|
||||||
from inse.auth.email_service import send_email
|
|
||||||
|
|
||||||
ID_TOKEN_EXPIRATION_MINUTES = 30 * 24 * 60 # 30 days
|
ID_TOKEN_EXPIRATION_MINUTES = 30 * 24 * 60 # 30 days
|
||||||
REFRESH_TOKEN_EXPIRATION_MINUTES = 1 * 24 * 60 # 1 day
|
REFRESH_TOKEN_EXPIRATION_MINUTES = 1 * 24 * 60 # 1 day
|
||||||
ACCESS_TOKEN_EXPIRATION_MINUTES = 30 # 30 minutes
|
ACCESS_TOKEN_EXPIRATION_MINUTES = 30 # 30 minutes
|
||||||
|
|
||||||
OTK_EXPIRATION_MINUTES = 15 # 15 minutes
|
OTK_EXPIRATION_MINUTES = 15 # 15 minutes
|
||||||
|
PASSWORD_RESET_EXPIRATION_MINUTES = 5 # 5 minutes
|
||||||
|
PASSWORD_RESET_RATE_LIMIT_WINDOW_MINUTES = 5 # 5 minutes
|
||||||
|
PASSWORD_RESET_MAX_REQUESTS_PER_WINDOW = 3 # 3 minutes
|
||||||
|
|
||||||
REAL_ACCOUNT_ID_KEY = "real_account_id"
|
REAL_ACCOUNT_ID_KEY = "real_account_id"
|
||||||
EFFECTIVE_ACCOUNT_ID_KEY = "effective_account_id"
|
EFFECTIVE_ACCOUNT_ID_KEY = "effective_account_id"
|
||||||
@@ -160,7 +165,32 @@ def _verify_password(password: str, password_hash: str) -> bool:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def request_otk(session: Session, email: str, password: str) -> OtkResponse:
|
def _hash_reset_token(reset_token: str) -> str:
|
||||||
|
"""Hashes a high-entropy password reset token for storage.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
reset_token (str): The raw reset token sent to the user.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: SHA-256 hash of the reset token.
|
||||||
|
"""
|
||||||
|
return hashlib.sha256(reset_token.encode("utf-8")).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def _build_password_reset_link(reset_token: str) -> str:
|
||||||
|
"""Builds the password reset link that will be sent to the user.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
reset_token (str): The raw reset token to include in the link.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: The full password reset link.
|
||||||
|
"""
|
||||||
|
separator = "&" if "?" in settings.password_reset_url else "?"
|
||||||
|
return f"{settings.password_reset_url}{separator}token={reset_token}"
|
||||||
|
|
||||||
|
|
||||||
|
def request_otk(session: Session, email: str, password: str):
|
||||||
"""Requests a one-time key (OTK) for authentication using email and password. Validates the provided credentials and generates a one-time key if valid.
|
"""Requests a one-time key (OTK) for authentication using email and password. Validates the provided credentials and generates a one-time key if valid.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -211,7 +241,12 @@ def request_otk(session: Session, email: str, password: str) -> OtkResponse:
|
|||||||
otk_code = f"{secrets.randbelow(1_000_000):06d}"
|
otk_code = f"{secrets.randbelow(1_000_000):06d}"
|
||||||
print(otk_code)
|
print(otk_code)
|
||||||
|
|
||||||
secret = session.exec(select(Secret).where(Secret.account_id == account.id)).first()
|
secret = session.exec(
|
||||||
|
select(Secret).where(
|
||||||
|
Secret.account_id == account.id,
|
||||||
|
Secret.purpose == SecretPurpose.LOGIN_OTK,
|
||||||
|
)
|
||||||
|
).first()
|
||||||
|
|
||||||
expires_at = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(
|
expires_at = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(
|
||||||
minutes=OTK_EXPIRATION_MINUTES
|
minutes=OTK_EXPIRATION_MINUTES
|
||||||
@@ -220,6 +255,7 @@ def request_otk(session: Session, email: str, password: str) -> OtkResponse:
|
|||||||
if secret is None:
|
if secret is None:
|
||||||
secret = Secret(
|
secret = Secret(
|
||||||
account_id=account.id,
|
account_id=account.id,
|
||||||
|
purpose=SecretPurpose.LOGIN_OTK,
|
||||||
secret_value=otk_code,
|
secret_value=otk_code,
|
||||||
expires_at=expires_at,
|
expires_at=expires_at,
|
||||||
)
|
)
|
||||||
@@ -251,6 +287,210 @@ def request_otk(session: Session, email: str, password: str) -> OtkResponse:
|
|||||||
return OtkResponse(status="success", account_id=account.id)
|
return OtkResponse(status="success", account_id=account.id)
|
||||||
|
|
||||||
|
|
||||||
|
def request_password_reset(session: Session, email: str) -> Dict[str, Any]:
|
||||||
|
"""Requests a one-time password reset link for the given email address.
|
||||||
|
|
||||||
|
For security reasons, this function always returns a successful response and
|
||||||
|
does not reveal whether the email address belongs to an active account.
|
||||||
|
"""
|
||||||
|
email = email.lower().strip()
|
||||||
|
now = datetime.datetime.now(datetime.timezone.utc)
|
||||||
|
|
||||||
|
account = session.exec(
|
||||||
|
select(Account).where(
|
||||||
|
Account.email == email,
|
||||||
|
Account.deleted == False, # noqa: E712
|
||||||
|
)
|
||||||
|
).first()
|
||||||
|
|
||||||
|
if account is None or account.deleted or account.id is None:
|
||||||
|
logger.info("Password reset requested for unknown email %s", email)
|
||||||
|
return {
|
||||||
|
"status": "ok",
|
||||||
|
"reset_link_created": False,
|
||||||
|
"rate_limited": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
secret = session.exec(
|
||||||
|
select(Secret).where(
|
||||||
|
Secret.account_id == account.id,
|
||||||
|
Secret.purpose == SecretPurpose.PASSWORD_RESET,
|
||||||
|
)
|
||||||
|
).first()
|
||||||
|
|
||||||
|
if secret is not None:
|
||||||
|
if secret.request_window_started_at is not None:
|
||||||
|
window_started_at = secret.request_window_started_at
|
||||||
|
if getattr(window_started_at, "tzinfo", None) is None:
|
||||||
|
window_started_at = window_started_at.replace(
|
||||||
|
tzinfo=datetime.timezone.utc
|
||||||
|
)
|
||||||
|
|
||||||
|
window_ends_at = window_started_at + datetime.timedelta(
|
||||||
|
minutes=PASSWORD_RESET_RATE_LIMIT_WINDOW_MINUTES
|
||||||
|
)
|
||||||
|
|
||||||
|
if window_ends_at > now:
|
||||||
|
if secret.request_count >= PASSWORD_RESET_MAX_REQUESTS_PER_WINDOW:
|
||||||
|
retry_after_seconds = max(
|
||||||
|
0,
|
||||||
|
int((window_ends_at - now).total_seconds()),
|
||||||
|
)
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"Password reset request rate-limited for account %s.",
|
||||||
|
account.id,
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
"status": "ok",
|
||||||
|
"reset_link_created": False,
|
||||||
|
"rate_limited": True,
|
||||||
|
"retry_after_seconds": retry_after_seconds,
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
secret.request_count = 0
|
||||||
|
secret.request_window_started_at = now
|
||||||
|
else:
|
||||||
|
secret.request_count = 0
|
||||||
|
secret.request_window_started_at = now
|
||||||
|
|
||||||
|
reset_token = secrets.token_urlsafe(32)
|
||||||
|
reset_token_hash = _hash_reset_token(reset_token)
|
||||||
|
|
||||||
|
expires_at = now + datetime.timedelta(minutes=PASSWORD_RESET_EXPIRATION_MINUTES)
|
||||||
|
|
||||||
|
if secret is None:
|
||||||
|
secret = Secret(
|
||||||
|
account_id=account.id,
|
||||||
|
purpose=SecretPurpose.PASSWORD_RESET,
|
||||||
|
secret_value=reset_token_hash,
|
||||||
|
expires_at=expires_at,
|
||||||
|
request_count=1,
|
||||||
|
request_window_started_at=now,
|
||||||
|
)
|
||||||
|
session.add(secret)
|
||||||
|
else:
|
||||||
|
secret.secret_value = reset_token_hash
|
||||||
|
secret.expires_at = expires_at
|
||||||
|
secret.request_count += 1
|
||||||
|
|
||||||
|
if secret.request_window_started_at is None:
|
||||||
|
secret.request_window_started_at = now
|
||||||
|
|
||||||
|
session.commit()
|
||||||
|
|
||||||
|
reset_link = _build_password_reset_link(reset_token)
|
||||||
|
|
||||||
|
if settings.send_password_reset_email:
|
||||||
|
try:
|
||||||
|
send_email(
|
||||||
|
recipient=account.email,
|
||||||
|
subject="Reset your SmartGUIDE password",
|
||||||
|
body=(
|
||||||
|
"Use the following link to reset your SmartGUIDE password:\n"
|
||||||
|
f"{reset_link}\n\n"
|
||||||
|
f"This link expires in {PASSWORD_RESET_EXPIRATION_MINUTES} minutes."
|
||||||
|
),
|
||||||
|
smtp_server=settings.smtp_server,
|
||||||
|
smtp_port=settings.smtp_port,
|
||||||
|
sender=settings.smtp_sender,
|
||||||
|
username=settings.smtp_username,
|
||||||
|
password=settings.smtp_password,
|
||||||
|
use_tls=settings.smtp_use_tls,
|
||||||
|
)
|
||||||
|
logger.info("Sent password reset email for account %s", account.id)
|
||||||
|
except Exception:
|
||||||
|
if settings.environment == "dev":
|
||||||
|
logger.exception(
|
||||||
|
"Failed to send password reset email for account %s. "
|
||||||
|
"Falling back to console reset link.",
|
||||||
|
account.id,
|
||||||
|
)
|
||||||
|
logger.info(
|
||||||
|
"Password reset link for account %s: %s",
|
||||||
|
account.id,
|
||||||
|
reset_link,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
elif settings.environment == "dev":
|
||||||
|
logger.info("Password reset link for account %s: %s", account.id, reset_link)
|
||||||
|
else:
|
||||||
|
logger.info("Password reset token generated for account %s", account.id)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"status": "ok",
|
||||||
|
"reset_link_created": True,
|
||||||
|
"rate_limited": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def reset_password(
|
||||||
|
session: Session,
|
||||||
|
reset_token: str,
|
||||||
|
new_password: str,
|
||||||
|
) -> Dict[str, str]:
|
||||||
|
"""Resets an account password using a one-time password reset token.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
session (Session): The database session used to query the account and secret.
|
||||||
|
reset_token (str): The raw reset token from the password reset link.
|
||||||
|
new_password (str): The new password to store for the account.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
HTTPException: If the reset token is invalid or expired.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Dict[str, str]: A status response.
|
||||||
|
"""
|
||||||
|
now = datetime.datetime.now(datetime.timezone.utc)
|
||||||
|
reset_token_hash = _hash_reset_token(reset_token.strip())
|
||||||
|
|
||||||
|
secret = session.exec(
|
||||||
|
select(Secret).where(
|
||||||
|
Secret.purpose == SecretPurpose.PASSWORD_RESET,
|
||||||
|
Secret.secret_value == reset_token_hash,
|
||||||
|
)
|
||||||
|
).first()
|
||||||
|
|
||||||
|
if secret is None:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
|
detail="Invalid or expired password reset token",
|
||||||
|
)
|
||||||
|
|
||||||
|
secret_expires = secret.expires_at
|
||||||
|
if getattr(secret_expires, "tzinfo", None) is None:
|
||||||
|
secret_expires = secret_expires.replace(tzinfo=datetime.timezone.utc)
|
||||||
|
|
||||||
|
if secret_expires <= now:
|
||||||
|
session.delete(secret)
|
||||||
|
session.commit()
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
|
detail="Invalid or expired password reset token",
|
||||||
|
)
|
||||||
|
|
||||||
|
account = session.get(Account, secret.account_id)
|
||||||
|
|
||||||
|
if account is None or account.deleted or account.id is None:
|
||||||
|
session.delete(secret)
|
||||||
|
session.commit()
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
|
detail="Invalid or expired password reset token",
|
||||||
|
)
|
||||||
|
|
||||||
|
account.password_hash = _hash_password(new_password)
|
||||||
|
account.epoch += 1
|
||||||
|
|
||||||
|
session.add(account)
|
||||||
|
session.delete(secret)
|
||||||
|
session.commit()
|
||||||
|
|
||||||
|
return {"status": "ok"}
|
||||||
|
|
||||||
|
|
||||||
def login(
|
def login(
|
||||||
session: Session, response: Response, account_id: uuid.UUID, email_code: str
|
session: Session, response: Response, account_id: uuid.UUID, email_code: str
|
||||||
) -> LoginResponse:
|
) -> LoginResponse:
|
||||||
@@ -274,6 +514,7 @@ def login(
|
|||||||
secret = session.exec(
|
secret = session.exec(
|
||||||
select(Secret).where(
|
select(Secret).where(
|
||||||
Secret.account_id == account_id,
|
Secret.account_id == account_id,
|
||||||
|
Secret.purpose == SecretPurpose.LOGIN_OTK,
|
||||||
Secret.secret_value == email_code,
|
Secret.secret_value == email_code,
|
||||||
# Validating the code and ensuring it matches the account ID
|
# Validating the code and ensuring it matches the account ID
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from inse.auth.model import (
|
|||||||
Account,
|
Account,
|
||||||
Organization,
|
Organization,
|
||||||
Secret,
|
Secret,
|
||||||
|
SecretPurpose,
|
||||||
AccessToken,
|
AccessToken,
|
||||||
IdTokenMetadata,
|
IdTokenMetadata,
|
||||||
AccessTokenMetadata,
|
AccessTokenMetadata,
|
||||||
@@ -98,7 +99,10 @@ def test_request_otk_and_login_flow(in_memory_session, settings_backup):
|
|||||||
assert resp.account_id == acc.id
|
assert resp.account_id == acc.id
|
||||||
|
|
||||||
secret = in_memory_session.exec(
|
secret = in_memory_session.exec(
|
||||||
select(Secret).where(Secret.account_id == acc.id)
|
select(Secret).where(
|
||||||
|
Secret.account_id == acc.id,
|
||||||
|
Secret.purpose == SecretPurpose.LOGIN_OTK,
|
||||||
|
)
|
||||||
).first()
|
).first()
|
||||||
assert secret is not None
|
assert secret is not None
|
||||||
|
|
||||||
@@ -281,7 +285,12 @@ def test_login_with_expired_secret(in_memory_session, settings_backup):
|
|||||||
assert acc.id is not None
|
assert acc.id is not None
|
||||||
|
|
||||||
expired_at = _dt.datetime.now(_dt.timezone.utc) - timedelta(minutes=10)
|
expired_at = _dt.datetime.now(_dt.timezone.utc) - timedelta(minutes=10)
|
||||||
secret = Secret(account_id=acc.id, secret_value="000000", expires_at=expired_at)
|
secret = Secret(
|
||||||
|
account_id=acc.id,
|
||||||
|
purpose=SecretPurpose.LOGIN_OTK,
|
||||||
|
secret_value="000000",
|
||||||
|
expires_at=expired_at,
|
||||||
|
)
|
||||||
in_memory_session.add(secret)
|
in_memory_session.add(secret)
|
||||||
in_memory_session.commit()
|
in_memory_session.commit()
|
||||||
|
|
||||||
@@ -426,14 +435,20 @@ def test_otk_regeneration_and_reuse(in_memory_session, settings_backup):
|
|||||||
|
|
||||||
auth_service.request_otk(in_memory_session, email, password)
|
auth_service.request_otk(in_memory_session, email, password)
|
||||||
secret1 = in_memory_session.exec(
|
secret1 = in_memory_session.exec(
|
||||||
select(Secret).where(Secret.account_id == acc.id)
|
select(Secret).where(
|
||||||
|
Secret.account_id == acc.id,
|
||||||
|
Secret.purpose == SecretPurpose.LOGIN_OTK,
|
||||||
|
)
|
||||||
).first()
|
).first()
|
||||||
assert secret1 is not None
|
assert secret1 is not None
|
||||||
first_value = secret1.secret_value
|
first_value = secret1.secret_value
|
||||||
|
|
||||||
auth_service.request_otk(in_memory_session, email, password)
|
auth_service.request_otk(in_memory_session, email, password)
|
||||||
secret2 = in_memory_session.exec(
|
secret2 = in_memory_session.exec(
|
||||||
select(Secret).where(Secret.account_id == acc.id)
|
select(Secret).where(
|
||||||
|
Secret.account_id == acc.id,
|
||||||
|
Secret.purpose == SecretPurpose.LOGIN_OTK,
|
||||||
|
)
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
assert secret2 is not None
|
assert secret2 is not None
|
||||||
@@ -460,13 +475,19 @@ def test_otk_deleted_after_login(in_memory_session, settings_backup):
|
|||||||
|
|
||||||
auth_service.request_otk(in_memory_session, email, password)
|
auth_service.request_otk(in_memory_session, email, password)
|
||||||
secret = in_memory_session.exec(
|
secret = in_memory_session.exec(
|
||||||
select(Secret).where(Secret.account_id == acc.id)
|
select(Secret).where(
|
||||||
|
Secret.account_id == acc.id,
|
||||||
|
Secret.purpose == SecretPurpose.LOGIN_OTK,
|
||||||
|
)
|
||||||
).first()
|
).first()
|
||||||
assert secret is not None
|
assert secret is not None
|
||||||
|
|
||||||
auth_service.login(in_memory_session, Response(), acc.id, secret.secret_value)
|
auth_service.login(in_memory_session, Response(), acc.id, secret.secret_value)
|
||||||
post = in_memory_session.exec(
|
post = in_memory_session.exec(
|
||||||
select(Secret).where(Secret.account_id == acc.id)
|
select(Secret).where(
|
||||||
|
Secret.account_id == acc.id,
|
||||||
|
Secret.purpose == SecretPurpose.LOGIN_OTK,
|
||||||
|
)
|
||||||
).first()
|
).first()
|
||||||
assert post is None
|
assert post is None
|
||||||
|
|
||||||
@@ -551,3 +572,180 @@ def test_get_account_epoch_not_found(in_memory_session):
|
|||||||
random_id = uuid.uuid4()
|
random_id = uuid.uuid4()
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(Exception):
|
||||||
auth_service._get_account_epoch(in_memory_session, random_id)
|
auth_service._get_account_epoch(in_memory_session, random_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def test_request_password_reset_creates_secret(in_memory_session, settings_backup):
|
||||||
|
email = "reset@example.com"
|
||||||
|
password = "oldpw123"
|
||||||
|
org, acc = create_org_and_account(in_memory_session, email, password)
|
||||||
|
assert acc.id is not None
|
||||||
|
|
||||||
|
result = auth_service.request_password_reset(in_memory_session, email)
|
||||||
|
assert result["status"] == "ok"
|
||||||
|
|
||||||
|
secret = in_memory_session.exec(
|
||||||
|
select(Secret).where(
|
||||||
|
Secret.account_id == acc.id,
|
||||||
|
Secret.purpose == SecretPurpose.PASSWORD_RESET,
|
||||||
|
)
|
||||||
|
).first()
|
||||||
|
|
||||||
|
assert secret is not None
|
||||||
|
assert secret.secret_value is not None
|
||||||
|
assert secret.secret_value != ""
|
||||||
|
assert secret.secret_value != password
|
||||||
|
|
||||||
|
|
||||||
|
def test_request_password_reset_unknown_email_is_safe(
|
||||||
|
in_memory_session, settings_backup, monkeypatch
|
||||||
|
):
|
||||||
|
sent_emails = []
|
||||||
|
|
||||||
|
def fake_send_email(**kwargs):
|
||||||
|
sent_emails.append(kwargs)
|
||||||
|
|
||||||
|
monkeypatch.setattr(auth_service, "send_email", fake_send_email)
|
||||||
|
config_module.settings.send_password_reset_email = True
|
||||||
|
|
||||||
|
result = auth_service.request_password_reset(
|
||||||
|
in_memory_session, "missing@example.com"
|
||||||
|
)
|
||||||
|
|
||||||
|
assert result["status"] == "ok"
|
||||||
|
assert sent_emails == []
|
||||||
|
|
||||||
|
|
||||||
|
def test_request_password_reset_sends_email(
|
||||||
|
in_memory_session, settings_backup, monkeypatch
|
||||||
|
):
|
||||||
|
email = "mail-reset@example.com"
|
||||||
|
password = "oldpw123"
|
||||||
|
org, acc = create_org_and_account(in_memory_session, email, password)
|
||||||
|
assert acc.id is not None
|
||||||
|
|
||||||
|
sent_emails = []
|
||||||
|
|
||||||
|
def fake_send_email(**kwargs):
|
||||||
|
sent_emails.append(kwargs)
|
||||||
|
|
||||||
|
monkeypatch.setattr(auth_service, "send_email", fake_send_email)
|
||||||
|
config_module.settings.send_password_reset_email = True
|
||||||
|
config_module.settings.password_reset_url = "http://localhost/reset-password"
|
||||||
|
|
||||||
|
result = auth_service.request_password_reset(in_memory_session, email)
|
||||||
|
|
||||||
|
assert result["status"] == "ok"
|
||||||
|
assert len(sent_emails) == 1
|
||||||
|
assert sent_emails[0]["recipient"] == email
|
||||||
|
assert "token=" in sent_emails[0]["body"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_reset_password_changes_password_and_increments_epoch(in_memory_session):
|
||||||
|
email = "do-reset@example.com"
|
||||||
|
password = "oldpw123"
|
||||||
|
new_password = "NewPassword123"
|
||||||
|
org, acc = create_org_and_account(in_memory_session, email, password)
|
||||||
|
assert acc.id is not None
|
||||||
|
|
||||||
|
reset_token = "valid-reset-token"
|
||||||
|
secret = Secret(
|
||||||
|
account_id=acc.id,
|
||||||
|
purpose=SecretPurpose.PASSWORD_RESET,
|
||||||
|
secret_value=auth_service._hash_reset_token(reset_token),
|
||||||
|
expires_at=_dt.datetime.now(_dt.timezone.utc) + timedelta(minutes=5),
|
||||||
|
)
|
||||||
|
in_memory_session.add(secret)
|
||||||
|
in_memory_session.commit()
|
||||||
|
|
||||||
|
old_epoch = acc.epoch
|
||||||
|
|
||||||
|
result = auth_service.reset_password(
|
||||||
|
in_memory_session,
|
||||||
|
reset_token=reset_token,
|
||||||
|
new_password=new_password,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert result["status"] == "ok"
|
||||||
|
in_memory_session.refresh(acc)
|
||||||
|
assert auth_service._verify_password(new_password, acc.password_hash)
|
||||||
|
assert acc.epoch == old_epoch + 1
|
||||||
|
|
||||||
|
deleted_secret = in_memory_session.exec(
|
||||||
|
select(Secret).where(
|
||||||
|
Secret.account_id == acc.id,
|
||||||
|
Secret.purpose == SecretPurpose.PASSWORD_RESET,
|
||||||
|
)
|
||||||
|
).first()
|
||||||
|
assert deleted_secret is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_reset_password_rejects_reused_token(in_memory_session):
|
||||||
|
email = "reuse-reset@example.com"
|
||||||
|
password = "oldpw123"
|
||||||
|
org, acc = create_org_and_account(in_memory_session, email, password)
|
||||||
|
assert acc.id is not None
|
||||||
|
|
||||||
|
reset_token = "single-use-token"
|
||||||
|
secret = Secret(
|
||||||
|
account_id=acc.id,
|
||||||
|
purpose=SecretPurpose.PASSWORD_RESET,
|
||||||
|
secret_value=auth_service._hash_reset_token(reset_token),
|
||||||
|
expires_at=_dt.datetime.now(_dt.timezone.utc) + timedelta(minutes=5),
|
||||||
|
)
|
||||||
|
in_memory_session.add(secret)
|
||||||
|
in_memory_session.commit()
|
||||||
|
|
||||||
|
auth_service.reset_password(
|
||||||
|
in_memory_session,
|
||||||
|
reset_token=reset_token,
|
||||||
|
new_password="NewPassword123",
|
||||||
|
)
|
||||||
|
|
||||||
|
with pytest.raises(HTTPException):
|
||||||
|
auth_service.reset_password(
|
||||||
|
in_memory_session,
|
||||||
|
reset_token=reset_token,
|
||||||
|
new_password="AnotherPassword123",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_reset_password_rejects_invalid_token(in_memory_session):
|
||||||
|
with pytest.raises(HTTPException):
|
||||||
|
auth_service.reset_password(
|
||||||
|
in_memory_session,
|
||||||
|
reset_token="invalid-token",
|
||||||
|
new_password="NewPassword123",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_reset_password_rejects_expired_token(in_memory_session):
|
||||||
|
email = "expired-reset@example.com"
|
||||||
|
password = "oldpw123"
|
||||||
|
org, acc = create_org_and_account(in_memory_session, email, password)
|
||||||
|
assert acc.id is not None
|
||||||
|
|
||||||
|
reset_token = "expired-token"
|
||||||
|
secret = Secret(
|
||||||
|
account_id=acc.id,
|
||||||
|
purpose=SecretPurpose.PASSWORD_RESET,
|
||||||
|
secret_value=auth_service._hash_reset_token(reset_token),
|
||||||
|
expires_at=_dt.datetime.now(_dt.timezone.utc) - timedelta(minutes=1),
|
||||||
|
)
|
||||||
|
in_memory_session.add(secret)
|
||||||
|
in_memory_session.commit()
|
||||||
|
|
||||||
|
with pytest.raises(HTTPException):
|
||||||
|
auth_service.reset_password(
|
||||||
|
in_memory_session,
|
||||||
|
reset_token=reset_token,
|
||||||
|
new_password="NewPassword123",
|
||||||
|
)
|
||||||
|
|
||||||
|
deleted_secret = in_memory_session.exec(
|
||||||
|
select(Secret).where(
|
||||||
|
Secret.account_id == acc.id,
|
||||||
|
Secret.purpose == SecretPurpose.PASSWORD_RESET,
|
||||||
|
)
|
||||||
|
).first()
|
||||||
|
assert deleted_secret is None
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ class Settings(BaseSettings):
|
|||||||
skip_otk_validation: bool = True
|
skip_otk_validation: bool = True
|
||||||
# SMTP / email config
|
# SMTP / email config
|
||||||
send_otk_email: bool = False
|
send_otk_email: bool = False
|
||||||
|
send_password_reset_email: bool = True
|
||||||
|
password_reset_url: str = "http://localhost:4200/inse-webapp/reset-password"
|
||||||
smtp_server: str = "localhost"
|
smtp_server: str = "localhost"
|
||||||
smtp_port: int = 25
|
smtp_port: int = 25
|
||||||
smtp_sender: str = "no-reply@smartguide.local"
|
smtp_sender: str = "no-reply@smartguide.local"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from openai import OpenAI, APIConnectionError
|
|||||||
from openai import AsyncOpenAI
|
from openai import AsyncOpenAI
|
||||||
from .. import config
|
from .. import config
|
||||||
from typing import Optional, Dict, Any
|
from typing import Optional, Dict, Any
|
||||||
|
import asyncio
|
||||||
def call(
|
def call(
|
||||||
system_prompt: str,
|
system_prompt: str,
|
||||||
user_prompt: str,
|
user_prompt: str,
|
||||||
@@ -62,7 +62,7 @@ def _get_response_format(schema, schema_name: Optional[str] = None) -> Dict[str,
|
|||||||
async def call_stream(
|
async def call_stream(
|
||||||
system_prompt: str,
|
system_prompt: str,
|
||||||
user_prompt: str,
|
user_prompt: str,
|
||||||
emit, # EventCallback
|
emit,
|
||||||
model: str = None,
|
model: str = None,
|
||||||
json_schema=None,
|
json_schema=None,
|
||||||
schema_name=None,
|
schema_name=None,
|
||||||
@@ -98,15 +98,26 @@ async def call_stream(
|
|||||||
stream=True,
|
stream=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
async for chunk in stream:
|
try:
|
||||||
delta = chunk.choices[0].delta.content
|
async for chunk in stream:
|
||||||
if delta:
|
delta = chunk.choices[0].delta.content
|
||||||
full_content += delta
|
if delta:
|
||||||
await emit({"type": "llm_chunk", "content": delta})
|
full_content += delta
|
||||||
|
await emit({"type": "llm_chunk", "content": delta})
|
||||||
|
finally:
|
||||||
|
# Always release the underlying HTTP connection, whether we
|
||||||
|
# finished normally, timed out, were cancelled, or emit()
|
||||||
|
# failed because the client disconnected. This is what
|
||||||
|
# actually tells the backend to stop generating.
|
||||||
|
await stream.close()
|
||||||
|
|
||||||
except APIConnectionError as e:
|
except APIConnectionError as e:
|
||||||
print(f"Connection error: {e}")
|
print(f"Connection error: {e}")
|
||||||
return ""
|
return ""
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
# Real cancellation (e.g. asyncio.wait_for timeout, or task.cancel()
|
||||||
|
# from the router)
|
||||||
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
import traceback
|
import traceback
|
||||||
print(f"LLM streaming failed: {type(e).__name__}: {e}")
|
print(f"LLM streaming failed: {type(e).__name__}: {e}")
|
||||||
|
|||||||
@@ -126,141 +126,6 @@ async def _get_text_content(url: str) -> str:
|
|||||||
logger.error(f"Error processing {url}: {e}")
|
logger.error(f"Error processing {url}: {e}")
|
||||||
|
|
||||||
|
|
||||||
async def extract_keywords_stream(
|
|
||||||
query: str,
|
|
||||||
mode: str,
|
|
||||||
limit: int,
|
|
||||||
emit: EventCallback,
|
|
||||||
) -> ExtractedKeywordsResponse:
|
|
||||||
start_time = time.time()
|
|
||||||
timeout_seconds = 60 # configurable
|
|
||||||
await emit(KeywordsWsEvent(type="status", step="started", message="Starte Keyword-Extraktion").model_dump())
|
|
||||||
|
|
||||||
if mode == "url":
|
|
||||||
await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Extrahiere Inhalt von {query}").model_dump())
|
|
||||||
text = await _get_text_content(query)
|
|
||||||
await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extrahiert {len(text)} Zeichen").model_dump())
|
|
||||||
system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT
|
|
||||||
else:
|
|
||||||
text = query
|
|
||||||
await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Empfangen {len(text)} Zeichen").model_dump())
|
|
||||||
system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT
|
|
||||||
user_prompt = "\nNow analyze the following text and return ONLY the JSON object.\n"
|
|
||||||
if limit:
|
|
||||||
user_prompt += f"\nExtract exactly {limit} keywords for each level (broad, coarse, fine).\n"
|
|
||||||
user_prompt += f"\nInput:\n{text}"
|
|
||||||
|
|
||||||
await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extrahiere Keywords...").model_dump())
|
|
||||||
|
|
||||||
LEVELS = ("broad_keywords", "coarse_grained", "fine_grained")
|
|
||||||
|
|
||||||
# Holds only fully validated KeywordEntry dicts for each level
|
|
||||||
confirmed: Dict[str, List[Dict[str, Any]]] = {level: [] for level in LEVELS}
|
|
||||||
|
|
||||||
async def emit_full_results() -> None:
|
|
||||||
"""Attempt to build and validate the full ExtractedKeywordsLLM model and emit it."""
|
|
||||||
# Build a dict with all three fields, using empty lists for missing ones
|
|
||||||
data = {level: confirmed.get(level, []) for level in LEVELS}
|
|
||||||
try:
|
|
||||||
validated = ExtractedKeywordsLLM.model_validate(data)
|
|
||||||
except ValidationError:
|
|
||||||
# Should not happen if all items are valid, but guard against it
|
|
||||||
return
|
|
||||||
await emit(KeywordsWsEvent(type="keywords", keywords=validated.model_dump()).model_dump())
|
|
||||||
|
|
||||||
# adds completed keyword chunks to the confirmed dict and emits the full results when new valid items are found
|
|
||||||
async def on_chunk(event: Dict[str, Any]) -> None:
|
|
||||||
if event["type"] != "llm_chunk":
|
|
||||||
await emit(event)
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
partial = partial_json_parser.loads(event.get("_full_content", ""))
|
|
||||||
except Exception:
|
|
||||||
return
|
|
||||||
|
|
||||||
if not isinstance(partial, dict):
|
|
||||||
return
|
|
||||||
|
|
||||||
grew = False
|
|
||||||
|
|
||||||
for level in LEVELS:
|
|
||||||
current = partial.get(level) or []
|
|
||||||
idx = len(confirmed[level])
|
|
||||||
|
|
||||||
while idx < len(current):
|
|
||||||
raw_item = current[idx]
|
|
||||||
try:
|
|
||||||
validated_item = KeywordEntry.model_validate(raw_item)
|
|
||||||
except ValidationError:
|
|
||||||
break # item not complete yet
|
|
||||||
confirmed[level].append(validated_item.model_dump())
|
|
||||||
idx += 1
|
|
||||||
grew = True
|
|
||||||
|
|
||||||
if grew:
|
|
||||||
await emit_full_results()
|
|
||||||
|
|
||||||
# Accumulate full_content for incremental parsing
|
|
||||||
full_content_holder = {"value": ""}
|
|
||||||
|
|
||||||
async def emit_wrapper(event: Dict[str, Any]) -> None:
|
|
||||||
if event["type"] == "llm_chunk":
|
|
||||||
full_content_holder["value"] += event["content"]
|
|
||||||
event = {**event, "_full_content": full_content_holder["value"]}
|
|
||||||
await on_chunk(event)
|
|
||||||
|
|
||||||
try:
|
|
||||||
keywords = await asyncio.wait_for(
|
|
||||||
llm.call_stream(
|
|
||||||
system_prompt=system_prompt,
|
|
||||||
user_prompt=user_prompt,
|
|
||||||
json_schema=ExtractedKeywordsLLM.model_json_schema(),
|
|
||||||
schema_name="extracted_keywords",
|
|
||||||
temperature=0.8,
|
|
||||||
top_p=0.95,
|
|
||||||
emit=emit_wrapper,
|
|
||||||
),
|
|
||||||
timeout=timeout_seconds,
|
|
||||||
)
|
|
||||||
except asyncio.TimeoutError:
|
|
||||||
await emit(KeywordsWsEvent(type="error", message=f"LLM call timed out after {timeout_seconds}s").model_dump())
|
|
||||||
raise RuntimeError("LLM streaming call timed out")
|
|
||||||
except asyncio.CancelledError:
|
|
||||||
await emit(KeywordsWsEvent(type="error", message="Request cancelled").model_dump())
|
|
||||||
raise
|
|
||||||
|
|
||||||
if not keywords:
|
|
||||||
await emit(KeywordsWsEvent(type="error", message="LLM call failed or returned no content").model_dump())
|
|
||||||
raise RuntimeError("LLM streaming call returned empty content")
|
|
||||||
|
|
||||||
await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Bearbeite Ergebnisse").model_dump())
|
|
||||||
|
|
||||||
try:
|
|
||||||
keywords_json = json.loads(keywords)
|
|
||||||
except json.JSONDecodeError as e:
|
|
||||||
await emit(KeywordsWsEvent(type="error", message=f"Invalid JSON in LLM response: {e}").model_dump())
|
|
||||||
raise RuntimeError("LLM response is not valid JSON")
|
|
||||||
|
|
||||||
# Final emission of the full results (in case the last chunk didn't trigger it)
|
|
||||||
final_data = {level: confirmed.get(level, []) for level in LEVELS}
|
|
||||||
try:
|
|
||||||
final_validated = ExtractedKeywordsLLM.model_validate(keywords_json)
|
|
||||||
except ValidationError:
|
|
||||||
# Fallback: use our confirmed data
|
|
||||||
final_validated = ExtractedKeywordsLLM.model_validate(final_data)
|
|
||||||
|
|
||||||
elapsed_time = time.time() - start_time
|
|
||||||
result = ExtractedKeywordsResponse(
|
|
||||||
results=final_validated,
|
|
||||||
source=mode,
|
|
||||||
source_url=query if mode == "url" else None,
|
|
||||||
source_content=text,
|
|
||||||
duration=elapsed_time,
|
|
||||||
)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
async def extract_keywords_stream_enriched(
|
async def extract_keywords_stream_enriched(
|
||||||
query: str,
|
query: str,
|
||||||
@@ -275,7 +140,11 @@ async def extract_keywords_stream_enriched(
|
|||||||
if mode == "url":
|
if mode == "url":
|
||||||
await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Extrahiere Inhalt von {query}").model_dump())
|
await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Extrahiere Inhalt von {query}").model_dump())
|
||||||
text = await _get_text_content(query)
|
text = await _get_text_content(query)
|
||||||
await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extrahiert {len(text)} Zeichen").model_dump())
|
if text:
|
||||||
|
await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extrahiert {len(text)} Zeichen").model_dump())
|
||||||
|
else:
|
||||||
|
await emit(KeywordsWsEvent(type="error", message=f"Fehler beim Abrufen des Inhalts von {query}").model_dump())
|
||||||
|
raise RuntimeError(f"Failed to fetch content from {query}")
|
||||||
system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT
|
system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT
|
||||||
else:
|
else:
|
||||||
text = query
|
text = query
|
||||||
@@ -290,15 +159,10 @@ async def extract_keywords_stream_enriched(
|
|||||||
await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extrahiere Keywords...").model_dump())
|
await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extrahiere Keywords...").model_dump())
|
||||||
|
|
||||||
LEVELS = ("broad_keywords", "coarse_grained", "fine_grained")
|
LEVELS = ("broad_keywords", "coarse_grained", "fine_grained")
|
||||||
|
|
||||||
# Holds enriched keyword wrappers for each level
|
|
||||||
confirmed: Dict[str, List[KeywordEntryWithTopic]] = {level: [] for level in LEVELS}
|
confirmed: Dict[str, List[KeywordEntryWithTopic]] = {level: [] for level in LEVELS}
|
||||||
|
|
||||||
# Track background enrichment tasks
|
|
||||||
enrichment_tasks: List[asyncio.Task] = []
|
enrichment_tasks: List[asyncio.Task] = []
|
||||||
|
|
||||||
async def emit_full_results() -> None:
|
async def emit_full_results() -> None:
|
||||||
"""Attempt to build and emit the full enriched keyword model."""
|
|
||||||
try:
|
try:
|
||||||
validated = _build_enriched_snapshot(confirmed)
|
validated = _build_enriched_snapshot(confirmed)
|
||||||
except ValidationError:
|
except ValidationError:
|
||||||
@@ -306,29 +170,19 @@ async def extract_keywords_stream_enriched(
|
|||||||
await emit(KeywordsWsEvent(type="keywords", keywords=validated.model_dump()).model_dump())
|
await emit(KeywordsWsEvent(type="keywords", keywords=validated.model_dump()).model_dump())
|
||||||
|
|
||||||
async def get_openalex_topic(level: str, idx: int, item: KeywordEntry) -> None:
|
async def get_openalex_topic(level: str, idx: int, item: KeywordEntry) -> None:
|
||||||
"""
|
|
||||||
Fetch/enrich metadata for a single keyword.
|
|
||||||
Runs concurrently without blocking the LLM stream.
|
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
topic = await vector_search_topics_batch(
|
topic = await vector_search_topics_batch(
|
||||||
keywords=[item.keyword],
|
keywords=[item.keyword],
|
||||||
search_type="hybrid",
|
search_type="hybrid",
|
||||||
)
|
)
|
||||||
# Update the shared confirmed list in-place (safe in asyncio)
|
|
||||||
confirmed[level][idx].topic_mapping = topic.results[0] if topic.results else None
|
confirmed[level][idx].topic_mapping = topic.results[0] if topic.results else None
|
||||||
|
|
||||||
# Emit the full updated set after each enrichment so the frontend sees progress.
|
|
||||||
await emit_full_results()
|
await emit_full_results()
|
||||||
|
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
# If the whole request is cancelled, we can just re-raise
|
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error fetching OpenAlex topic for keyword '{item.keyword}': {e}")
|
logger.error(f"Error fetching OpenAlex topic for keyword '{item.keyword}': {e}")
|
||||||
await emit_full_results()
|
await emit_full_results()
|
||||||
|
|
||||||
# ---------- on_chunk: parses LLM stream and appends new keywords ----------
|
|
||||||
async def on_chunk(event: Dict[str, Any]) -> None:
|
async def on_chunk(event: Dict[str, Any]) -> None:
|
||||||
if event["type"] != "llm_chunk":
|
if event["type"] != "llm_chunk":
|
||||||
await emit(event)
|
await emit(event)
|
||||||
@@ -338,7 +192,6 @@ async def extract_keywords_stream_enriched(
|
|||||||
partial = partial_json_parser.loads(event.get("_full_content", ""))
|
partial = partial_json_parser.loads(event.get("_full_content", ""))
|
||||||
except Exception:
|
except Exception:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not isinstance(partial, dict):
|
if not isinstance(partial, dict):
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -346,19 +199,18 @@ async def extract_keywords_stream_enriched(
|
|||||||
|
|
||||||
for level in LEVELS:
|
for level in LEVELS:
|
||||||
current = partial.get(level) or []
|
current = partial.get(level) or []
|
||||||
start_idx = len(confirmed[level]) # Where we start appending
|
start_idx = len(confirmed[level])
|
||||||
|
|
||||||
while len(confirmed[level]) < len(current):
|
while len(confirmed[level]) < len(current):
|
||||||
raw_item = current[len(confirmed[level])]
|
raw_item = current[len(confirmed[level])]
|
||||||
try:
|
try:
|
||||||
validated_item = KeywordEntry.model_validate(raw_item)
|
validated_item = KeywordEntry.model_validate(raw_item)
|
||||||
except ValidationError:
|
except ValidationError:
|
||||||
break # item not complete yet
|
break
|
||||||
|
|
||||||
confirmed[level].append(KeywordEntryWithTopic(llm_keyword=validated_item))
|
confirmed[level].append(KeywordEntryWithTopic(llm_keyword=validated_item))
|
||||||
grew = True
|
grew = True
|
||||||
|
|
||||||
# Launch openalex topic mapping
|
|
||||||
for idx in range(start_idx, len(confirmed[level])):
|
for idx in range(start_idx, len(confirmed[level])):
|
||||||
keyword_text = confirmed[level][idx].llm_keyword.keyword
|
keyword_text = confirmed[level][idx].llm_keyword.keyword
|
||||||
await emit(
|
await emit(
|
||||||
@@ -374,7 +226,6 @@ async def extract_keywords_stream_enriched(
|
|||||||
if grew:
|
if grew:
|
||||||
await emit_full_results()
|
await emit_full_results()
|
||||||
|
|
||||||
# ---------- Accumulate full_content for incremental parsing ----------
|
|
||||||
full_content_holder = {"value": ""}
|
full_content_holder = {"value": ""}
|
||||||
|
|
||||||
async def emit_wrapper(event: Dict[str, Any]) -> None:
|
async def emit_wrapper(event: Dict[str, Any]) -> None:
|
||||||
@@ -384,6 +235,7 @@ async def extract_keywords_stream_enriched(
|
|||||||
await on_chunk(event)
|
await on_chunk(event)
|
||||||
|
|
||||||
# ---------- Call the LLM ----------
|
# ---------- Call the LLM ----------
|
||||||
|
keywords = ""
|
||||||
try:
|
try:
|
||||||
keywords = await asyncio.wait_for(
|
keywords = await asyncio.wait_for(
|
||||||
llm.call_stream(
|
llm.call_stream(
|
||||||
@@ -401,14 +253,24 @@ async def extract_keywords_stream_enriched(
|
|||||||
await emit(KeywordsWsEvent(type="error", message=f"LLM call timed out after {timeout_seconds}s").model_dump())
|
await emit(KeywordsWsEvent(type="error", message=f"LLM call timed out after {timeout_seconds}s").model_dump())
|
||||||
raise RuntimeError("LLM streaming call timed out")
|
raise RuntimeError("LLM streaming call timed out")
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
# Cancel all pending enrichment tasks to avoid dangling background work
|
|
||||||
for task in enrichment_tasks:
|
|
||||||
task.cancel()
|
|
||||||
if enrichment_tasks:
|
|
||||||
await asyncio.gather(*enrichment_tasks, return_exceptions=True)
|
|
||||||
await emit(KeywordsWsEvent(type="error", message="Request cancelled").model_dump())
|
await emit(KeywordsWsEvent(type="error", message="Request cancelled").model_dump())
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if enrichment_tasks:
|
||||||
|
done, pending = await asyncio.wait(enrichment_tasks, timeout=10)
|
||||||
|
for task in pending:
|
||||||
|
task.cancel()
|
||||||
|
if pending:
|
||||||
|
await asyncio.gather(*pending, return_exceptions=True)
|
||||||
|
|
||||||
|
if not keywords:
|
||||||
|
# Empty string covers: real empty completion, APIConnectionError,
|
||||||
|
# and disconnect-during-emit (call_stream currently swallows all
|
||||||
|
# three the same way). Treat as a failed extraction.
|
||||||
|
await emit(KeywordsWsEvent(type="error", message="LLM call failed or returned no content").model_dump())
|
||||||
|
raise RuntimeError("LLM streaming call returned empty content")
|
||||||
|
|
||||||
# ---------- Finalize ----------
|
# ---------- Finalize ----------
|
||||||
await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Bearbeite Ergebnisse").model_dump())
|
await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Bearbeite Ergebnisse").model_dump())
|
||||||
|
|
||||||
@@ -418,13 +280,8 @@ async def extract_keywords_stream_enriched(
|
|||||||
await emit(KeywordsWsEvent(type="error", message=f"Invalid JSON in LLM response: {e}").model_dump())
|
await emit(KeywordsWsEvent(type="error", message=f"Invalid JSON in LLM response: {e}").model_dump())
|
||||||
raise RuntimeError("LLM response is not valid JSON")
|
raise RuntimeError("LLM response is not valid JSON")
|
||||||
|
|
||||||
# ---------- Wait for ALL pending enrichments to complete ----------
|
|
||||||
if enrichment_tasks:
|
|
||||||
await asyncio.gather(*enrichment_tasks, return_exceptions=True)
|
|
||||||
|
|
||||||
await emit_full_results()
|
await emit_full_results()
|
||||||
|
|
||||||
# Build final response
|
|
||||||
try:
|
try:
|
||||||
final_validated = _build_enriched_snapshot(confirmed)
|
final_validated = _build_enriched_snapshot(confirmed)
|
||||||
except ValidationError:
|
except ValidationError:
|
||||||
|
|||||||
@@ -35,13 +35,118 @@ class KeywordsPrompt(StrEnum):
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# STRICT GROUNDING GUARDRAIL (HIGHEST PRIORITY)
|
||||||
|
|
||||||
|
The output must be strictly extractive and grounded in the input text.
|
||||||
|
|
||||||
|
## Mandatory Rules
|
||||||
|
|
||||||
|
1. Extract ONLY keywords, terms, entities, concepts, technologies, methods, materials, standards, diseases, applications, sectors, or noun phrases that explicitly appear in the input text.
|
||||||
|
|
||||||
|
2. Do NOT introduce, infer, generalize, expand, normalize, summarize, classify, enrich, or extrapolate concepts beyond what is directly present in the text.
|
||||||
|
|
||||||
|
3. Do NOT generate parent categories, broader domains, scientific disciplines, industries, or technology areas unless those exact terms appear in the input text.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
Input contains:
|
||||||
|
|
||||||
|
"transformer-based machine learning framework"
|
||||||
|
|
||||||
|
Allowed:
|
||||||
|
|
||||||
|
* transformer-based machine learning framework
|
||||||
|
* machine learning
|
||||||
|
* transformer
|
||||||
|
|
||||||
|
Not allowed:
|
||||||
|
|
||||||
|
* Artificial Intelligence
|
||||||
|
* Deep Learning
|
||||||
|
* Neural Networks
|
||||||
|
|
||||||
|
unless those exact terms appear in the text.
|
||||||
|
|
||||||
|
4. Do NOT generate synonyms, abbreviations, alternate phrasings, normalized forms, or related concepts that do not explicitly appear in the source text.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
Input:
|
||||||
|
|
||||||
|
"large language models"
|
||||||
|
|
||||||
|
Allowed:
|
||||||
|
|
||||||
|
* large language models
|
||||||
|
|
||||||
|
Not allowed:
|
||||||
|
|
||||||
|
* LLMs
|
||||||
|
* Generative AI
|
||||||
|
* Artificial Intelligence
|
||||||
|
|
||||||
|
unless explicitly present.
|
||||||
|
|
||||||
|
5. Do NOT generate implied concepts.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
Input:
|
||||||
|
|
||||||
|
"patient records"
|
||||||
|
|
||||||
|
Not allowed:
|
||||||
|
|
||||||
|
* Healthcare
|
||||||
|
* Medical Informatics
|
||||||
|
* Clinical Documentation
|
||||||
|
|
||||||
|
unless explicitly mentioned.
|
||||||
|
|
||||||
|
6. Every keyword must have direct textual evidence in the input.
|
||||||
|
|
||||||
|
7. If a keyword cannot be highlighted verbatim or as a contiguous phrase in the source text, it must NOT appear in the output.
|
||||||
|
|
||||||
|
8. Prefer exact surface forms from the text.
|
||||||
|
|
||||||
|
9. Preserve original capitalization when possible.
|
||||||
|
|
||||||
|
10. Do not invent keywords to satisfy target counts.
|
||||||
|
|
||||||
|
11. When insufficient keywords exist for a level, return fewer keywords.
|
||||||
|
|
||||||
|
12. Grounding accuracy is more important than completeness.
|
||||||
|
|
||||||
|
13. Any keyword not directly supported by the text is considered an extraction error.
|
||||||
|
|
||||||
|
## Hierarchy Assignment Rules
|
||||||
|
|
||||||
|
The hierarchy is only an organizational grouping.
|
||||||
|
|
||||||
|
Do NOT create broader concepts to populate broad_keywords.
|
||||||
|
|
||||||
|
If the source text contains only specific concepts, place those concepts into the most appropriate level while remaining faithful to the text.
|
||||||
|
|
||||||
|
Do not create abstraction layers that are not explicitly present in the document.
|
||||||
|
|
||||||
|
## Self-Validation Before Output
|
||||||
|
|
||||||
|
Before returning the final JSON, verify every keyword:
|
||||||
|
|
||||||
|
* Can this exact phrase be found in the input text?
|
||||||
|
* Can a user highlight the phrase directly in the source text?
|
||||||
|
|
||||||
|
If the answer is NO, remove the keyword.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# Keyword Hierarchy
|
# Keyword Hierarchy
|
||||||
|
|
||||||
## 1. broad_keywords
|
## 1. broad_keywords
|
||||||
|
|
||||||
High-level domains, disciplines, industries, or technology areas.
|
High-level domains, disciplines, industries, technology areas, or major themes explicitly present in the text.
|
||||||
|
|
||||||
Examples:
|
Examples (only if explicitly mentioned):
|
||||||
|
|
||||||
* Artificial Intelligence
|
* Artificial Intelligence
|
||||||
* Healthcare
|
* Healthcare
|
||||||
@@ -50,15 +155,15 @@ class KeywordsPrompt(StrEnum):
|
|||||||
* Materials Science
|
* Materials Science
|
||||||
* Robotics
|
* Robotics
|
||||||
|
|
||||||
These should represent the major themes of the document.
|
These should represent the major themes of the document when those themes are explicitly stated.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 2. coarse_grained
|
## 2. coarse_grained
|
||||||
|
|
||||||
Mid-level concepts, technologies, research areas, methods, or applications.
|
Mid-level concepts, technologies, research areas, methods, applications, or technical topics explicitly present in the text.
|
||||||
|
|
||||||
Examples:
|
Examples (only if explicitly mentioned):
|
||||||
|
|
||||||
* Machine Learning
|
* Machine Learning
|
||||||
* Drug Discovery
|
* Drug Discovery
|
||||||
@@ -73,9 +178,9 @@ class KeywordsPrompt(StrEnum):
|
|||||||
|
|
||||||
## 3. fine_grained
|
## 3. fine_grained
|
||||||
|
|
||||||
Highly specific technical concepts, algorithms, materials, protocols, standards, tools, products, datasets, biomarkers, or specialized terminology.
|
Highly specific technical concepts, algorithms, materials, protocols, standards, tools, products, datasets, biomarkers, or specialized terminology explicitly present in the text.
|
||||||
|
|
||||||
Examples:
|
Examples (only if explicitly mentioned):
|
||||||
|
|
||||||
* Transformer Architecture
|
* Transformer Architecture
|
||||||
* CRISPR-Cas9
|
* CRISPR-Cas9
|
||||||
@@ -114,21 +219,56 @@ class KeywordsPrompt(StrEnum):
|
|||||||
|
|
||||||
# Extraction Rules
|
# Extraction Rules
|
||||||
|
|
||||||
* Extract only concepts explicitly mentioned or strongly implied.
|
* Extract only concepts explicitly mentioned in the text.
|
||||||
|
* Do not use concepts that are merely implied, inferred, generalized, or derived.
|
||||||
|
* Every keyword must be directly traceable to text spans in the input.
|
||||||
* Prefer noun phrases.
|
* Prefer noun phrases.
|
||||||
* Avoid complete sentences.
|
* Avoid complete sentences.
|
||||||
* Avoid duplicates across levels whenever possible.
|
* Avoid duplicates across levels whenever possible.
|
||||||
* Do not invent technologies not supported by the text.
|
* Do not invent technologies not supported by the text.
|
||||||
* Prefer terminology that can be searched in scientific literature databases such as OpenAlex.
|
* Prefer terminology that can be searched in scientific literature databases such as OpenAlex.
|
||||||
* Return between 5 and 15 keywords per level when sufficient information exists.
|
* Return between 5 and 15 keywords per level when sufficient information exists.
|
||||||
|
* If fewer valid keywords exist, return fewer.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Output Schema
|
# Output Schema
|
||||||
|
|
||||||
Return ONLY valid JSON.
|
Return ONLY valid JSON using the following structure:
|
||||||
|
|
||||||
|
{
|
||||||
|
"broad_keywords": [
|
||||||
|
{
|
||||||
|
"keyword": "string",
|
||||||
|
"relevance_score": 0.0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"coarse_grained": [
|
||||||
|
{
|
||||||
|
"keyword": "string",
|
||||||
|
"relevance_score": 0.0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fine_grained": [
|
||||||
|
{
|
||||||
|
"keyword": "string",
|
||||||
|
"relevance_score": 0.0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
|
||||||
|
* Return ONLY valid JSON.
|
||||||
|
* Do not include explanations.
|
||||||
|
* Do not include markdown.
|
||||||
|
* Do not include comments.
|
||||||
|
* Do not include reasoning.
|
||||||
|
* Do not include any text outside the JSON object.
|
||||||
|
* Every keyword must be directly supported by the input text.
|
||||||
|
* Any keyword not explicitly present in the source text must be excluded.
|
||||||
|
|
||||||
|
Return ONLY valid JSON matching the schema provided by the API.
|
||||||
---
|
---
|
||||||
|
|
||||||
# Example 1
|
# Example 1
|
||||||
@@ -136,11 +276,9 @@ class KeywordsPrompt(StrEnum):
|
|||||||
Input:
|
Input:
|
||||||
|
|
||||||
Researchers developed a transformer-based machine learning framework for predictive maintenance in industrial manufacturing. The system uses sensor fusion, anomaly detection, and time-series forecasting to reduce downtime in smart factories.
|
Researchers developed a transformer-based machine learning framework for predictive maintenance in industrial manufacturing. The system uses sensor fusion, anomaly detection, and time-series forecasting to reduce downtime in smart factories.
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
|
|
||||||
{"broad_keywords":[{"keyword":"ArtificialIntelligence","relevance_score":0.98},{"keyword":"Manufacturing","relevance_score":0.94},{"keyword":"IndustrialAutomation","relevance_score":0.90}],"coarse_grained":[{"keyword":"MachineLearning","relevance_score":0.96},{"keyword":"PredictiveMaintenance","relevance_score":0.95},{"keyword":"SmartFactories","relevance_score":0.88},{"keyword":"SensorFusion","relevance_score":0.86},{"keyword":"AnomalyDetection","relevance_score":0.85},{"keyword":"Time-SeriesForecasting","relevance_score":0.83}],"fine_grained":[{"keyword":"TransformerArchitecture","relevance_score":0.95},{"keyword":"IndustrialSensors","relevance_score":0.84},{"keyword":"MultimodalDataFusion","relevance_score":0.82},{"keyword":"PredictiveAnalytics","relevance_score":0.80}]}
|
broad_keywords":[{"keyword":"Industrial manufacturing","relevance_score":0.94}],"coarse_grained":[{"keyword":"Machine learning","relevance_score":0.97},{"keyword":"Predictive maintenance","relevance_score":0.95},{"keyword":"Sensor fusion","relevance_score":0.89},{"keyword":"Anomaly detection","relevance_score":0.88},{"keyword":"Time-series forecasting","relevance_score":0.87},{"keyword":"Smart factories","relevance_score":0.85}],"fine_grained":[{"keyword":"Transformer-based machine learning framework","relevance_score":0.96}]}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Example 2
|
# Example 2
|
||||||
@@ -148,257 +286,267 @@ class KeywordsPrompt(StrEnum):
|
|||||||
Input:
|
Input:
|
||||||
|
|
||||||
A healthcare platform uses large language models and retrieval-augmented generation to automatically summarize patient records and support clinical decision-making.
|
A healthcare platform uses large language models and retrieval-augmented generation to automatically summarize patient records and support clinical decision-making.
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
|
|
||||||
{"broad_keywords":[{"keyword":"Healthcare","relevance_score":0.97},{"keyword":"ArtificialIntelligence","relevance_score":0.95},{"keyword":"DigitalHealth","relevance_score":0.89}],"coarse_grained":[{"keyword":"LargeLanguageModels","relevance_score":0.96},{"keyword":"ClinicalDecisionSupport","relevance_score":0.92},{"keyword":"MedicalRecordAnalysis","relevance_score":0.90},{"keyword":"NaturalLanguageProcessing","relevance_score":0.88}],"fine_grained":[{"keyword":"Retrieval-AugmentedGeneration","relevance_score":0.95},{"keyword":"PatientRecordSummarization","relevance_score":0.91},{"keyword":"ClinicalDocumentation","relevance_score":0.86},{"keyword":"MedicalTextProcessing","relevance_score":0.84}]}
|
{"broad_keywords":[{"keyword":"Healthcare","relevance_score":0.96}],"coarse_grained":[{"keyword":"Large language models","relevance_score":0.95},{"keyword":"Clinical decision-making","relevance_score":0.91},{"keyword":"Patient records","relevance_score":0.90}],"fine_grained":[{"keyword":"Retrieval-augmented generation","relevance_score":0.94}]}
|
||||||
Return ONLY valid JSON matching the schema provided by the API.
|
Return ONLY valid JSON matching the schema provided by the API.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
EXTRACT_WEBSITE_KEYWORDS_PROMPT = """
|
EXTRACT_WEBSITE_KEYWORDS_PROMPT = """
|
||||||
You are an expert technology scout, scientific analyst, and innovation intelligence specialist.
|
You are an expert technology scout, scientific analyst, and innovation intelligence specialist.
|
||||||
|
|
||||||
The input text was extracted automatically from a webpage using BeautifulSoup or a similar HTML parser.
|
The input text was extracted automatically from a webpage using BeautifulSoup or a similar HTML parser.
|
||||||
|
|
||||||
The extracted text may contain:
|
The extracted text may contain:
|
||||||
|
|
||||||
* Navigation menus
|
* Navigation menus
|
||||||
* Headers and footers
|
* Headers and footers
|
||||||
* Cookie notices
|
* Cookie notices
|
||||||
* Marketing language
|
* Marketing language
|
||||||
* Contact information
|
* Contact information
|
||||||
* Repeated sections
|
* Repeated sections
|
||||||
* Calls to action
|
* Calls to action
|
||||||
* Legal disclaimers
|
* Legal disclaimers
|
||||||
* Product pages
|
* Product pages
|
||||||
* Blog articles
|
* Blog articles
|
||||||
* News articles
|
* News articles
|
||||||
* Landing pages
|
* Landing pages
|
||||||
|
|
||||||
Your first task is to identify the actual content and purpose of the webpage.
|
Your first task is to identify the actual content and purpose of the webpage.
|
||||||
|
|
||||||
Ignore:
|
Ignore:
|
||||||
|
|
||||||
* Navigation elements
|
* Navigation elements
|
||||||
* Cookie banners
|
* Cookie banners
|
||||||
* Legal notices
|
* Legal notices
|
||||||
* Copyright text
|
* Copyright text
|
||||||
* Generic marketing statements
|
* Generic marketing statements
|
||||||
* Contact information
|
* Contact information
|
||||||
* Login/signup content
|
* Login/signup content
|
||||||
* Careers pages unless they contain relevant technical information
|
* Careers pages unless they contain relevant technical information
|
||||||
* Repeated website boilerplate
|
* Repeated website boilerplate
|
||||||
|
|
||||||
Focus only on content that helps identify:
|
Focus only on the primary informational content of the webpage.
|
||||||
|
|
||||||
* Technologies
|
---
|
||||||
* Scientific concepts
|
|
||||||
* Research areas
|
|
||||||
* Technical methods
|
|
||||||
* Products
|
|
||||||
* Applications
|
|
||||||
* Industrial sectors
|
|
||||||
* Materials
|
|
||||||
* Standards
|
|
||||||
* Diseases
|
|
||||||
* Engineering disciplines
|
|
||||||
* Innovation domains
|
|
||||||
|
|
||||||
---
|
# STRICT GROUNDING GUARDRAIL (HIGHEST PRIORITY)
|
||||||
|
|
||||||
# Step 1: Determine Page Type
|
The output must be strictly extractive and grounded in the webpage text.
|
||||||
|
|
||||||
Determine which type of page is represented:
|
## Mandatory Rules
|
||||||
|
|
||||||
* Technology/Product Page
|
1. Extract ONLY keywords, entities, concepts, technologies, methods, products, materials, standards, diseases, applications, sectors, or noun phrases that explicitly appear in the webpage text.
|
||||||
* Company Page
|
|
||||||
* Research Article
|
|
||||||
* Scientific Blog Post
|
|
||||||
* News Article
|
|
||||||
* Technical Documentation
|
|
||||||
* White Paper
|
|
||||||
* Industry Report
|
|
||||||
* Other
|
|
||||||
|
|
||||||
Use this classification internally only.
|
2. Do NOT introduce, infer, generalize, normalize, classify, enrich, expand, summarize, or extrapolate concepts beyond what is directly present in the text.
|
||||||
|
|
||||||
Do not include it in the output.
|
3. Do NOT generate broader domains, scientific disciplines, industries, technology areas, research fields, or categories unless those exact terms appear in the webpage text.
|
||||||
|
|
||||||
---
|
Example:
|
||||||
|
|
||||||
# Step 2: Extract Searchable Concepts
|
Input:
|
||||||
|
|
||||||
Prioritize concepts that are useful for:
|
"The platform uses large language models and retrieval-augmented generation."
|
||||||
|
|
||||||
* OpenAlex retrieval
|
Allowed:
|
||||||
* Scientific literature discovery
|
|
||||||
* Patent scouting
|
|
||||||
* Technology scouting
|
|
||||||
* Innovation monitoring
|
|
||||||
|
|
||||||
Prefer canonical scientific terminology over marketing language.
|
* large language models
|
||||||
|
* retrieval-augmented generation
|
||||||
|
|
||||||
Examples:
|
Not allowed:
|
||||||
|
|
||||||
Prefer:
|
* Artificial Intelligence
|
||||||
|
* Generative AI
|
||||||
|
* Natural Language Processing
|
||||||
|
|
||||||
* Large Language Models
|
unless explicitly present.
|
||||||
|
|
||||||
Instead of:
|
4. Do NOT generate synonyms.
|
||||||
|
|
||||||
* AI Assistant
|
Example:
|
||||||
|
|
||||||
Prefer:
|
Input:
|
||||||
|
|
||||||
* Smart Manufacturing
|
"AI assistant"
|
||||||
|
|
||||||
Instead of:
|
Allowed:
|
||||||
|
|
||||||
* Factory Optimization Solution
|
* AI assistant
|
||||||
|
|
||||||
Prefer:
|
Not allowed:
|
||||||
|
|
||||||
* Retrieval-Augmented Generation
|
* large language models
|
||||||
|
* conversational AI
|
||||||
|
* generative AI
|
||||||
|
|
||||||
Instead of:
|
unless those exact terms appear.
|
||||||
|
|
||||||
* Intelligent Knowledge Assistant
|
5. Do NOT generate canonical scientific terminology when it does not appear in the source text.
|
||||||
|
|
||||||
Prefer:
|
6. Do NOT rewrite marketing terms into technical terms.
|
||||||
|
|
||||||
* Predictive Maintenance
|
7. Every keyword must have direct textual evidence in the webpage content.
|
||||||
|
|
||||||
Instead of:
|
8. If a keyword cannot be highlighted directly in the source text, it must NOT appear in the output.
|
||||||
|
|
||||||
* Equipment Performance Optimization
|
9. Preserve original wording whenever possible.
|
||||||
|
|
||||||
---
|
10. Do not invent keywords to satisfy target counts.
|
||||||
|
|
||||||
# Keyword Hierarchy
|
11. When insufficient keywords exist, return fewer keywords.
|
||||||
|
|
||||||
## broad_keywords
|
12. Grounding accuracy is more important than completeness.
|
||||||
|
|
||||||
High-level domains, industries, disciplines, or technology areas.
|
13. Any keyword not directly supported by the webpage text is considered an extraction error.
|
||||||
|
|
||||||
Examples:
|
---
|
||||||
|
|
||||||
* Artificial Intelligence
|
# Step 1: Determine Page Type
|
||||||
* Healthcare
|
|
||||||
* Manufacturing
|
|
||||||
* Energy Storage
|
|
||||||
* Biotechnology
|
|
||||||
* Robotics
|
|
||||||
|
|
||||||
---
|
Determine internally whether the page is:
|
||||||
|
|
||||||
## coarse_grained
|
* Technology/Product Page
|
||||||
|
* Company Page
|
||||||
|
* Research Article
|
||||||
|
* Scientific Blog Post
|
||||||
|
* News Article
|
||||||
|
* Technical Documentation
|
||||||
|
* White Paper
|
||||||
|
* Industry Report
|
||||||
|
* Other
|
||||||
|
|
||||||
Technologies, methods, research fields, and applications.
|
Use this classification only to identify the relevant content and remove boilerplate.
|
||||||
|
|
||||||
Examples:
|
Do NOT include the classification in the output.
|
||||||
|
|
||||||
* Machine Learning
|
---
|
||||||
* Predictive Maintenance
|
|
||||||
* Drug Discovery
|
|
||||||
* Smart Manufacturing
|
|
||||||
* Computer Vision
|
|
||||||
* Clinical Decision Support
|
|
||||||
|
|
||||||
---
|
# Step 2: Extract Searchable Concepts
|
||||||
|
|
||||||
## fine_grained
|
Extract concepts directly present in the page that are useful for:
|
||||||
|
|
||||||
Specific technical concepts, algorithms, materials, standards, tools, products, datasets, biomarkers, or protocols.
|
* OpenAlex retrieval
|
||||||
|
* Scientific literature discovery
|
||||||
|
* Patent scouting
|
||||||
|
* Technology scouting
|
||||||
|
* Innovation monitoring
|
||||||
|
|
||||||
Examples:
|
The extracted concepts must remain faithful to the wording used in the webpage.
|
||||||
|
|
||||||
* Transformer Architecture
|
Do NOT replace webpage terminology with your own preferred terminology.
|
||||||
* CRISPR-Cas9
|
|
||||||
* OPC UA
|
|
||||||
* Retrieval-Augmented Generation
|
|
||||||
* YOLOv8
|
|
||||||
* Lithium Iron Phosphate
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Relevance Score
|
# Keyword Hierarchy
|
||||||
|
|
||||||
Assign a relevance score between 0.0 and 1.0.
|
## broad_keywords
|
||||||
|
|
||||||
Guidelines:
|
High-level domains, industries, disciplines, technology areas, products, services, or major themes that explicitly appear in the webpage.
|
||||||
|
|
||||||
* 1.00 = central topic of the webpage
|
Only use this level when such broad concepts are explicitly present.
|
||||||
* 0.90 = major topic
|
|
||||||
* 0.80 = highly relevant
|
|
||||||
* 0.70 = supporting concept
|
|
||||||
* 0.60 = secondary concept
|
|
||||||
|
|
||||||
Avoid scores below 0.60 unless necessary.
|
Examples:
|
||||||
|
|
||||||
---
|
* Healthcare
|
||||||
|
* Biotechnology
|
||||||
|
* Manufacturing
|
||||||
|
* Robotics
|
||||||
|
* Financial Technology
|
||||||
|
|
||||||
# Additional Rules
|
only if those exact concepts appear in the webpage.
|
||||||
|
|
||||||
* Extract only concepts supported by the page content.
|
---
|
||||||
* Do not hallucinate technologies.
|
|
||||||
* Avoid generic company descriptions.
|
|
||||||
* Avoid generic business terminology.
|
|
||||||
* Prefer terminology suitable for scientific literature search.
|
|
||||||
* Prefer concepts that could appear in OpenAlex, patents, technical reports, or academic publications.
|
|
||||||
* Remove duplicates across hierarchy levels whenever possible.
|
|
||||||
* Rank keywords by importance.
|
|
||||||
|
|
||||||
---
|
## coarse_grained
|
||||||
# Example 3 — News Article
|
|
||||||
|
|
||||||
## Input
|
Technologies, methods, research fields, applications, products, services, or technical topics explicitly present in the webpage.
|
||||||
|
|
||||||
Apple announced a new generation of custom AI chips designed for on-device inference. The chips will power future iPhone and Mac devices, improving privacy, latency, and energy efficiency for generative AI applications.
|
Examples:
|
||||||
|
|
||||||
## Output
|
* Machine Learning
|
||||||
|
* Predictive Maintenance
|
||||||
|
* Drug Discovery
|
||||||
|
* Smart Manufacturing
|
||||||
|
* Clinical Decision Support
|
||||||
|
|
||||||
```json{"broad_keywords":[{"keyword":"Technology","relevance_score":0.98},{"keyword":"ArtificialIntelligence","relevance_score":0.97},{"keyword":"ConsumerElectronics","relevance_score":0.92}],"coarse_grained":[{"keyword":"AIHardware","relevance_score":0.96},{"keyword":"SemiconductorDesign","relevance_score":0.93},{"keyword":"EdgeComputing","relevance_score":0.90},{"keyword":"GenerativeAI","relevance_score":0.88}],"fine_grained":[{"keyword":"On-DeviceInference","relevance_score":0.95},{"keyword":"CustomAIChips","relevance_score":0.94},{"keyword":"InferenceAcceleration","relevance_score":0.89},{"keyword":"Low-LatencyProcessing","relevance_score":0.86}]}```
|
only if explicitly present.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Example 4 — Product Page
|
## fine_grained
|
||||||
|
|
||||||
## Input
|
Highly specific technical concepts, algorithms, materials, standards, tools, products, datasets, biomarkers, protocols, model names, framework names, software packages, or specialized terminology explicitly present in the webpage.
|
||||||
|
|
||||||
The Sony WH-1000XM6 wireless headphones feature adaptive noise cancellation, Bluetooth 5.4 connectivity, 40-hour battery life, multipoint device pairing, and spatial audio support.
|
Examples:
|
||||||
|
|
||||||
## Output
|
* FastAPI
|
||||||
|
* OpenAPI
|
||||||
|
* Pydantic
|
||||||
|
* CRISPR-Cas9
|
||||||
|
* Retrieval-Augmented Generation
|
||||||
|
* OPC UA
|
||||||
|
|
||||||
```json{"broad_keywords":[{"keyword":"ConsumerElectronics","relevance_score":0.98},{"keyword":"AudioTechnology","relevance_score":0.95}],"coarse_grained":[{"keyword":"WirelessHeadphones","relevance_score":0.97},{"keyword":"NoiseCancellation","relevance_score":0.95},{"keyword":"BluetoothAudio","relevance_score":0.92}],"fine_grained":[{"keyword":"AdaptiveNoiseCancellation","relevance_score":0.96},{"keyword":"Bluetooth5.4","relevance_score":0.94},{"keyword":"MultipointPairing","relevance_score":0.89},{"keyword":"SpatialAudio","relevance_score":0.87}]}```
|
only if explicitly present.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Example 5 — Technical Documentation
|
# Relevance Score
|
||||||
|
|
||||||
## Input
|
Assign a relevance score between 0.0 and 1.0.
|
||||||
|
|
||||||
FastAPI is a modern Python web framework for building APIs. It provides automatic OpenAPI schema generation, dependency injection, asynchronous request handling, and data validation through Pydantic models.
|
Guidelines:
|
||||||
|
|
||||||
## Output
|
* 1.00 = central topic of the webpage
|
||||||
|
* 0.90 = major topic
|
||||||
|
* 0.80 = highly relevant
|
||||||
|
* 0.70 = supporting concept
|
||||||
|
* 0.60 = secondary concept
|
||||||
|
|
||||||
```json{"broad_keywords":[{"keyword":"SoftwareDevelopment","relevance_score":0.98},{"keyword":"WebDevelopment","relevance_score":0.95}],"coarse_grained":[{"keyword":"PythonFrameworks","relevance_score":0.97},{"keyword":"APIDevelopment","relevance_score":0.95},{"keyword":"BackendEngineering","relevance_score":0.91}],"fine_grained":[{"keyword":"FastAPI","relevance_score":0.99},{"keyword":"OpenAPI","relevance_score":0.95},{"keyword":"DependencyInjection","relevance_score":0.90},{"keyword":"Pydantic","relevance_score":0.89},{"keyword":"AsynchronousRequestHandling","relevance_score":0.87}]}```
|
Avoid scores below 0.60 unless necessary.
|
||||||
|
|
||||||
---
|
Rank keywords by importance.
|
||||||
|
|
||||||
# Example 6 — Company Website
|
---
|
||||||
|
|
||||||
## Input
|
# Extraction Rules
|
||||||
|
|
||||||
Stripe provides online payment infrastructure for businesses. Its platform supports payment processing, subscription billing, fraud prevention, financial reporting, and global commerce operations.
|
* Extract only concepts explicitly mentioned in the webpage text.
|
||||||
|
* Do not use concepts that are merely implied, inferred, generalized, or derived.
|
||||||
|
* Every keyword must be directly traceable to text spans in the webpage.
|
||||||
|
* Prefer noun phrases.
|
||||||
|
* Avoid complete sentences.
|
||||||
|
* Avoid duplicates across hierarchy levels whenever possible.
|
||||||
|
* Preserve original wording.
|
||||||
|
* Rank keywords by importance.
|
||||||
|
* Return between 5 and 15 keywords per level when sufficient information exists.
|
||||||
|
* If fewer valid keywords exist, return fewer.
|
||||||
|
|
||||||
## Output
|
---
|
||||||
|
|
||||||
```json{"broad_keywords":[{"keyword":"FinancialTechnology","relevance_score":0.98},{"keyword":"BusinessServices","relevance_score":0.91}],"coarse_grained":[{"keyword":"PaymentProcessing","relevance_score":0.97},{"keyword":"DigitalPayments","relevance_score":0.95},{"keyword":"SubscriptionManagement","relevance_score":0.90}],"fine_grained":[{"keyword":"StripePlatform","relevance_score":0.99},{"keyword":"FraudPrevention","relevance_score":0.91},{"keyword":"RecurringBilling","relevance_score":0.89},{"keyword":"GlobalPaymentInfrastructure","relevance_score":0.87}]}```
|
# Self-Validation Before Output
|
||||||
|
|
||||||
---
|
For every keyword, verify:
|
||||||
|
|
||||||
|
* Can this exact phrase be found in the webpage text?
|
||||||
|
* Can a user highlight the phrase directly in the extracted content?
|
||||||
|
|
||||||
|
If the answer is NO, remove the keyword.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Example — Technical Documentation
|
||||||
|
|
||||||
|
Input:
|
||||||
|
|
||||||
|
FastAPI is a modern Python web framework for building APIs. It provides automatic OpenAPI schema generation, dependency injection, asynchronous request handling, and data validation through Pydantic models.
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
{"broad_keywords":[{"keyword":"Python web framework","relevance_score":0.95}],"coarse_grained":[{"keyword":"building APIs","relevance_score":0.93},{"keyword":"Data validation","relevance_score":0.90}],"fine_grained":[{"keyword":"FastAPI","relevance_score":0.99},{"keyword":"OpenAPI","relevance_score":0.95},{"keyword":"Dependency Injection","relevance_score":0.91},{"keyword":"Asynchronous Request Handling","relevance_score":0.89},{"keyword":"Pydantic","relevance_score":0.88}]}
|
||||||
|
|
||||||
|
Return ONLY valid JSON matching the schema provided by the API.
|
||||||
|
|
||||||
Return ONLY valid JSON matching the schema provided by the API.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
SIMPLE_TEXT_PROMPT = """
|
SIMPLE_TEXT_PROMPT = """
|
||||||
|
|||||||
@@ -8,10 +8,13 @@ import asyncio
|
|||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from fastapi import APIRouter, Body, WebSocket, WebSocketDisconnect
|
from fastapi import APIRouter, Body, WebSocket, WebSocketDisconnect
|
||||||
|
from uvicorn.protocols.utils import ClientDisconnected
|
||||||
|
|
||||||
from . import logic
|
from . import logic
|
||||||
from inse.keywords.model import ExtractedKeywordsResponse, KeywordsRequest
|
from inse.keywords.model import ExtractedKeywordsResponse, KeywordsRequest
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
router = APIRouter(
|
router = APIRouter(
|
||||||
prefix="/api/inse-service",
|
prefix="/api/inse-service",
|
||||||
@@ -19,26 +22,35 @@ router = APIRouter(
|
|||||||
responses={404: {"description": "Not found"}},
|
responses={404: {"description": "Not found"}},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@router.websocket("/keywords/extract/ws")
|
@router.websocket("/keywords/extract/ws")
|
||||||
async def extract_keywords_ws(websocket: WebSocket):
|
async def extract_keywords_ws(websocket: WebSocket):
|
||||||
print("WebSocket connection established for keyword extraction.")
|
|
||||||
await websocket.accept()
|
await websocket.accept()
|
||||||
|
|
||||||
|
disconnected = asyncio.Event()
|
||||||
|
extraction_task: asyncio.Task | None = None
|
||||||
|
|
||||||
|
async def emit(event: dict):
|
||||||
|
if disconnected.is_set():
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
await websocket.send_json(event)
|
||||||
|
except (WebSocketDisconnect, ClientDisconnected):
|
||||||
|
disconnected.set()
|
||||||
|
|
||||||
|
async def safe_send(payload: dict):
|
||||||
|
if disconnected.is_set():
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
await websocket.send_json(payload)
|
||||||
|
except (WebSocketDisconnect, ClientDisconnected):
|
||||||
|
disconnected.set()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
raw = await websocket.receive_json()
|
raw = await websocket.receive_json()
|
||||||
request = KeywordsRequest(**raw)
|
request = KeywordsRequest(**raw)
|
||||||
disconnected = asyncio.Event()
|
|
||||||
|
|
||||||
async def emit(event: dict):
|
|
||||||
if disconnected.is_set():
|
|
||||||
return
|
|
||||||
await websocket.send_json(event)
|
|
||||||
|
|
||||||
async def watch_disconnect() -> None:
|
|
||||||
while True:
|
|
||||||
message = await websocket.receive()
|
|
||||||
if message["type"] == "websocket.disconnect":
|
|
||||||
disconnected.set()
|
|
||||||
return
|
|
||||||
|
|
||||||
extraction_task = asyncio.create_task(
|
extraction_task = asyncio.create_task(
|
||||||
logic.extract_keywords_stream_enriched(
|
logic.extract_keywords_stream_enriched(
|
||||||
@@ -48,61 +60,38 @@ async def extract_keywords_ws(websocket: WebSocket):
|
|||||||
emit=emit,
|
emit=emit,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
disconnect_task = asyncio.create_task(watch_disconnect())
|
|
||||||
|
|
||||||
done, pending = await asyncio.wait(
|
result = await extraction_task
|
||||||
{extraction_task, disconnect_task},
|
|
||||||
return_when=asyncio.FIRST_COMPLETED,
|
|
||||||
)
|
|
||||||
|
|
||||||
if disconnect_task in done:
|
await safe_send({
|
||||||
disconnected.set()
|
"type": "completed",
|
||||||
|
"result": result.model_dump(),
|
||||||
|
})
|
||||||
|
|
||||||
|
except (WebSocketDisconnect, ClientDisconnected):
|
||||||
|
disconnected.set()
|
||||||
|
logger.info("Client disconnected from keyword extraction ws")
|
||||||
|
print("Client disconnected from keyword extraction ws")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
disconnected.set()
|
||||||
|
logger.exception("Error in keyword extraction ws")
|
||||||
|
await safe_send({
|
||||||
|
"type": "error",
|
||||||
|
"message": str(e),
|
||||||
|
})
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if extraction_task is not None and not extraction_task.done():
|
||||||
extraction_task.cancel()
|
extraction_task.cancel()
|
||||||
try:
|
try:
|
||||||
await extraction_task
|
await extraction_task
|
||||||
except asyncio.CancelledError:
|
except (asyncio.CancelledError, Exception):
|
||||||
pass
|
pass
|
||||||
return
|
|
||||||
|
|
||||||
disconnect_task.cancel()
|
|
||||||
try:
|
|
||||||
await disconnect_task
|
|
||||||
except asyncio.CancelledError:
|
|
||||||
pass
|
|
||||||
result = extraction_task.result()
|
|
||||||
|
|
||||||
await websocket.send_json({"type": "completed", "result": result.model_dump()})
|
|
||||||
|
|
||||||
except WebSocketDisconnect:
|
|
||||||
print("WebSocket disconnected.")
|
|
||||||
pass
|
|
||||||
except Exception as e:
|
|
||||||
await websocket.send_json({"type": "error", "message": str(e)})
|
|
||||||
finally:
|
|
||||||
if websocket.application_state.name != "DISCONNECTED":
|
if websocket.application_state.name != "DISCONNECTED":
|
||||||
await websocket.close()
|
await websocket.close()
|
||||||
|
|
||||||
# @router.post(
|
|
||||||
# "/keywords/extract",
|
|
||||||
# operation_id="extractKeywords",
|
|
||||||
# response_model=ExtractedKeywordsResponse,
|
|
||||||
# )
|
|
||||||
# async def extract_keywords(
|
|
||||||
# request: Annotated[
|
|
||||||
# KeywordsRequest,
|
|
||||||
# Body(description="Input text for keyword extraction"),
|
|
||||||
# ],
|
|
||||||
# ):
|
|
||||||
# async def noop(_: dict):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
# return await logic.extract_keywords_stream(
|
|
||||||
# query=request.query,
|
|
||||||
# mode=request.mode,
|
|
||||||
# limit=request.limit,
|
|
||||||
# emit=noop,
|
|
||||||
# )
|
|
||||||
|
|
||||||
@router.post(
|
@router.post(
|
||||||
"/keywords/extract",
|
"/keywords/extract",
|
||||||
operation_id="extractKeywords",
|
operation_id="extractKeywords",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ from inse.exceptions import (
|
|||||||
)
|
)
|
||||||
from inse.funders.service import router as funders_service_router
|
from inse.funders.service import router as funders_service_router
|
||||||
from inse.projects.router import router as projects_router
|
from inse.projects.router import router as projects_router
|
||||||
from inse.university_ranking.router import router as university_ranking_router
|
from inse.university_ranking.service import router as university_ranking_router
|
||||||
|
|
||||||
# caching
|
# caching
|
||||||
from inse.middleware.etag_cache import ETagCacheMiddleware
|
from inse.middleware.etag_cache import ETagCacheMiddleware
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ class ESIndex(StrEnum):
|
|||||||
OPENALEX_AUTHORS = "openalex-authors"
|
OPENALEX_AUTHORS = "openalex-authors"
|
||||||
OPENALEX_INSTITUTIONS = "openalex-institutions"
|
OPENALEX_INSTITUTIONS = "openalex-institutions"
|
||||||
OPENALEX_PUBLICATIONS = "openalex-publications"
|
OPENALEX_PUBLICATIONS = "openalex-publications"
|
||||||
|
OPENALEX_COUNTRIES = "openalex-countries"
|
||||||
|
OPENALEX_CONTINENTS = "openalex-continents"
|
||||||
|
OPENALEX_TOPICS = "openalex-topics"
|
||||||
|
OPENALEX_TOPIC_VECTORS = "topicvectors"
|
||||||
|
|
||||||
EPO_INDEX = "epo_index_1.0"
|
EPO_INDEX = "epo_index_1.0"
|
||||||
USPTO_INDEX = "uspto_patents_3.0"
|
USPTO_INDEX = "uspto_patents_3.0"
|
||||||
|
|||||||
Binary file not shown.
@@ -39,6 +39,7 @@ class Topic(BaseModel):
|
|||||||
keywords: Optional[List[StrictStr]] = Field(default=None, description="Keywords representing the content of papers in the topic.")
|
keywords: Optional[List[StrictStr]] = Field(default=None, description="Keywords representing the content of papers in the topic.")
|
||||||
subfield: Optional[TopicSubfield] = None
|
subfield: Optional[TopicSubfield] = None
|
||||||
var_field: Optional[TopicField] = Field(default=None, alias="field")
|
var_field: Optional[TopicField] = Field(default=None, alias="field")
|
||||||
|
field: Optional[TopicField] = Field(default=None)
|
||||||
domain: Optional[TopicDomain] = None
|
domain: Optional[TopicDomain] = None
|
||||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with this topic.")
|
works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with this topic.")
|
||||||
cited_by_count: Optional[StrictInt] = None
|
cited_by_count: Optional[StrictInt] = None
|
||||||
|
|||||||
@@ -33,11 +33,12 @@ class WorkTopic(BaseModel):
|
|||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
id: Optional[StrictStr] = None
|
id: Optional[StrictStr] = None
|
||||||
display_name: Optional[StrictStr] = None
|
display_name: Optional[StrictStr] = None
|
||||||
|
description: Optional[StrictStr] = None
|
||||||
score: Optional[Union[StrictFloat, StrictInt]] = None
|
score: Optional[Union[StrictFloat, StrictInt]] = None
|
||||||
subfield: Optional[WorkTopicSubfield] = None
|
subfield: Optional[WorkTopicSubfield] = None
|
||||||
var_field: Optional[WorkTopicField] = Field(default=None, alias="field")
|
var_field: Optional[WorkTopicField] = Field(default=None, alias="field")
|
||||||
domain: Optional[WorkTopicDomain] = None
|
domain: Optional[WorkTopicDomain] = None
|
||||||
__properties: ClassVar[List[str]] = ["id", "display_name", "score", "subfield", "field", "domain"]
|
__properties: ClassVar[List[str]] = ["id", "display_name", "description", "score", "subfield", "field", "domain"]
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = ConfigDict(
|
||||||
validate_by_name=True,
|
validate_by_name=True,
|
||||||
@@ -101,6 +102,7 @@ class WorkTopic(BaseModel):
|
|||||||
_obj = cls.model_validate({
|
_obj = cls.model_validate({
|
||||||
"id": obj.get("id"),
|
"id": obj.get("id"),
|
||||||
"display_name": obj.get("display_name"),
|
"display_name": obj.get("display_name"),
|
||||||
|
"description": obj.get("description"),
|
||||||
"score": obj.get("score"),
|
"score": obj.get("score"),
|
||||||
"subfield": WorkTopicSubfield.from_dict(obj["subfield"]) if obj.get("subfield") is not None else None,
|
"subfield": WorkTopicSubfield.from_dict(obj["subfield"]) if obj.get("subfield") is not None else None,
|
||||||
"field": WorkTopicField.from_dict(obj["field"]) if obj.get("field") is not None else None,
|
"field": WorkTopicField.from_dict(obj["field"]) if obj.get("field") is not None else None,
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ from inse.exceptions import ElasticsearchException
|
|||||||
|
|
||||||
from ..integrations import elasticsearch, llm
|
from ..integrations import elasticsearch, llm
|
||||||
from ..persons.logic import find_ude_author_by_name, get_author_name_by_id
|
from ..persons.logic import find_ude_author_by_name, get_author_name_by_id
|
||||||
from .model import MentionedPerson, NewsArticle, NewsArticleDetail, NewsPage
|
from ..topics.logic import vector_search_topics
|
||||||
|
from .model import MatchedTopic, MentionedPerson, NewsArticle, NewsArticleDetail, NewsPage
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -20,14 +21,19 @@ TOPIC_LIMIT = 4
|
|||||||
TOPIC_QUERY_CONTENT_CHARS = 300
|
TOPIC_QUERY_CONTENT_CHARS = 300
|
||||||
TOPIC_NUM_CANDIDATES = 100
|
TOPIC_NUM_CANDIDATES = 100
|
||||||
TOPIC_SIMILARITY = 0.5
|
TOPIC_SIMILARITY = 0.5
|
||||||
|
TOPIC_MATCHES_PER_KEYWORD = 1
|
||||||
|
|
||||||
KEYWORD_LIMIT = 6
|
KEYWORD_LIMIT = 6
|
||||||
KEYWORD_CONTENT_CHARS = 4000
|
KEYWORD_CONTENT_CHARS = 4000
|
||||||
KEYWORD_SYSTEM_PROMPT = """\
|
KEYWORD_SYSTEM_PROMPT = """\
|
||||||
Extrahiere aus dem folgenden Nachrichtenartikel die wichtigsten Schlagwörter (Keywords).
|
Extrahiere aus dem nachfolgenden Campus-Aktuell-Artikel der Universität Duisburg-Essen die wichtigsten Schlagwörter (Keywords).
|
||||||
Gib maximal sechs prägnante Begriffe oder kurze Phrasen zurück, die den inhaltlichen Kern
|
Wähle ausschließlich Begriffe oder Phrasen, die tatsächlich im Text vorkommen. Erfinde keine Begriffe, verallgemeinere nicht und nenne keine Oberbegriffe, die nicht im Text stehen.
|
||||||
des Artikels erfassen. Antworte ausschließlich mit einem JSON-Array von Strings, ohne
|
Übersetze keine Begriffe – verwende ausschließlich Wörter und Phrasen in der Sprache des Artikels.
|
||||||
weiteren Text, zum Beispiel ["Künstliche Intelligenz", "Klimaforschung"].
|
Gib jedes Schlagwort in seiner Grundform an: Bei deutschen Begriffen Substantive im Nominativ Singular; bei englischen Begriffen Substantive im Singular. Verwende den Plural nur, wenn der Begriff üblicherweise im Plural gebraucht wird.
|
||||||
|
Vermeide Redundanz: Wenn zwei mögliche Schlagwörter dieselbe Wortbasis teilen (z.B. „Forschung" und „Forschungsprojekt"), nenne nur den spezifischeren Begriff.
|
||||||
|
Nenne maximal sechs prägnante Begriffe oder kurze Phrasen. Konzentriere dich auf inhaltlich zentrale Begriffe, nicht auf Personennamen oder Datumsangaben.
|
||||||
|
Antworte ausschließlich mit gültigem JSON in exakt diesem Format: {"keywords": ["Schlagwort", "Schlagwort"]}
|
||||||
|
Gib keine Erklärungen und kein Markdown aus, nur das JSON.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RELATED_BLOCK_SIZE = 5
|
RELATED_BLOCK_SIZE = 5
|
||||||
@@ -80,7 +86,14 @@ async def search_news(
|
|||||||
clauses = await _filter_clauses(year_from, year_to, relevance_values)
|
clauses = await _filter_clauses(year_from, year_to, relevance_values)
|
||||||
exact_query = {
|
exact_query = {
|
||||||
"bool": {
|
"bool": {
|
||||||
"must": [{"match": {"full_content": query_text}}],
|
"must": [
|
||||||
|
{
|
||||||
|
"multi_match": {
|
||||||
|
"query": query_text,
|
||||||
|
"fields": ["maintitle^2", "full_content"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"filter": clauses,
|
"filter": clauses,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,7 +253,6 @@ async def get_news_by_id(news_id: str) -> NewsArticleDetail:
|
|||||||
source = response.get("_source", {})
|
source = response.get("_source", {})
|
||||||
|
|
||||||
relevant, authors, cached_keywords, postproc_id = await _get_postproc_labels(news_id)
|
relevant, authors, cached_keywords, postproc_id = await _get_postproc_labels(news_id)
|
||||||
topics = await _get_article_topics(source.get("maintitle"), source.get("full_content"))
|
|
||||||
keywords = await _get_article_keywords(
|
keywords = await _get_article_keywords(
|
||||||
news_id,
|
news_id,
|
||||||
postproc_id,
|
postproc_id,
|
||||||
@@ -248,6 +260,7 @@ async def get_news_by_id(news_id: str) -> NewsArticleDetail:
|
|||||||
source.get("maintitle"),
|
source.get("maintitle"),
|
||||||
source.get("full_content"),
|
source.get("full_content"),
|
||||||
)
|
)
|
||||||
|
topics = await _match_topics_for_keywords(keywords)
|
||||||
|
|
||||||
return NewsArticleDetail(
|
return NewsArticleDetail(
|
||||||
id=response.get("_id"),
|
id=response.get("_id"),
|
||||||
@@ -258,22 +271,11 @@ async def get_news_by_id(news_id: str) -> NewsArticleDetail:
|
|||||||
full_content=source.get("full_content"),
|
full_content=source.get("full_content"),
|
||||||
relevant=relevant,
|
relevant=relevant,
|
||||||
authors=await _build_mentioned_persons(authors),
|
authors=await _build_mentioned_persons(authors),
|
||||||
topics=topics,
|
|
||||||
keywords=keywords,
|
keywords=keywords,
|
||||||
|
topics=topics,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def _get_article_topics(maintitle: str | None, full_content: str | None) -> list:
|
|
||||||
query = " ".join(
|
|
||||||
part for part in (maintitle, (full_content or "")[:TOPIC_QUERY_CONTENT_CHARS]) if part
|
|
||||||
).strip()
|
|
||||||
if not query:
|
|
||||||
return []
|
|
||||||
|
|
||||||
topics = await _topic_vector_search(query, TOPIC_LIMIT, ["display_name"])
|
|
||||||
return [topic["display_name"] for topic in topics if topic.get("display_name")]
|
|
||||||
|
|
||||||
|
|
||||||
async def _get_article_keywords(
|
async def _get_article_keywords(
|
||||||
news_id: str,
|
news_id: str,
|
||||||
postproc_id: str | None,
|
postproc_id: str | None,
|
||||||
@@ -308,7 +310,12 @@ def _parse_keywords(raw: str) -> list:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
parsed = json.loads(raw)
|
parsed = json.loads(raw)
|
||||||
candidates = parsed if isinstance(parsed, list) else []
|
if isinstance(parsed, list):
|
||||||
|
candidates = parsed
|
||||||
|
elif isinstance(parsed, dict):
|
||||||
|
candidates = parsed.get("keywords", [])
|
||||||
|
else:
|
||||||
|
candidates = []
|
||||||
except (json.JSONDecodeError, TypeError):
|
except (json.JSONDecodeError, TypeError):
|
||||||
candidates = re.split(r"[,\n]", raw)
|
candidates = re.split(r"[,\n]", raw)
|
||||||
|
|
||||||
@@ -343,6 +350,35 @@ async def _store_keywords(news_id: str, postproc_id: str | None, keywords: list)
|
|||||||
logger.exception(f"Failed to cache keywords for {news_id}.")
|
logger.exception(f"Failed to cache keywords for {news_id}.")
|
||||||
|
|
||||||
|
|
||||||
|
async def _match_topics_for_keywords(keywords: list) -> list:
|
||||||
|
matched = []
|
||||||
|
seen_ids = set()
|
||||||
|
|
||||||
|
for keyword in keywords:
|
||||||
|
try:
|
||||||
|
response = await vector_search_topics(query=keyword, limit=TOPIC_MATCHES_PER_KEYWORD)
|
||||||
|
except Exception:
|
||||||
|
logger.exception(f"Topic-Matching fuer Keyword '{keyword}' fehlgeschlagen.")
|
||||||
|
continue
|
||||||
|
|
||||||
|
for topic in response.results or []:
|
||||||
|
if not topic.id or topic.id in seen_ids:
|
||||||
|
continue
|
||||||
|
seen_ids.add(topic.id)
|
||||||
|
matched.append(
|
||||||
|
MatchedTopic(
|
||||||
|
id=topic.id,
|
||||||
|
display_name=topic.display_name,
|
||||||
|
subfield_name=topic.subfield.display_name if topic.subfield else None,
|
||||||
|
field_name=topic.var_field.display_name if topic.var_field else None,
|
||||||
|
domain_name=topic.domain.display_name if topic.domain else None,
|
||||||
|
source_keyword=keyword,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return matched
|
||||||
|
|
||||||
|
|
||||||
async def _topic_vector_search(query_text: str, k: int, source_fields: list) -> list:
|
async def _topic_vector_search(query_text: str, k: int, source_fields: list) -> list:
|
||||||
try:
|
try:
|
||||||
from ..util import get_model
|
from ..util import get_model
|
||||||
|
|||||||
@@ -23,12 +23,21 @@ class MentionedPerson(BaseModel):
|
|||||||
person_id: Optional[str] = None
|
person_id: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
class MatchedTopic(BaseModel):
|
||||||
|
id: Optional[str] = None
|
||||||
|
display_name: Optional[str] = None
|
||||||
|
subfield_name: Optional[str] = None
|
||||||
|
field_name: Optional[str] = None
|
||||||
|
domain_name: Optional[str] = None
|
||||||
|
source_keyword: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class NewsArticleDetail(NewsArticle):
|
class NewsArticleDetail(NewsArticle):
|
||||||
full_content: Optional[str] = None
|
full_content: Optional[str] = None
|
||||||
relevant: Optional[bool] = None
|
relevant: Optional[bool] = None
|
||||||
authors: List[MentionedPerson] = []
|
authors: List[MentionedPerson] = []
|
||||||
topics: List[str] = []
|
|
||||||
keywords: List[str] = []
|
keywords: List[str] = []
|
||||||
|
topics: List[MatchedTopic] = []
|
||||||
|
|
||||||
|
|
||||||
class NewsPage(BaseModel):
|
class NewsPage(BaseModel):
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ from typing import Optional
|
|||||||
from fastapi import HTTPException, status
|
from fastapi import HTTPException, status
|
||||||
from sqlmodel import Session, func, select
|
from sqlmodel import Session, func, select
|
||||||
|
|
||||||
from inse.auth.model import AccessTokenMetadata, Account, Organization, UserRole
|
from inse.auth.model import AccessTokenMetadata, Account, Organization
|
||||||
|
from inse.auth.permissions import Permission, has_permission, require_permission
|
||||||
|
|
||||||
|
|
||||||
from .model import (
|
from .model import (
|
||||||
CreateOrganizationRequest,
|
CreateOrganizationRequest,
|
||||||
@@ -14,12 +16,11 @@ from .model import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _require_super_admin(access_token: AccessTokenMetadata) -> None:
|
def _require_manage_organizations(access_token: AccessTokenMetadata) -> None:
|
||||||
if access_token.effective_role != UserRole.SUPER_ADMIN:
|
require_permission(
|
||||||
raise HTTPException(
|
access_token.effective_role,
|
||||||
status_code=status.HTTP_403_FORBIDDEN,
|
Permission.MANAGE_ORGANIZATIONS,
|
||||||
detail="Only superadmins can manage organizations.",
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _normalize_name(name: str) -> str:
|
def _normalize_name(name: str) -> str:
|
||||||
@@ -117,7 +118,7 @@ def get_organizations(
|
|||||||
statement = select(Organization)
|
statement = select(Organization)
|
||||||
count_statement = select(func.count()).select_from(Organization)
|
count_statement = select(func.count()).select_from(Organization)
|
||||||
|
|
||||||
if access_token.effective_role != UserRole.SUPER_ADMIN:
|
if not has_permission(access_token.effective_role, Permission.MANAGE_ORGANIZATIONS):
|
||||||
scope_filter = Organization.id == access_token.effective_organization_id
|
scope_filter = Organization.id == access_token.effective_organization_id
|
||||||
statement = statement.where(scope_filter)
|
statement = statement.where(scope_filter)
|
||||||
count_statement = count_statement.where(scope_filter)
|
count_statement = count_statement.where(scope_filter)
|
||||||
@@ -148,7 +149,7 @@ def create_organization(
|
|||||||
access_token: AccessTokenMetadata,
|
access_token: AccessTokenMetadata,
|
||||||
payload: CreateOrganizationRequest,
|
payload: CreateOrganizationRequest,
|
||||||
) -> OrganizationProfile:
|
) -> OrganizationProfile:
|
||||||
_require_super_admin(access_token)
|
_require_manage_organizations(access_token)
|
||||||
name = _normalize_name(payload.name)
|
name = _normalize_name(payload.name)
|
||||||
_ensure_name_available(session, name)
|
_ensure_name_available(session, name)
|
||||||
|
|
||||||
@@ -168,7 +169,7 @@ def update_organization(
|
|||||||
organization_id: uuid.UUID,
|
organization_id: uuid.UUID,
|
||||||
payload: UpdateOrganizationRequest,
|
payload: UpdateOrganizationRequest,
|
||||||
) -> OrganizationProfile:
|
) -> OrganizationProfile:
|
||||||
_require_super_admin(access_token)
|
_require_manage_organizations(access_token)
|
||||||
organization = _get_organization_or_404(session, organization_id)
|
organization = _get_organization_or_404(session, organization_id)
|
||||||
|
|
||||||
if payload.name is not None:
|
if payload.name is not None:
|
||||||
@@ -194,7 +195,7 @@ def delete_organization(
|
|||||||
access_token: AccessTokenMetadata,
|
access_token: AccessTokenMetadata,
|
||||||
organization_id: uuid.UUID,
|
organization_id: uuid.UUID,
|
||||||
) -> None:
|
) -> None:
|
||||||
_require_super_admin(access_token)
|
_require_manage_organizations(access_token)
|
||||||
organization = _get_organization_or_404(session, organization_id)
|
organization = _get_organization_or_404(session, organization_id)
|
||||||
if not organization.deleted:
|
if not organization.deleted:
|
||||||
_deactivate_organization_accounts(session, organization.id)
|
_deactivate_organization_accounts(session, organization.id)
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ from inse.persons.model import (
|
|||||||
CustomAuthorsListResponse,
|
CustomAuthorsListResponse,
|
||||||
CareerMetrics,
|
CareerMetrics,
|
||||||
)
|
)
|
||||||
|
from inse.works.logic import enrich_topic_descriptions
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
INDEX_NAME = "openalex-authors"
|
INDEX_NAME = "openalex-authors"
|
||||||
@@ -728,6 +729,10 @@ async def advanced_search_persons(
|
|||||||
)
|
)
|
||||||
results.append(custom_author)
|
results.append(custom_author)
|
||||||
|
|
||||||
|
await enrich_topic_descriptions(
|
||||||
|
[topic for author in results for topic in author.topics or []]
|
||||||
|
)
|
||||||
|
|
||||||
return CustomAuthorsListResponse(
|
return CustomAuthorsListResponse(
|
||||||
results=results, meta=Meta(count=total_count, page=page, per_page=page_size)
|
results=results, meta=Meta(count=total_count, page=page, per_page=page_size)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,3 +12,4 @@ class Tags(StrEnum):
|
|||||||
AUTH = "Auth"
|
AUTH = "Auth"
|
||||||
ACCOUNT = "Account"
|
ACCOUNT = "Account"
|
||||||
ORGANIZATION = "Organization"
|
ORGANIZATION = "Organization"
|
||||||
|
UNIVERSITY_RANKINGS = "University Rankings"
|
||||||
|
|||||||
@@ -4,13 +4,12 @@
|
|||||||
Business logic for OpenAlex topics.
|
Business logic for OpenAlex topics.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
import asyncio
|
||||||
import httpx
|
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
|
|
||||||
from inse.exceptions import (
|
from inse.exceptions import (
|
||||||
UpstreamAPIException,
|
UpstreamAPIException,
|
||||||
BadRequestException,
|
BadRequestException,
|
||||||
@@ -23,8 +22,8 @@ from inse.models.openalex.autocomplete_response_results_inner import (
|
|||||||
AutocompleteResponseResultsInner,
|
AutocompleteResponseResultsInner,
|
||||||
)
|
)
|
||||||
from inse.models.openalex.topics_list_response import TopicsListResponse
|
from inse.models.openalex.topics_list_response import TopicsListResponse
|
||||||
from inse.model import ESCluster
|
from inse.model import ESCluster, ESIndex
|
||||||
from .search_client import OpenAlexTopicsClient
|
from .search_client import TopicsSearchClient
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -40,15 +39,15 @@ async def list_topics(
|
|||||||
cursor: str | None = None,
|
cursor: str | None = None,
|
||||||
sample: int | None = None,
|
sample: int | None = None,
|
||||||
select: str | None = None,
|
select: str | None = None,
|
||||||
client: OpenAlexTopicsClient | None = None,
|
client: TopicsSearchClient | None = None,
|
||||||
) -> TopicsListResponse:
|
) -> TopicsListResponse:
|
||||||
if sample is not None and (sort or page not in (None, 1)):
|
if sample is not None and (sort or page not in (None, 1)):
|
||||||
raise BadRequestException("sample cannot be combined with sort or page.")
|
raise BadRequestException("sample cannot be combined with sort or page.")
|
||||||
|
|
||||||
openalex_client = client or OpenAlexTopicsClient()
|
topics_client = client or TopicsSearchClient()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = await openalex_client.list_topics(
|
data = await topics_client.list_topics(
|
||||||
search=search,
|
search=search,
|
||||||
filter=filter,
|
filter=filter,
|
||||||
sort=sort,
|
sort=sort,
|
||||||
@@ -59,25 +58,24 @@ async def list_topics(
|
|||||||
sample=sample,
|
sample=sample,
|
||||||
select=select,
|
select=select,
|
||||||
)
|
)
|
||||||
except httpx.HTTPStatusError as exc:
|
except ValueError as exc:
|
||||||
status_code = exc.response.status_code
|
raise BadRequestException(str(exc)) from exc
|
||||||
detail = "OpenAlex topics request failed."
|
except ElasticsearchException as exc:
|
||||||
try:
|
logger.exception("OpenAlex topics Elasticsearch request failed.")
|
||||||
error_body = exc.response.json()
|
|
||||||
detail = error_body.get("message") or error_body.get("error") or detail
|
|
||||||
except ValueError:
|
|
||||||
if exc.response.text:
|
|
||||||
detail = exc.response.text
|
|
||||||
raise UpstreamAPIException(message=detail, status_code=status_code) from exc
|
|
||||||
except httpx.HTTPError as exc:
|
|
||||||
logger.exception("OpenAlex topics request failed.")
|
|
||||||
raise UpstreamAPIException(
|
raise UpstreamAPIException(
|
||||||
message="OpenAlex topics request failed.",
|
message="OpenAlex topics Elasticsearch request failed.",
|
||||||
status_code=502,
|
status_code=502,
|
||||||
) from exc
|
) from exc
|
||||||
|
|
||||||
try:
|
try:
|
||||||
normalized_data = _normalize_topics_response(data)
|
openalex_style_data = _elasticsearch_to_topics_response(
|
||||||
|
data,
|
||||||
|
per_page=per_page,
|
||||||
|
page=page,
|
||||||
|
cursor=cursor,
|
||||||
|
group_by=group_by,
|
||||||
|
)
|
||||||
|
normalized_data = _normalize_topics_response(openalex_style_data)
|
||||||
return TopicsListResponse.from_dict(normalized_data) or TopicsListResponse()
|
return TopicsListResponse.from_dict(normalized_data) or TopicsListResponse()
|
||||||
except ValidationError as exc:
|
except ValidationError as exc:
|
||||||
logger.exception("OpenAlex topics response could not be parsed.")
|
logger.exception("OpenAlex topics response could not be parsed.")
|
||||||
@@ -94,7 +92,7 @@ async def autocomplete_topics(
|
|||||||
field_id: str | None = None,
|
field_id: str | None = None,
|
||||||
subfield_id: str | None = None,
|
subfield_id: str | None = None,
|
||||||
limit: int = 10,
|
limit: int = 10,
|
||||||
client: OpenAlexTopicsClient | None = None,
|
client: TopicsSearchClient | None = None,
|
||||||
) -> AutocompleteResponse:
|
) -> AutocompleteResponse:
|
||||||
filters = []
|
filters = []
|
||||||
if domain_id:
|
if domain_id:
|
||||||
@@ -153,6 +151,99 @@ async def autocomplete_topics(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _elasticsearch_to_topics_response(
|
||||||
|
data: dict[str, Any],
|
||||||
|
*,
|
||||||
|
per_page: int,
|
||||||
|
page: int | None,
|
||||||
|
cursor: str | None,
|
||||||
|
group_by: str | None,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
"""
|
||||||
|
Converts an Elasticsearch search response into the OpenAlex-style topics
|
||||||
|
response expected by TopicsListResponse.
|
||||||
|
|
||||||
|
Elasticsearch response shape:
|
||||||
|
|
||||||
|
{
|
||||||
|
"took": 12,
|
||||||
|
"hits": {
|
||||||
|
"total": {"value": 123},
|
||||||
|
"hits": [
|
||||||
|
{"_source": {...}, "sort": [...]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"aggregations": {...}
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAlex-style response shape:
|
||||||
|
|
||||||
|
{
|
||||||
|
"meta": {...},
|
||||||
|
"results": [...],
|
||||||
|
"group_by": [...]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
hits_root = data.get("hits") or {}
|
||||||
|
raw_hits = hits_root.get("hits") or []
|
||||||
|
|
||||||
|
total = hits_root.get("total")
|
||||||
|
if isinstance(total, dict):
|
||||||
|
count = total.get("value")
|
||||||
|
else:
|
||||||
|
count = total
|
||||||
|
|
||||||
|
results: list[dict[str, Any]] = []
|
||||||
|
for hit in raw_hits:
|
||||||
|
if not isinstance(hit, dict):
|
||||||
|
continue
|
||||||
|
|
||||||
|
source = hit.get("_source")
|
||||||
|
if isinstance(source, dict):
|
||||||
|
results.append(source)
|
||||||
|
|
||||||
|
groups = _extract_group_by_results(data) if group_by else []
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
"count": count,
|
||||||
|
"db_response_time_ms": data.get("took"),
|
||||||
|
"page": page if cursor is None else None,
|
||||||
|
"per_page": per_page,
|
||||||
|
"groups_count": len(groups) if group_by else None,
|
||||||
|
"next_cursor": (data.get("meta") or {}).get("next_cursor"),
|
||||||
|
"cost_usd": None,
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"meta": meta,
|
||||||
|
"results": results,
|
||||||
|
"group_by": groups,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _extract_group_by_results(data: dict[str, Any]) -> list[dict[str, Any]]:
|
||||||
|
aggregations = data.get("aggregations") or {}
|
||||||
|
group_by_agg = aggregations.get("group_by") or {}
|
||||||
|
buckets = group_by_agg.get("buckets") or []
|
||||||
|
|
||||||
|
groups: list[dict[str, Any]] = []
|
||||||
|
|
||||||
|
for bucket in buckets:
|
||||||
|
if not isinstance(bucket, dict):
|
||||||
|
continue
|
||||||
|
|
||||||
|
key = bucket.get("key")
|
||||||
|
groups.append(
|
||||||
|
{
|
||||||
|
"key": key,
|
||||||
|
"key_display_name": bucket.get("key_as_string") or key,
|
||||||
|
"count": bucket.get("doc_count"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return groups
|
||||||
|
|
||||||
|
|
||||||
def _normalize_topics_response(data: dict[str, Any]) -> dict[str, Any]:
|
def _normalize_topics_response(data: dict[str, Any]) -> dict[str, Any]:
|
||||||
normalized = deepcopy(data)
|
normalized = deepcopy(data)
|
||||||
|
|
||||||
@@ -264,7 +355,6 @@ def _datetime_str_or_none(value: Any) -> str | None:
|
|||||||
return f"{text}T00:00:00Z"
|
return f"{text}T00:00:00Z"
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
# Configuration for vector search similarity thresholds and boosts
|
# Configuration for vector search similarity thresholds and boosts
|
||||||
SIMILARITY_THRESHOLD = (
|
SIMILARITY_THRESHOLD = (
|
||||||
0.8 # intfloat/multilingual-e5-base uses cosine similarity between 0.7 - 1
|
0.8 # intfloat/multilingual-e5-base uses cosine similarity between 0.7 - 1
|
||||||
@@ -388,7 +478,7 @@ async def vector_search_topics(
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
raw_results = await elasticsearch.search(
|
raw_results = await elasticsearch.search(
|
||||||
index="topicvectors", body=body, cluster=ESCluster.NES
|
index=ESIndex.OPENALEX_TOPIC_VECTORS, body=body, cluster=ESCluster.NES
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.exception("Elasticsearch vector search failed with unexpected error.")
|
logger.exception("Elasticsearch vector search failed with unexpected error.")
|
||||||
@@ -458,7 +548,7 @@ async def vector_search_topics_batch(
|
|||||||
)
|
)
|
||||||
tasks.append(
|
tasks.append(
|
||||||
elasticsearch.search(
|
elasticsearch.search(
|
||||||
index="topicvectors", body=body, cluster=ESCluster.NES
|
index=ESIndex.OPENALEX_TOPIC_VECTORS, body=body, cluster=ESCluster.NES
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,200 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
HTTP client for OpenAlex topics.
|
Elasticsearch search client for OpenAlex topics.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import base64
|
||||||
|
import json
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import httpx
|
from inse.model import ESCluster, ESIndex
|
||||||
|
|
||||||
from .. import config
|
from .. import config
|
||||||
|
from inse.integrations.elasticsearch import search as elasticsearch_search
|
||||||
|
|
||||||
|
|
||||||
class OpenAlexTopicsClient:
|
class TopicsSearchClient:
|
||||||
|
"""
|
||||||
|
Search client for OpenAlex topics backed by Elasticsearch.
|
||||||
|
|
||||||
|
This replaces the old OpenAlex HTTP API client and uses the internal
|
||||||
|
Elasticsearch wrapper instead.
|
||||||
|
"""
|
||||||
|
|
||||||
|
DEFAULT_SEARCH_FIELDS = [
|
||||||
|
"display_name^5",
|
||||||
|
"description^3",
|
||||||
|
"keywords",
|
||||||
|
"domain.display_name^2",
|
||||||
|
"field.display_name^2",
|
||||||
|
"subfield.display_name^2",
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
base_url: str | None = None,
|
*,
|
||||||
api_key: str | None = None,
|
index: ESIndex | str | None = None,
|
||||||
timeout: float | None = None,
|
cluster: ESCluster = ESCluster.NES,
|
||||||
transport: httpx.AsyncBaseTransport | None = None,
|
|
||||||
):
|
):
|
||||||
self.base_url = (base_url or config.settings.openalex_api_base_url).rstrip("/")
|
self.index = index or self._default_index()
|
||||||
self.api_key = api_key if api_key is not None else config.settings.openalex_api_key
|
self.cluster = cluster
|
||||||
self.timeout = (
|
|
||||||
timeout
|
|
||||||
if timeout is not None
|
|
||||||
else config.settings.openalex_api_timeout_seconds
|
|
||||||
)
|
|
||||||
self.transport = transport
|
|
||||||
|
|
||||||
def list_topics_params(
|
@staticmethod
|
||||||
|
def _default_index() -> str:
|
||||||
|
"""
|
||||||
|
Resolve the OpenAlex topics index name.
|
||||||
|
|
||||||
|
Prefer a configured value if present, otherwise fall back to a sensible
|
||||||
|
default string index name.
|
||||||
|
"""
|
||||||
|
return (
|
||||||
|
ESIndex.OPENALEX_TOPICS.value
|
||||||
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _split_csv(value: str | None) -> list[str]:
|
||||||
|
if not value:
|
||||||
|
return []
|
||||||
|
return [part.strip() for part in value.split(",") if part.strip()]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _encode_cursor(sort_values: list[Any]) -> str:
|
||||||
|
raw = json.dumps(sort_values).encode("utf-8")
|
||||||
|
return base64.urlsafe_b64encode(raw).decode("ascii").rstrip("=")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _decode_cursor(cursor: str | None) -> list[Any] | None:
|
||||||
|
if not cursor or cursor == "*":
|
||||||
|
return None
|
||||||
|
|
||||||
|
padding = "=" * (-len(cursor) % 4)
|
||||||
|
raw = base64.urlsafe_b64decode(cursor + padding)
|
||||||
|
return json.loads(raw.decode("utf-8"))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse_select(select: str | None) -> list[str] | None:
|
||||||
|
fields = TopicsSearchClient._split_csv(select)
|
||||||
|
return fields or None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse_sort(sort: str | None) -> list[dict[str, Any]] | None:
|
||||||
|
"""
|
||||||
|
Parses OpenAlex-style sort syntax into Elasticsearch sort syntax.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
"works_count:desc"
|
||||||
|
"cited_by_count:desc,display_name:asc"
|
||||||
|
"-works_count"
|
||||||
|
"""
|
||||||
|
parts = TopicsSearchClient._split_csv(sort)
|
||||||
|
if not parts:
|
||||||
|
return None
|
||||||
|
|
||||||
|
parsed: list[dict[str, Any]] = []
|
||||||
|
|
||||||
|
for part in parts:
|
||||||
|
direction = "asc"
|
||||||
|
field = part
|
||||||
|
|
||||||
|
if part.startswith("-"):
|
||||||
|
direction = "desc"
|
||||||
|
field = part[1:]
|
||||||
|
elif ":" in part:
|
||||||
|
field, direction = part.split(":", 1)
|
||||||
|
field = field.strip()
|
||||||
|
direction = direction.strip().lower()
|
||||||
|
|
||||||
|
if direction not in {"asc", "desc"}:
|
||||||
|
direction = "asc"
|
||||||
|
|
||||||
|
if field in {"score", "_score", "relevance_score"}:
|
||||||
|
parsed.append({"_score": {"order": direction}})
|
||||||
|
else:
|
||||||
|
parsed.append({field: {"order": direction, "missing": "_last"}})
|
||||||
|
|
||||||
|
return parsed
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse_filter_clause(expression: str) -> tuple[dict[str, Any] | None, bool]:
|
||||||
|
"""
|
||||||
|
Parses a single simple OpenAlex-style filter expression.
|
||||||
|
|
||||||
|
Supported examples:
|
||||||
|
"works_count:>100"
|
||||||
|
"works_count:>=100"
|
||||||
|
"display_name:Physics"
|
||||||
|
"ids.openalex:T123"
|
||||||
|
"field.id:F1|F2"
|
||||||
|
"is_active:true"
|
||||||
|
"is_active:!true"
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
tuple[clause, is_negative]
|
||||||
|
"""
|
||||||
|
if ":" not in expression:
|
||||||
|
return None, False
|
||||||
|
|
||||||
|
field, value = expression.split(":", 1)
|
||||||
|
field = field.strip()
|
||||||
|
value = value.strip()
|
||||||
|
|
||||||
|
if not field or not value:
|
||||||
|
return None, False
|
||||||
|
|
||||||
|
is_negative = False
|
||||||
|
if value.startswith("!"):
|
||||||
|
is_negative = True
|
||||||
|
value = value[1:].strip()
|
||||||
|
|
||||||
|
range_ops = {
|
||||||
|
">=": "gte",
|
||||||
|
"<=": "lte",
|
||||||
|
">": "gt",
|
||||||
|
"<": "lt",
|
||||||
|
}
|
||||||
|
|
||||||
|
for prefix, op in range_ops.items():
|
||||||
|
if value.startswith(prefix):
|
||||||
|
range_value = value[len(prefix):].strip()
|
||||||
|
return {"range": {field: {op: range_value}}}, is_negative
|
||||||
|
|
||||||
|
if "|" in value:
|
||||||
|
values = [v.strip() for v in value.split("|") if v.strip()]
|
||||||
|
return {"terms": {field: values}}, is_negative
|
||||||
|
|
||||||
|
lowered = value.lower()
|
||||||
|
if lowered == "true":
|
||||||
|
typed_value: Any = True
|
||||||
|
elif lowered == "false":
|
||||||
|
typed_value = False
|
||||||
|
else:
|
||||||
|
typed_value = value
|
||||||
|
|
||||||
|
return {"term": {field: typed_value}}, is_negative
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _parse_filters(
|
||||||
|
cls,
|
||||||
|
filter: str | None,
|
||||||
|
) -> tuple[list[dict[str, Any]], list[dict[str, Any]]]:
|
||||||
|
filter_clauses: list[dict[str, Any]] = []
|
||||||
|
must_not_clauses: list[dict[str, Any]] = []
|
||||||
|
|
||||||
|
for expression in cls._split_csv(filter):
|
||||||
|
clause, is_negative = cls._parse_filter_clause(expression)
|
||||||
|
if clause is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if is_negative:
|
||||||
|
must_not_clauses.append(clause)
|
||||||
|
else:
|
||||||
|
filter_clauses.append(clause)
|
||||||
|
|
||||||
|
return filter_clauses, must_not_clauses
|
||||||
|
|
||||||
|
def build_search_body(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
search: str | None = None,
|
search: str | None = None,
|
||||||
@@ -40,28 +207,118 @@ class OpenAlexTopicsClient:
|
|||||||
sample: int | None = None,
|
sample: int | None = None,
|
||||||
select: str | None = None,
|
select: str | None = None,
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
params: dict[str, Any] = {"per_page": per_page}
|
"""
|
||||||
|
Build the Elasticsearch search body from the previous OpenAlex-style API
|
||||||
|
parameters.
|
||||||
|
"""
|
||||||
|
filter_clauses, must_not_clauses = self._parse_filters(filter)
|
||||||
|
|
||||||
|
must_clauses: list[dict[str, Any]] = []
|
||||||
|
|
||||||
if search:
|
if search:
|
||||||
params["search"] = search
|
must_clauses.append(
|
||||||
if filter:
|
{
|
||||||
params["filter"] = filter
|
"multi_match": {
|
||||||
if sort:
|
"query": search,
|
||||||
params["sort"] = sort
|
"fields": self.DEFAULT_SEARCH_FIELDS,
|
||||||
if group_by:
|
"type": "best_fields",
|
||||||
params["group_by"] = group_by
|
"operator": "and",
|
||||||
if cursor:
|
}
|
||||||
params["cursor"] = cursor
|
}
|
||||||
elif page is not None:
|
)
|
||||||
params["page"] = page
|
|
||||||
if sample is not None:
|
|
||||||
params["sample"] = sample
|
|
||||||
if select:
|
|
||||||
params["select"] = select
|
|
||||||
if self.api_key:
|
|
||||||
params["api_key"] = self.api_key
|
|
||||||
|
|
||||||
return params
|
if must_clauses or filter_clauses or must_not_clauses:
|
||||||
|
query: dict[str, Any] = {
|
||||||
|
"bool": {
|
||||||
|
"must": must_clauses or [{"match_all": {}}],
|
||||||
|
"filter": filter_clauses,
|
||||||
|
"must_not": must_not_clauses,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
query = {"match_all": {}}
|
||||||
|
|
||||||
|
if sample is not None:
|
||||||
|
query = {
|
||||||
|
"function_score": {
|
||||||
|
"query": query,
|
||||||
|
"random_score": {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size = sample if sample is not None else per_page
|
||||||
|
|
||||||
|
body: dict[str, Any] = {
|
||||||
|
"query": query,
|
||||||
|
"size": size,
|
||||||
|
"track_total_hits": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
source = self._parse_select(select)
|
||||||
|
if source is not None:
|
||||||
|
body["_source"] = source
|
||||||
|
|
||||||
|
sort_clause = self._parse_sort(sort)
|
||||||
|
if sort_clause is not None:
|
||||||
|
body["sort"] = sort_clause
|
||||||
|
|
||||||
|
search_after = self._decode_cursor(cursor)
|
||||||
|
if search_after is not None:
|
||||||
|
body["search_after"] = search_after
|
||||||
|
elif cursor is None and page is not None:
|
||||||
|
body["from"] = max(page - 1, 0) * per_page
|
||||||
|
|
||||||
|
if group_by:
|
||||||
|
body["size"] = 0
|
||||||
|
body["aggs"] = {
|
||||||
|
"group_by": {
|
||||||
|
"terms": {
|
||||||
|
"field": group_by,
|
||||||
|
"size": per_page,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return body
|
||||||
|
|
||||||
|
async def search_topics(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
search: str | None = None,
|
||||||
|
filter: str | None = None,
|
||||||
|
sort: str | None = None,
|
||||||
|
group_by: str | None = None,
|
||||||
|
per_page: int = 25,
|
||||||
|
page: int | None = 1,
|
||||||
|
cursor: str | None = None,
|
||||||
|
sample: int | None = None,
|
||||||
|
select: str | None = None,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
body = self.build_search_body(
|
||||||
|
search=search,
|
||||||
|
filter=filter,
|
||||||
|
sort=sort,
|
||||||
|
group_by=group_by,
|
||||||
|
per_page=per_page,
|
||||||
|
page=page,
|
||||||
|
cursor=cursor,
|
||||||
|
sample=sample,
|
||||||
|
select=select,
|
||||||
|
)
|
||||||
|
|
||||||
|
result = await elasticsearch_search(
|
||||||
|
index=self.index,
|
||||||
|
body=body,
|
||||||
|
cluster=self.cluster,
|
||||||
|
)
|
||||||
|
|
||||||
|
hits = result.get("hits", {}).get("hits", [])
|
||||||
|
if hits:
|
||||||
|
last_sort = hits[-1].get("sort")
|
||||||
|
if last_sort is not None:
|
||||||
|
result.setdefault("meta", {})["next_cursor"] = self._encode_cursor(last_sort)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
async def list_topics(
|
async def list_topics(
|
||||||
self,
|
self,
|
||||||
@@ -76,24 +333,17 @@ class OpenAlexTopicsClient:
|
|||||||
sample: int | None = None,
|
sample: int | None = None,
|
||||||
select: str | None = None,
|
select: str | None = None,
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
async with httpx.AsyncClient(
|
"""
|
||||||
base_url=self.base_url,
|
Backwards-compatible alias for the old OpenAlex client method name.
|
||||||
timeout=self.timeout,
|
"""
|
||||||
transport=self.transport,
|
return await self.search_topics(
|
||||||
) as client:
|
search=search,
|
||||||
response = await client.get(
|
filter=filter,
|
||||||
"/topics",
|
sort=sort,
|
||||||
params=self.list_topics_params(
|
group_by=group_by,
|
||||||
search=search,
|
per_page=per_page,
|
||||||
filter=filter,
|
page=page,
|
||||||
sort=sort,
|
cursor=cursor,
|
||||||
group_by=group_by,
|
sample=sample,
|
||||||
per_page=per_page,
|
select=select,
|
||||||
page=page,
|
)
|
||||||
cursor=cursor,
|
|
||||||
sample=sample,
|
|
||||||
select=select,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
response.raise_for_status()
|
|
||||||
return response.json()
|
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
import httpx
|
|
||||||
import pytest
|
import pytest
|
||||||
from inse.exceptions import BadRequestException
|
|
||||||
|
|
||||||
|
from inse.exceptions import BadRequestException
|
||||||
from inse.topics import logic
|
from inse.topics import logic
|
||||||
from inse.topics.search_client import OpenAlexTopicsClient
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@@ -11,108 +9,144 @@ def anyio_backend():
|
|||||||
return "asyncio"
|
return "asyncio"
|
||||||
|
|
||||||
|
|
||||||
|
class FakeTopicsSearchClient:
|
||||||
|
def __init__(self, response: dict):
|
||||||
|
self.response = response
|
||||||
|
self.calls: list[dict] = []
|
||||||
|
|
||||||
|
async def list_topics(self, **kwargs):
|
||||||
|
self.calls.append(kwargs)
|
||||||
|
return self.response
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_list_topics_maps_openalex_response_to_model():
|
async def test_list_topics_maps_elasticsearch_response_to_model():
|
||||||
def handler(_: httpx.Request) -> httpx.Response:
|
client = FakeTopicsSearchClient(
|
||||||
return httpx.Response(
|
{
|
||||||
200,
|
"took": 12,
|
||||||
json={
|
"hits": {
|
||||||
"meta": {"count": 1, "page": 1, "per_page": 25},
|
"total": {"value": 1, "relation": "eq"},
|
||||||
"results": [
|
"hits": [
|
||||||
{
|
{
|
||||||
"id": "https://openalex.org/T12419",
|
"_id": "https://openalex.org/T12419",
|
||||||
"display_name": "Machine learning",
|
"_source": {
|
||||||
"description": "Methods that learn from data.",
|
"id": "https://openalex.org/T12419",
|
||||||
"keywords": ["machine learning", "classification"],
|
"display_name": "Machine learning",
|
||||||
"subfield": {
|
"description": "Methods that learn from data.",
|
||||||
"id": "https://openalex.org/subfields/1702",
|
"keywords": ["machine learning", "classification"],
|
||||||
"display_name": "Artificial Intelligence",
|
"subfield": {
|
||||||
|
"id": "https://openalex.org/subfields/1702",
|
||||||
|
"display_name": "Artificial Intelligence",
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"id": "https://openalex.org/fields/17",
|
||||||
|
"display_name": "Computer Science",
|
||||||
|
},
|
||||||
|
"domain": {
|
||||||
|
"id": "https://openalex.org/domains/4",
|
||||||
|
"display_name": "Physical Sciences",
|
||||||
|
},
|
||||||
|
"works_count": 123,
|
||||||
|
"cited_by_count": 456,
|
||||||
|
"ids": {
|
||||||
|
"openalex": "https://openalex.org/T12419",
|
||||||
|
"wikipedia": "https://en.wikipedia.org/wiki/Machine_learning",
|
||||||
|
},
|
||||||
|
"works_api_url": (
|
||||||
|
"https://api.openalex.org/works?"
|
||||||
|
"filter=topics.id:T12419"
|
||||||
|
),
|
||||||
|
"created_date": "2023-12-25",
|
||||||
|
"updated_date": "2023-11-07T05:31:56Z",
|
||||||
},
|
},
|
||||||
"field": {
|
|
||||||
"id": "https://openalex.org/fields/17",
|
|
||||||
"display_name": "Computer Science",
|
|
||||||
},
|
|
||||||
"domain": {
|
|
||||||
"id": "https://openalex.org/domains/4",
|
|
||||||
"display_name": "Physical Sciences",
|
|
||||||
},
|
|
||||||
"works_count": 123,
|
|
||||||
"cited_by_count": 456,
|
|
||||||
"ids": {
|
|
||||||
"openalex": "https://openalex.org/T12419",
|
|
||||||
"wikipedia": "https://en.wikipedia.org/wiki/Machine_learning",
|
|
||||||
},
|
|
||||||
"works_api_url": "https://api.openalex.org/works?filter=topics.id:T12419",
|
|
||||||
"created_date": "2023-12-25",
|
|
||||||
"updated_date": "2023-11-07T05:31:56Z",
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"group_by": [
|
|
||||||
{
|
|
||||||
"key": "https://openalex.org/domains/4",
|
|
||||||
"key_display_name": "Physical Sciences",
|
|
||||||
"count": 1,
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
)
|
"aggregations": {
|
||||||
|
"group_by": {
|
||||||
client = OpenAlexTopicsClient(
|
"buckets": [
|
||||||
api_key="test-key",
|
{
|
||||||
transport=httpx.MockTransport(handler),
|
"key": "https://openalex.org/domains/4",
|
||||||
|
"key_as_string": "Physical Sciences",
|
||||||
|
"doc_count": 1,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
result = await logic.list_topics(search="machine learning", client=client)
|
result = await logic.list_topics(
|
||||||
|
search="machine learning",
|
||||||
|
group_by="domain.id",
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert client.calls[0]["search"] == "machine learning"
|
||||||
|
assert client.calls[0]["group_by"] == "domain.id"
|
||||||
|
|
||||||
assert result.meta.count == 1
|
assert result.meta.count == 1
|
||||||
|
assert result.meta.db_response_time_ms == 12
|
||||||
|
|
||||||
topic = result.results[0]
|
topic = result.results[0]
|
||||||
assert topic.display_name == "Machine learning"
|
assert topic.display_name == "Machine learning"
|
||||||
assert topic.var_field.display_name == "Computer Science"
|
assert topic.var_field.display_name == "Computer Science"
|
||||||
assert topic.subfield.display_name == "Artificial Intelligence"
|
assert topic.subfield.display_name == "Artificial Intelligence"
|
||||||
assert topic.domain.display_name == "Physical Sciences"
|
assert topic.domain.display_name == "Physical Sciences"
|
||||||
assert topic.ids.openalex == "https://openalex.org/T12419"
|
assert topic.ids.openalex == "https://openalex.org/T12419"
|
||||||
|
|
||||||
|
assert result.group_by[0].key == "https://openalex.org/domains/4"
|
||||||
assert result.group_by[0].key_display_name == "Physical Sciences"
|
assert result.group_by[0].key_display_name == "Physical Sciences"
|
||||||
|
assert result.group_by[0].count == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_list_topics_rejects_sample_with_sort():
|
async def test_list_topics_rejects_sample_with_sort():
|
||||||
with pytest.raises(BadRequestException) as exc_info:
|
with pytest.raises(BadRequestException):
|
||||||
await logic.list_topics(sample=10, sort="works_count:desc")
|
await logic.list_topics(sample=10, sort="works_count:desc")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_list_topics_accepts_practical_openalex_type_variants():
|
async def test_list_topics_accepts_practical_openalex_type_variants():
|
||||||
def handler(_: httpx.Request) -> httpx.Response:
|
client = FakeTopicsSearchClient(
|
||||||
return httpx.Response(
|
{
|
||||||
200,
|
"took": "10",
|
||||||
json={
|
"hits": {
|
||||||
"meta": {"count": "1", "page": "1", "per_page": "25"},
|
"total": {"value": "1", "relation": "eq"},
|
||||||
"results": [
|
"hits": [
|
||||||
{
|
{
|
||||||
"id": 123,
|
"_id": "123",
|
||||||
"display_name": 456,
|
"_source": {
|
||||||
"description": True,
|
"id": 123,
|
||||||
"keywords": ["topic", 123],
|
"display_name": 456,
|
||||||
"subfield": {"id": 1, "display_name": 2},
|
"description": True,
|
||||||
"field": {"id": 3, "display_name": 4},
|
"keywords": ["topic", 123],
|
||||||
"domain": {"id": 5, "display_name": 6},
|
"subfield": {"id": 1, "display_name": 2},
|
||||||
"works_count": "12.0",
|
"field": {"id": 3, "display_name": 4},
|
||||||
"cited_by_count": False,
|
"domain": {"id": 5, "display_name": 6},
|
||||||
"ids": {"openalex": 123, "wikipedia": 456},
|
"works_count": "12.0",
|
||||||
"created_date": "2023-12-25T10:11:12Z",
|
"cited_by_count": False,
|
||||||
"updated_date": "2023-12-25",
|
"ids": {"openalex": 123, "wikipedia": 456},
|
||||||
|
"created_date": "2023-12-25T10:11:12Z",
|
||||||
|
"updated_date": "2023-12-25",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"group_by": [{"key": True, "count": "1"}],
|
|
||||||
},
|
},
|
||||||
)
|
"aggregations": {
|
||||||
|
"group_by": {
|
||||||
client = OpenAlexTopicsClient(
|
"buckets": [
|
||||||
api_key="test-key",
|
{
|
||||||
transport=httpx.MockTransport(handler),
|
"key": True,
|
||||||
|
"doc_count": "1",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
result = await logic.list_topics(client=client)
|
result = await logic.list_topics(group_by="domain.id", client=client)
|
||||||
|
|
||||||
topic = result.results[0]
|
topic = result.results[0]
|
||||||
assert topic.id == "123"
|
assert topic.id == "123"
|
||||||
@@ -131,42 +165,33 @@ async def test_list_topics_accepts_practical_openalex_type_variants():
|
|||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_autocomplete_topics_returns_frontend_options():
|
async def test_autocomplete_topics_returns_frontend_options():
|
||||||
def handler(request: httpx.Request) -> httpx.Response:
|
client = FakeTopicsSearchClient(
|
||||||
assert request.url.params["search"] == "machine learning"
|
{
|
||||||
assert request.url.params["filter"] == (
|
"took": 12,
|
||||||
"domain.id:https://openalex.org/domains/4,"
|
"hits": {
|
||||||
"field.id:https://openalex.org/fields/17,"
|
"total": {"value": 1, "relation": "eq"},
|
||||||
"subfield.id:https://openalex.org/subfields/1702"
|
"hits": [
|
||||||
)
|
|
||||||
assert request.url.params["sort"] == "works_count:desc"
|
|
||||||
assert request.url.params["per_page"] == "5"
|
|
||||||
assert request.url.params["select"] == (
|
|
||||||
"id,display_name,description,keywords,subfield,field,domain,"
|
|
||||||
"works_count,cited_by_count,ids"
|
|
||||||
)
|
|
||||||
return httpx.Response(
|
|
||||||
200,
|
|
||||||
json={
|
|
||||||
"meta": {"count": 1, "db_response_time_ms": 12},
|
|
||||||
"results": [
|
|
||||||
{
|
{
|
||||||
"id": "https://openalex.org/T12419",
|
"_id": "https://openalex.org/T12419",
|
||||||
"display_name": "Machine learning",
|
"_source": {
|
||||||
"description": "Methods that learn from data.",
|
"id": "https://openalex.org/T12419",
|
||||||
"field": {"display_name": "Computer Science"},
|
"display_name": "Machine learning",
|
||||||
"subfield": {"display_name": "Artificial Intelligence"},
|
"description": "Methods that learn from data.",
|
||||||
"domain": {"display_name": "Physical Sciences"},
|
"field": {"display_name": "Computer Science"},
|
||||||
"works_count": 123,
|
"subfield": {
|
||||||
"cited_by_count": 456,
|
"display_name": "Artificial Intelligence",
|
||||||
"ids": {"openalex": "https://openalex.org/T12419"},
|
},
|
||||||
|
"domain": {"display_name": "Physical Sciences"},
|
||||||
|
"works_count": 123,
|
||||||
|
"cited_by_count": 456,
|
||||||
|
"ids": {
|
||||||
|
"openalex": "https://openalex.org/T12419",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
)
|
}
|
||||||
|
|
||||||
client = OpenAlexTopicsClient(
|
|
||||||
api_key="test-key",
|
|
||||||
transport=httpx.MockTransport(handler),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
result = await logic.autocomplete_topics(
|
result = await logic.autocomplete_topics(
|
||||||
@@ -178,9 +203,24 @@ async def test_autocomplete_topics_returns_frontend_options():
|
|||||||
client=client,
|
client=client,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
assert client.calls[0]["search"] == "machine learning"
|
||||||
|
assert client.calls[0]["filter"] == (
|
||||||
|
"domain.id:https://openalex.org/domains/4,"
|
||||||
|
"field.id:https://openalex.org/fields/17,"
|
||||||
|
"subfield.id:https://openalex.org/subfields/1702"
|
||||||
|
)
|
||||||
|
assert client.calls[0]["sort"] == "works_count:desc"
|
||||||
|
assert client.calls[0]["per_page"] == 5
|
||||||
|
assert client.calls[0]["page"] == 1
|
||||||
|
assert client.calls[0]["select"] == (
|
||||||
|
"id,display_name,description,keywords,subfield,field,domain,"
|
||||||
|
"works_count,cited_by_count,ids"
|
||||||
|
)
|
||||||
|
|
||||||
assert result.meta.count == 1
|
assert result.meta.count == 1
|
||||||
assert result.meta.db_response_time_ms == 12
|
assert result.meta.db_response_time_ms == 12
|
||||||
assert len(result.results) == 1
|
assert len(result.results) == 1
|
||||||
|
|
||||||
option = result.results[0]
|
option = result.results[0]
|
||||||
assert option.id == "https://openalex.org/T12419"
|
assert option.id == "https://openalex.org/T12419"
|
||||||
assert option.display_name == "Machine learning"
|
assert option.display_name == "Machine learning"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import httpx
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from inse.topics.search_client import OpenAlexTopicsClient
|
from inse.model import ESCluster, ESIndex
|
||||||
|
from inse.topics.search_client import TopicsSearchClient
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@@ -9,10 +9,10 @@ def anyio_backend():
|
|||||||
return "asyncio"
|
return "asyncio"
|
||||||
|
|
||||||
|
|
||||||
def test_list_topics_params_include_openalex_query_parameters():
|
def test_build_search_body_includes_openalex_query_parameters():
|
||||||
client = OpenAlexTopicsClient(api_key="test-key")
|
client = TopicsSearchClient(index=ESIndex.OPENALEX_TOPICS, cluster=ESCluster.NES)
|
||||||
|
|
||||||
params = client.list_topics_params(
|
body = client.build_search_body(
|
||||||
search="machine learning",
|
search="machine learning",
|
||||||
filter="domain.id:4,works_count:>1000",
|
filter="domain.id:4,works_count:>1000",
|
||||||
sort="works_count:desc",
|
sort="works_count:desc",
|
||||||
@@ -22,54 +22,128 @@ def test_list_topics_params_include_openalex_query_parameters():
|
|||||||
select="id,display_name",
|
select="id,display_name",
|
||||||
)
|
)
|
||||||
|
|
||||||
assert params == {
|
assert body["query"] == {
|
||||||
"search": "machine learning",
|
"bool": {
|
||||||
"filter": "domain.id:4,works_count:>1000",
|
"must": [
|
||||||
"sort": "works_count:desc",
|
{
|
||||||
"group_by": "domain.id",
|
"multi_match": {
|
||||||
"per_page": 10,
|
"query": "machine learning",
|
||||||
"page": 2,
|
"fields": client.DEFAULT_SEARCH_FIELDS,
|
||||||
"select": "id,display_name",
|
"type": "best_fields",
|
||||||
"api_key": "test-key",
|
"operator": "and",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filter": [
|
||||||
|
{"term": {"domain.id": "4"}},
|
||||||
|
{"range": {"works_count": {"gt": "1000"}}},
|
||||||
|
],
|
||||||
|
"must_not": [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert body["_source"] == ["id", "display_name"]
|
||||||
|
assert body["sort"] == [
|
||||||
|
{"works_count": {"order": "desc", "missing": "_last"}}
|
||||||
|
]
|
||||||
|
|
||||||
|
# group_by queries use aggregations and no regular hits
|
||||||
|
assert body["size"] == 0
|
||||||
|
assert body["from"] == 10
|
||||||
|
assert body["track_total_hits"] is True
|
||||||
|
assert body["aggs"] == {
|
||||||
|
"group_by": {
|
||||||
|
"terms": {
|
||||||
|
"field": "domain.id",
|
||||||
|
"size": 10,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_list_topics_params_prefers_cursor_over_page():
|
def test_build_search_body_prefers_cursor_over_page():
|
||||||
client = OpenAlexTopicsClient(api_key="test-key")
|
client = TopicsSearchClient(index=ESIndex.OPENALEX_TOPICS, cluster=ESCluster.NES)
|
||||||
|
|
||||||
params = client.list_topics_params(cursor="*", page=3)
|
cursor = client._encode_cursor(["Machine learning", "https://openalex.org/T12419"])
|
||||||
|
|
||||||
assert params["cursor"] == "*"
|
body = client.build_search_body(
|
||||||
assert "page" not in params
|
cursor=cursor,
|
||||||
|
page=3,
|
||||||
|
per_page=25,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert body["search_after"] == [
|
||||||
|
"Machine learning",
|
||||||
|
"https://openalex.org/T12419",
|
||||||
|
]
|
||||||
|
assert "from" not in body
|
||||||
|
|
||||||
|
|
||||||
|
def test_build_search_body_with_plain_cursor_star_does_not_use_page_offset():
|
||||||
|
client = TopicsSearchClient(index=ESIndex.OPENALEX_TOPICS, cluster=ESCluster.NES)
|
||||||
|
|
||||||
|
body = client.build_search_body(
|
||||||
|
cursor="*",
|
||||||
|
page=3,
|
||||||
|
per_page=25,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert "search_after" not in body
|
||||||
|
assert "from" not in body
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_list_topics_calls_openalex_topics_endpoint():
|
async def test_list_topics_calls_elasticsearch_search_wrapper(monkeypatch):
|
||||||
def handler(request: httpx.Request) -> httpx.Response:
|
captured = {}
|
||||||
assert request.method == "GET"
|
|
||||||
assert request.url.path == "/topics"
|
async def fake_elasticsearch_search(*, index, body, cluster):
|
||||||
assert request.url.params["search"] == "machine learning"
|
captured["index"] = index
|
||||||
assert request.url.params["api_key"] == "test-key"
|
captured["body"] = body
|
||||||
return httpx.Response(
|
captured["cluster"] = cluster
|
||||||
200,
|
|
||||||
json={
|
return {
|
||||||
"meta": {"count": 1, "page": 1, "per_page": 25},
|
"took": 3,
|
||||||
"results": [
|
"hits": {
|
||||||
|
"total": {"value": 1, "relation": "eq"},
|
||||||
|
"hits": [
|
||||||
{
|
{
|
||||||
"id": "https://openalex.org/T12419",
|
"_id": "https://openalex.org/T12419",
|
||||||
"display_name": "Machine learning",
|
"_source": {
|
||||||
|
"id": "https://openalex.org/T12419",
|
||||||
|
"display_name": "Machine learning",
|
||||||
|
},
|
||||||
|
"sort": [1000, "https://openalex.org/T12419"],
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
)
|
}
|
||||||
|
|
||||||
client = OpenAlexTopicsClient(
|
monkeypatch.setattr(
|
||||||
base_url="https://api.openalex.org",
|
"inse.topics.search_client.elasticsearch_search",
|
||||||
api_key="test-key",
|
fake_elasticsearch_search,
|
||||||
transport=httpx.MockTransport(handler),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
client = TopicsSearchClient(index=ESIndex.OPENALEX_TOPICS, cluster=ESCluster.NES)
|
||||||
|
|
||||||
result = await client.list_topics(search="machine learning")
|
result = await client.list_topics(search="machine learning")
|
||||||
|
|
||||||
assert result["meta"]["count"] == 1
|
assert captured["index"] == ESIndex.OPENALEX_TOPICS
|
||||||
assert result["results"][0]["display_name"] == "Machine learning"
|
assert captured["cluster"] == ESCluster.NES
|
||||||
|
|
||||||
|
assert captured["body"]["query"]["bool"]["must"] == [
|
||||||
|
{
|
||||||
|
"multi_match": {
|
||||||
|
"query": "machine learning",
|
||||||
|
"fields": client.DEFAULT_SEARCH_FIELDS,
|
||||||
|
"type": "best_fields",
|
||||||
|
"operator": "and",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
assert captured["body"]["size"] == 25
|
||||||
|
assert captured["body"]["from"] == 0
|
||||||
|
assert captured["body"]["track_total_hits"] is True
|
||||||
|
|
||||||
|
assert result["hits"]["total"]["value"] == 1
|
||||||
|
assert result["hits"]["hits"][0]["_source"]["display_name"] == "Machine learning"
|
||||||
|
assert result["meta"]["next_cursor"] is not None
|
||||||
@@ -1,65 +1,228 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import datetime
|
||||||
from typing import List, Dict, Any
|
from typing import List, Dict, Any
|
||||||
from .model import UniversityTopicData, YearlyData, UniversityRanking, ResearchTopic, DashboardMetric, RankingResponse
|
from .model import UniversityTopicData, YearlyData, UniversityRanking, DashboardMetric, RankingResponse
|
||||||
from inse.integrations import elasticsearch
|
from inse.integrations import elasticsearch
|
||||||
|
from inse.models.openalex.topic import Topic
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
START_YEAR = 2015
|
START_YEAR = 2000
|
||||||
END_YEAR = 2026
|
END_YEAR = datetime.datetime.now().year - 1
|
||||||
|
|
||||||
async def get_ranking_data(topic: ResearchTopic, metric: DashboardMetric) -> RankingResponse:
|
async def resolve_topic(topic_query: str) -> Topic:
|
||||||
|
"""Resolves a topic display name or ID using Elasticsearch with source whitelisting."""
|
||||||
|
if topic_query.startswith("https://openalex.org/"):
|
||||||
|
query = {"term": {"id": topic_query}}
|
||||||
|
else:
|
||||||
|
query = {"match_phrase": {"display_name": topic_query}}
|
||||||
|
|
||||||
|
try:
|
||||||
|
res = await elasticsearch.search(
|
||||||
|
index="openalex-topics",
|
||||||
|
query=query,
|
||||||
|
size=1,
|
||||||
|
source=["id", "display_name", "description", "works_count", "cited_by_count"],
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
hits = res.get("hits", {}).get("hits", [])
|
||||||
|
if hits:
|
||||||
|
return Topic.from_dict(hits[0]["_source"])
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Failed to resolve topic in ES: %s", e)
|
||||||
|
|
||||||
|
return Topic(display_name=topic_query)
|
||||||
|
|
||||||
|
async def get_ranking_data(topic_query: str, metric: DashboardMetric) -> RankingResponse:
|
||||||
"""
|
"""
|
||||||
Fetches real data from Elasticsearch and computes metrics for the dashboard.
|
Fetches real data from Elasticsearch and computes metrics for the dashboard.
|
||||||
"""
|
"""
|
||||||
|
topic_obj = await resolve_topic(topic_query)
|
||||||
|
topic_name = topic_obj.display_name or topic_query
|
||||||
|
|
||||||
|
if topic_obj.id:
|
||||||
|
topic_filter = {"term": {"topics.id.keyword": topic_obj.id}}
|
||||||
|
else:
|
||||||
|
topic_filter = {"match_phrase": {"topics.display_name": topic_name}}
|
||||||
|
|
||||||
query = {
|
query = {
|
||||||
"bool": {
|
"bool": {
|
||||||
"must": [
|
"filter": [
|
||||||
{
|
{"term": {"type": "education"}},
|
||||||
"match_phrase": {
|
{"term": {"geo.country_code": "DE"}},
|
||||||
"topics.display_name": topic
|
topic_filter
|
||||||
}
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"term": {
|
|
||||||
"geo.country_code": "DE"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Fetch top institutions for the topic by works_count
|
|
||||||
res = await elasticsearch.search(
|
res = await elasticsearch.search(
|
||||||
index="openalex-institutions",
|
index="openalex-institutions",
|
||||||
query=query,
|
query=query,
|
||||||
size=10,
|
size=50,
|
||||||
sort=[{"works_count": "desc"}],
|
source=["id", "display_name", "topics"],
|
||||||
cluster="nes"
|
cluster="nes"
|
||||||
)
|
)
|
||||||
|
|
||||||
hits = res.get("hits", {}).get("hits", [])
|
hits = res.get("hits", {}).get("hits", [])
|
||||||
timeseries: List[UniversityTopicData] = []
|
candidates = []
|
||||||
|
|
||||||
for hit in hits:
|
for hit in hits:
|
||||||
source = hit["_source"]
|
source = hit["_source"]
|
||||||
# Map the counts_by_year from ES to our model
|
inst_id = source.get("id")
|
||||||
# We ensure every year from START_YEAR to END_YEAR is present, defaulting to 0
|
display_name = source.get("display_name", "Unknown")
|
||||||
es_counts = {c["year"]: c for c in source.get("counts_by_year", [])}
|
|
||||||
|
|
||||||
|
# Extract topic-specific works count
|
||||||
|
exact_topic_count = 0
|
||||||
|
for t in source.get("topics", []):
|
||||||
|
if t.get("display_name", "").lower() == topic_name.lower():
|
||||||
|
exact_topic_count = t.get("count", 0)
|
||||||
|
break
|
||||||
|
|
||||||
|
candidates.append({
|
||||||
|
"id": inst_id,
|
||||||
|
"display_name": display_name,
|
||||||
|
"exact_topic_count": exact_topic_count
|
||||||
|
})
|
||||||
|
|
||||||
|
# Sort in Python by exact topic count descending and take the top 10
|
||||||
|
candidates.sort(key=lambda x: x["exact_topic_count"], reverse=True)
|
||||||
|
top_10 = candidates[:10]
|
||||||
|
|
||||||
|
# Initialize timeseries map: inst_id -> year -> (publications, citations)
|
||||||
|
years_range = list(range(START_YEAR, END_YEAR + 1))
|
||||||
|
accumulated_data = {
|
||||||
|
inst["id"]: {yr: (0, 0) for yr in years_range}
|
||||||
|
for inst in top_10
|
||||||
|
}
|
||||||
|
|
||||||
|
if top_10:
|
||||||
|
# Build filter map for the single-pass aggregation query
|
||||||
|
filters_map = {}
|
||||||
|
for inst in top_10:
|
||||||
|
inst_id = inst["id"]
|
||||||
|
filters_map[inst_id] = {
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships.institutions",
|
||||||
|
"query": {
|
||||||
|
"term": {
|
||||||
|
"authorships.institutions.id": inst_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Topic filter clause (using topic ID if resolved, otherwise matching display name keyword)
|
||||||
|
topic_id = topic_obj.id
|
||||||
|
if topic_id:
|
||||||
|
topic_clause = {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"nested": {"path": "topics", "query": {"term": {"topics.id": topic_id}}}},
|
||||||
|
{"term": {"primary_topic.id": topic_id}}
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
topic_clause = {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"nested": {"path": "topics", "query": {"match_phrase": {"topics.display_name": topic_name}}}},
|
||||||
|
{"match_phrase": {"primary_topic.display_name": topic_name}}
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Construct single-pass ES query on openalex-works in Filter Context
|
||||||
|
works_query = {
|
||||||
|
"bool": {
|
||||||
|
"filter": [
|
||||||
|
{
|
||||||
|
"range": {
|
||||||
|
"publication_year": {
|
||||||
|
"gte": START_YEAR,
|
||||||
|
"lte": END_YEAR
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
topic_clause,
|
||||||
|
{
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships.institutions",
|
||||||
|
"query": {
|
||||||
|
"terms": {
|
||||||
|
"authorships.institutions.id": [inst["id"] for inst in top_10]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aggregations = {
|
||||||
|
"institutions_agg": {
|
||||||
|
"filters": {
|
||||||
|
"filters": filters_map
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"by_year": {
|
||||||
|
"terms": {
|
||||||
|
"field": "publication_year",
|
||||||
|
"size": len(years_range) * 2
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"citations_sum": {
|
||||||
|
"sum": {
|
||||||
|
"field": "cited_by_count"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
works_res = await elasticsearch.search(
|
||||||
|
index="openalex-works*",
|
||||||
|
query=works_query,
|
||||||
|
body={"aggs": aggregations},
|
||||||
|
size=0,
|
||||||
|
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
|
||||||
|
inst_buckets = works_res.get("aggregations", {}).get("institutions_agg", {}).get("buckets", {})
|
||||||
|
for inst_id, inst_bucket in inst_buckets.items():
|
||||||
|
year_buckets = inst_bucket.get("by_year", {}).get("buckets", [])
|
||||||
|
for yr_bucket in year_buckets:
|
||||||
|
yr = int(yr_bucket.get("key"))
|
||||||
|
pubs = int(yr_bucket.get("doc_count", 0))
|
||||||
|
cits = int(yr_bucket.get("citations_sum", {}).get("value", 0))
|
||||||
|
if yr in years_range:
|
||||||
|
accumulated_data[inst_id][yr] = (pubs, cits)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("Error executing ranking aggregations on openalex-works: %s", e)
|
||||||
|
|
||||||
|
# Map the accumulated results back into the timeseries response model
|
||||||
|
timeseries: List[UniversityTopicData] = []
|
||||||
|
inst_name_map = {inst["id"]: inst["display_name"] for inst in top_10}
|
||||||
|
|
||||||
|
for inst_id, year_dict in accumulated_data.items():
|
||||||
yearly_data = []
|
yearly_data = []
|
||||||
for year in range(START_YEAR, END_YEAR + 1):
|
for yr in years_range:
|
||||||
count_item = es_counts.get(year, {})
|
pubs, cits = year_dict[yr]
|
||||||
yearly_data.append(YearlyData(
|
yearly_data.append(YearlyData(
|
||||||
year=year,
|
year=yr,
|
||||||
publications=count_item.get("works_count", 0),
|
publications=pubs,
|
||||||
citations=count_item.get("cited_by_count", 0)
|
citations=cits
|
||||||
))
|
))
|
||||||
|
|
||||||
timeseries.append(UniversityTopicData(
|
timeseries.append(UniversityTopicData(
|
||||||
university=source.get("display_name", "Unknown"),
|
university=inst_name_map[inst_id],
|
||||||
topic=topic,
|
topic=topic_obj,
|
||||||
yearly_data=yearly_data
|
yearly_data=yearly_data
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from typing import List, Literal
|
from typing import List, Literal, Dict, Optional
|
||||||
|
from inse.models.openalex.topic import Topic
|
||||||
|
|
||||||
ResearchTopic = Literal['Artificial Intelligence', 'Quantum Computing', 'Renewable Energy', 'Biotechnology']
|
|
||||||
DashboardMetric = Literal['publications', 'citations']
|
DashboardMetric = Literal['publications', 'citations']
|
||||||
|
|
||||||
class YearlyData(BaseModel):
|
class YearlyData(BaseModel):
|
||||||
@@ -11,7 +11,7 @@ class YearlyData(BaseModel):
|
|||||||
|
|
||||||
class UniversityTopicData(BaseModel):
|
class UniversityTopicData(BaseModel):
|
||||||
university: str
|
university: str
|
||||||
topic: ResearchTopic
|
topic: Topic
|
||||||
yearly_data: List[YearlyData]
|
yearly_data: List[YearlyData]
|
||||||
|
|
||||||
class UniversityRanking(BaseModel):
|
class UniversityRanking(BaseModel):
|
||||||
@@ -28,3 +28,36 @@ class RankingResponse(BaseModel):
|
|||||||
timeseries: List[UniversityTopicData]
|
timeseries: List[UniversityTopicData]
|
||||||
# Computed metrics for the ranking table
|
# Computed metrics for the ranking table
|
||||||
rankings: List[UniversityRanking]
|
rankings: List[UniversityRanking]
|
||||||
|
|
||||||
|
# Trend Analysis Models
|
||||||
|
class TopicYearlyData(BaseModel):
|
||||||
|
year: int
|
||||||
|
raw: int
|
||||||
|
normalized: float
|
||||||
|
cumulative: float
|
||||||
|
institutions_count: int
|
||||||
|
|
||||||
|
class TrendSeries(BaseModel):
|
||||||
|
entity_id: str
|
||||||
|
entity_name: str
|
||||||
|
entity_type: Literal['institution', 'country', 'region']
|
||||||
|
country_code: Optional[str] = None
|
||||||
|
# Map topic display name to its yearly data
|
||||||
|
topic_data: Dict[str, List[TopicYearlyData]]
|
||||||
|
|
||||||
|
class TrendResponse(BaseModel):
|
||||||
|
series: List[TrendSeries]
|
||||||
|
years: List[int]
|
||||||
|
location_mappings: Optional[Dict[str, List[str]]] = None
|
||||||
|
|
||||||
|
from inse.models.openalex.dehydrated_institution import DehydratedInstitution
|
||||||
|
|
||||||
|
class TopInstitutionItem(DehydratedInstitution):
|
||||||
|
works_count: Optional[int] = None
|
||||||
|
exact_topic_count: Optional[int] = None
|
||||||
|
|
||||||
|
class AutocompleteLocationItem(BaseModel):
|
||||||
|
id: str
|
||||||
|
display_name: str
|
||||||
|
code: str
|
||||||
|
type: Literal['country', 'continent']
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
from fastapi import APIRouter, Query
|
|
||||||
from . import service
|
|
||||||
from .model import RankingResponse, ResearchTopic, DashboardMetric
|
|
||||||
from inse.tags import Tags
|
|
||||||
|
|
||||||
router = APIRouter(
|
|
||||||
prefix="/api/inse-service/university-rankings",
|
|
||||||
tags=[Tags.INSTITUTIONS]
|
|
||||||
)
|
|
||||||
|
|
||||||
@router.get(
|
|
||||||
"",
|
|
||||||
response_model=RankingResponse,
|
|
||||||
summary="Returns data for the University Ranking Dashboard."
|
|
||||||
)
|
|
||||||
async def get_rankings(
|
|
||||||
topic: ResearchTopic = Query(
|
|
||||||
...,
|
|
||||||
description="Research topic (e.g., 'Artificial Intelligence')"
|
|
||||||
),
|
|
||||||
metric: DashboardMetric = Query("publications", description="Metric to rank by")
|
|
||||||
):
|
|
||||||
return await service.get_university_dashboard_data(topic, metric)
|
|
||||||
@@ -1,6 +1,80 @@
|
|||||||
from . import logic
|
import logging
|
||||||
from .model import RankingResponse, ResearchTopic, DashboardMetric
|
from typing import List, Optional
|
||||||
|
from fastapi import APIRouter, Query
|
||||||
|
|
||||||
async def get_university_dashboard_data(topic: ResearchTopic, metric: DashboardMetric) -> RankingResponse:
|
from inse.tags import Tags
|
||||||
"""Orchestrates data retrieval and computation for the dashboard."""
|
from . import logic, trend_logic
|
||||||
|
from .model import (
|
||||||
|
RankingResponse,
|
||||||
|
DashboardMetric,
|
||||||
|
TrendResponse,
|
||||||
|
TopInstitutionItem,
|
||||||
|
AutocompleteLocationItem
|
||||||
|
)
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
router = APIRouter(
|
||||||
|
prefix="/api/inse-service/university-rankings",
|
||||||
|
tags=[Tags.UNIVERSITY_RANKINGS]
|
||||||
|
)
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"",
|
||||||
|
response_model=RankingResponse,
|
||||||
|
summary="Returns data for the University Ranking Dashboard."
|
||||||
|
)
|
||||||
|
async def get_rankings(
|
||||||
|
topic: str = Query(
|
||||||
|
...,
|
||||||
|
description="Research topic display name or OpenAlex ID (e.g., 'Artificial Intelligence')"
|
||||||
|
),
|
||||||
|
metric: DashboardMetric = Query("publications", description="Metric to rank by")
|
||||||
|
):
|
||||||
return await logic.get_ranking_data(topic, metric)
|
return await logic.get_ranking_data(topic, metric)
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/trend",
|
||||||
|
response_model=TrendResponse,
|
||||||
|
summary="Returns timeseries publication data for compared institutions, countries and regions."
|
||||||
|
)
|
||||||
|
async def get_trend(
|
||||||
|
topics: List[str] = Query(..., description="List of topics to analyze"),
|
||||||
|
institutions: Optional[List[str]] = Query(None, description="List of OpenAlex Institution IDs"),
|
||||||
|
countries: Optional[List[str]] = Query(None, description="List of country codes"),
|
||||||
|
regions: Optional[List[str]] = Query(None, description="List of region identifiers")
|
||||||
|
):
|
||||||
|
return await trend_logic.get_trend_data(
|
||||||
|
topics=topics,
|
||||||
|
institutions=institutions,
|
||||||
|
countries=countries,
|
||||||
|
regions=regions
|
||||||
|
)
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/top-institutions",
|
||||||
|
response_model=List[TopInstitutionItem],
|
||||||
|
summary="Returns top institutions filtered by country/region and sorted by topic-level publications count."
|
||||||
|
)
|
||||||
|
async def get_top_institutions(
|
||||||
|
topic: str = Query(..., description="Research topic"),
|
||||||
|
region: Optional[str] = Query(None, description="Region identifier (e.g. EU)"),
|
||||||
|
country: Optional[str] = Query(None, description="Country code (e.g. DE)"),
|
||||||
|
limit: int = Query(10, description="Max suggestions to return")
|
||||||
|
):
|
||||||
|
return await trend_logic.get_top_institutions_by_region(
|
||||||
|
topic=topic,
|
||||||
|
region=region,
|
||||||
|
country=country,
|
||||||
|
limit=limit
|
||||||
|
)
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/autocomplete-locations",
|
||||||
|
response_model=List[AutocompleteLocationItem],
|
||||||
|
summary="Returns country and continent options for autocomplete inputs."
|
||||||
|
)
|
||||||
|
async def get_autocomplete_locations(
|
||||||
|
query: str = Query(..., description="Query text to search for countries/continents")
|
||||||
|
):
|
||||||
|
return await trend_logic.autocomplete_locations(query)
|
||||||
@@ -0,0 +1,656 @@
|
|||||||
|
import logging
|
||||||
|
import uuid
|
||||||
|
import datetime
|
||||||
|
from typing import List, Dict, Any, Optional
|
||||||
|
import numpy as np
|
||||||
|
from sklearn.preprocessing import MinMaxScaler
|
||||||
|
|
||||||
|
from sqlmodel import Session
|
||||||
|
from inse.integrations import elasticsearch
|
||||||
|
from inse.model import ESIndex
|
||||||
|
from inse.auth.model import AccessToken, Organization
|
||||||
|
from .model import (
|
||||||
|
TrendResponse,
|
||||||
|
TrendSeries,
|
||||||
|
TopicYearlyData,
|
||||||
|
TopInstitutionItem,
|
||||||
|
AutocompleteLocationItem
|
||||||
|
)
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# Default fallback institution: University of Duisburg-Essen
|
||||||
|
DEFAULT_INSTITUTION_ID = "https://openalex.org/I62318514"
|
||||||
|
DEFAULT_INSTITUTION_NAME = "University of Duisburg-Essen"
|
||||||
|
|
||||||
|
async def autocomplete_locations(query: str) -> List[AutocompleteLocationItem]:
|
||||||
|
stripped = query.strip()
|
||||||
|
if not stripped:
|
||||||
|
return []
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
|
||||||
|
# Query countries index (Idea: Instead of wildcard: use alternative names?)
|
||||||
|
country_query = {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{
|
||||||
|
"wildcard": {
|
||||||
|
"display_name.keyword": {
|
||||||
|
"value": f"*{stripped}*",
|
||||||
|
"case_insensitive": True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": {
|
||||||
|
"country_code": {
|
||||||
|
"query": stripped.upper(),
|
||||||
|
"boost": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Query continents index
|
||||||
|
continent_query = {
|
||||||
|
"wildcard": {
|
||||||
|
"display_name.keyword": {
|
||||||
|
"value": f"*{stripped}*",
|
||||||
|
"case_insensitive": True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
countries_res, continents_res = await asyncio.gather(
|
||||||
|
elasticsearch.search(
|
||||||
|
index=str(ESIndex.OPENALEX_COUNTRIES),
|
||||||
|
query=country_query,
|
||||||
|
size=10,
|
||||||
|
source=["id", "display_name", "country_code", "wikidata_id"],
|
||||||
|
cluster="nes"
|
||||||
|
),
|
||||||
|
elasticsearch.search(
|
||||||
|
index=str(ESIndex.OPENALEX_CONTINENTS),
|
||||||
|
query=continent_query,
|
||||||
|
size=5,
|
||||||
|
source=["id", "display_name", "wikidata_id"],
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("Failed to autocomplete locations in ES: %s", e)
|
||||||
|
return []
|
||||||
|
|
||||||
|
results = []
|
||||||
|
|
||||||
|
# Process continents
|
||||||
|
for hit in continents_res.get("hits", {}).get("hits", []):
|
||||||
|
source = hit["_source"]
|
||||||
|
code_val = source.get("wikidata_id") or source["id"].split("/")[-1]
|
||||||
|
results.append(AutocompleteLocationItem(
|
||||||
|
id=code_val,
|
||||||
|
display_name=source["display_name"],
|
||||||
|
code=code_val,
|
||||||
|
type="continent"
|
||||||
|
))
|
||||||
|
|
||||||
|
# Process countries
|
||||||
|
for hit in countries_res.get("hits", {}).get("hits", []):
|
||||||
|
source = hit["_source"]
|
||||||
|
results.append(AutocompleteLocationItem(
|
||||||
|
id=source["country_code"],
|
||||||
|
display_name=source["display_name"],
|
||||||
|
code=source["country_code"],
|
||||||
|
type="country"
|
||||||
|
))
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async def get_top_institutions_by_region(
|
||||||
|
topic: str,
|
||||||
|
region: Optional[str] = None,
|
||||||
|
country: Optional[str] = None,
|
||||||
|
limit: int = 10
|
||||||
|
) -> List[TopInstitutionItem]:
|
||||||
|
"""
|
||||||
|
Search top educational institutions by region or country based on publication counts
|
||||||
|
for the specific topic, using a two-step Python-based sorting approach.
|
||||||
|
"""
|
||||||
|
country_codes = []
|
||||||
|
if country:
|
||||||
|
country_codes = [country.upper()]
|
||||||
|
elif region:
|
||||||
|
try:
|
||||||
|
# Query openalex-continents index to resolve continent country codes dynamically
|
||||||
|
res = await elasticsearch.search(
|
||||||
|
index=str(ESIndex.OPENALEX_CONTINENTS),
|
||||||
|
query={
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"term": {"wikidata_id.keyword": region}},
|
||||||
|
{"term": {"id": f"https://openalex.org/continents/{region}"}}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
size=1,
|
||||||
|
source=["countries"],
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
hits = res.get("hits", {}).get("hits", [])
|
||||||
|
if hits:
|
||||||
|
source = hits[0]["_source"]
|
||||||
|
country_codes = [
|
||||||
|
c["id"].split("/")[-1].upper() for c in source.get("countries", [])
|
||||||
|
]
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Failed to resolve continent countries in get_top_institutions_by_region: %s", e)
|
||||||
|
|
||||||
|
# Resolve the topic to get the exact ID/display name
|
||||||
|
topic_filter = {"match_phrase": {"topics.display_name": topic}}
|
||||||
|
try:
|
||||||
|
topic_res = await elasticsearch.search(
|
||||||
|
index="openalex-topics",
|
||||||
|
query={"match_phrase": {"display_name": topic}},
|
||||||
|
size=1,
|
||||||
|
source=["id", "display_name"],
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
hits = topic_res.get("hits", {}).get("hits", [])
|
||||||
|
if hits:
|
||||||
|
source = hits[0]["_source"]
|
||||||
|
topic_id = source["id"]
|
||||||
|
topic_filter = {"term": {"topics.id.keyword": topic_id}}
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Failed to resolve topic in get_top_institutions_by_region: %s", e)
|
||||||
|
|
||||||
|
# Query openalex-institutions for educational entities matching country and topic
|
||||||
|
must_clauses: List[Dict[str, Any]] = [
|
||||||
|
{"term": {"type": "education"}},
|
||||||
|
topic_filter
|
||||||
|
]
|
||||||
|
|
||||||
|
if country_codes:
|
||||||
|
must_clauses.append({"terms": {"geo.country_code": country_codes}})
|
||||||
|
|
||||||
|
query = {"bool": {"filter": must_clauses}}
|
||||||
|
|
||||||
|
# Fetch top 50 by overall works count to cover a good pool of institutions
|
||||||
|
res = await elasticsearch.search(
|
||||||
|
index=str(ESIndex.OPENALEX_INSTITUTIONS),
|
||||||
|
query=query,
|
||||||
|
size=50,
|
||||||
|
source=["id", "display_name", "country_code", "works_count", "topics"],
|
||||||
|
sort=[{"works_count": "desc"}],
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
|
||||||
|
hits = res.get("hits", {}).get("hits", [])
|
||||||
|
candidates = []
|
||||||
|
|
||||||
|
for hit in hits:
|
||||||
|
source = hit["_source"]
|
||||||
|
inst_id = source.get("id")
|
||||||
|
display_name = source.get("display_name", "Unknown")
|
||||||
|
country_code = source.get("country_code")
|
||||||
|
works_count = source.get("works_count")
|
||||||
|
|
||||||
|
# Extract exact count for the selected topic
|
||||||
|
exact_topic_count = 0
|
||||||
|
for t in source.get("topics", []):
|
||||||
|
if t.get("display_name", "").lower() == topic.lower():
|
||||||
|
exact_topic_count = t.get("count", 0)
|
||||||
|
break
|
||||||
|
|
||||||
|
candidates.append(TopInstitutionItem(
|
||||||
|
id=inst_id,
|
||||||
|
display_name=display_name,
|
||||||
|
country_code=country_code,
|
||||||
|
works_count=works_count,
|
||||||
|
exact_topic_count=exact_topic_count
|
||||||
|
))
|
||||||
|
|
||||||
|
# Sort candidates by exact_topic_count descending
|
||||||
|
candidates.sort(key=lambda x: x.exact_topic_count or 0, reverse=True)
|
||||||
|
|
||||||
|
return candidates[:limit]
|
||||||
|
|
||||||
|
async def get_trend_data(
|
||||||
|
topics: List[str],
|
||||||
|
institutions: Optional[List[str]] = None,
|
||||||
|
countries: Optional[List[str]] = None,
|
||||||
|
regions: Optional[List[str]] = None
|
||||||
|
) -> TrendResponse:
|
||||||
|
"""
|
||||||
|
Traverses the openalex-works index to retrieve yearly contributions of selected/top
|
||||||
|
institutions, countries, and regions across multiple topics.
|
||||||
|
"""
|
||||||
|
if not topics:
|
||||||
|
return TrendResponse(series=[], years=[])
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
|
||||||
|
start_year = 2000
|
||||||
|
end_year = datetime.datetime.now().year - 1
|
||||||
|
years_range = list(range(start_year, end_year + 1))
|
||||||
|
|
||||||
|
# Resolve primary institution (default University of Duisburg-Essen for everyone)
|
||||||
|
primary_inst_id = DEFAULT_INSTITUTION_ID
|
||||||
|
primary_inst_name = DEFAULT_INSTITUTION_NAME
|
||||||
|
|
||||||
|
# Initialize institutions list and ensure primary is included
|
||||||
|
query_institutions = []
|
||||||
|
if institutions:
|
||||||
|
query_institutions = [i.strip() for i in institutions]
|
||||||
|
if primary_inst_id not in query_institutions:
|
||||||
|
query_institutions.insert(0, primary_inst_id)
|
||||||
|
|
||||||
|
# Prepare lists of countries and regions dynamically
|
||||||
|
query_countries = countries or []
|
||||||
|
query_regions = regions or []
|
||||||
|
|
||||||
|
clean_countries = [c.strip().upper() for c in query_countries]
|
||||||
|
clean_regions = [r.strip() for r in query_regions]
|
||||||
|
ids_to_resolve = list(set(query_institutions))
|
||||||
|
|
||||||
|
# Define concurrent metadata lookups
|
||||||
|
async def fetch_institutions():
|
||||||
|
names = {primary_inst_id: primary_inst_name}
|
||||||
|
codes = {}
|
||||||
|
if not ids_to_resolve:
|
||||||
|
return names, codes
|
||||||
|
try:
|
||||||
|
res = await elasticsearch.search(
|
||||||
|
index=str(ESIndex.OPENALEX_INSTITUTIONS),
|
||||||
|
query={"terms": {"id": ids_to_resolve}},
|
||||||
|
size=len(ids_to_resolve),
|
||||||
|
source=["id", "display_name", "country_code"],
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
for hit in res.get("hits", {}).get("hits", []):
|
||||||
|
source = hit["_source"]
|
||||||
|
names[source["id"]] = source.get("display_name", source["id"])
|
||||||
|
codes[source["id"]] = source.get("country_code", "")
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Failed to resolve institution details from ES: %s", e)
|
||||||
|
return names, codes
|
||||||
|
|
||||||
|
async def fetch_countries():
|
||||||
|
names = {}
|
||||||
|
if not clean_countries:
|
||||||
|
return names
|
||||||
|
try:
|
||||||
|
res = await elasticsearch.search(
|
||||||
|
index=str(ESIndex.OPENALEX_COUNTRIES),
|
||||||
|
query={"terms": {"country_code": clean_countries}},
|
||||||
|
size=len(clean_countries),
|
||||||
|
source=["country_code", "display_name"],
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
for hit in res.get("hits", {}).get("hits", []):
|
||||||
|
source = hit["_source"]
|
||||||
|
names[source["country_code"]] = source["display_name"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Failed to resolve country names from ES: %s", e)
|
||||||
|
return names
|
||||||
|
|
||||||
|
async def fetch_continents():
|
||||||
|
names = {}
|
||||||
|
ccodes = {}
|
||||||
|
if not clean_regions:
|
||||||
|
return names, ccodes
|
||||||
|
try:
|
||||||
|
res = await elasticsearch.search(
|
||||||
|
index=str(ESIndex.OPENALEX_CONTINENTS),
|
||||||
|
query={
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"terms": {"wikidata_id.keyword": clean_regions}},
|
||||||
|
{"terms": {"id": [f"https://openalex.org/continents/{r}" for r in clean_regions]}}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
size=len(clean_regions),
|
||||||
|
source=["id", "display_name", "wikidata_id", "countries"],
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
for hit in res.get("hits", {}).get("hits", []):
|
||||||
|
source = hit["_source"]
|
||||||
|
c_code = source.get("wikidata_id") or source["id"].split("/")[-1]
|
||||||
|
names[c_code] = source["display_name"]
|
||||||
|
ccodes[c_code] = [c["id"].split("/")[-1].upper() for c in source.get("countries", [])]
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Failed to resolve continent names from ES: %s", e)
|
||||||
|
return names, ccodes
|
||||||
|
|
||||||
|
async def fetch_topics():
|
||||||
|
t_ids = {}
|
||||||
|
try:
|
||||||
|
res = await elasticsearch.search(
|
||||||
|
index="openalex-topics",
|
||||||
|
query={"bool": {"should": [{"match_phrase": {"display_name": t}} for t in topics]}},
|
||||||
|
size=len(topics) * 2,
|
||||||
|
source=["id", "display_name"],
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
for hit in res.get("hits", {}).get("hits", []):
|
||||||
|
source = hit["_source"]
|
||||||
|
for t in topics:
|
||||||
|
if t.lower() in source["display_name"].lower():
|
||||||
|
t_ids[t] = source["id"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Failed to resolve topic IDs from ES: %s", e)
|
||||||
|
return t_ids
|
||||||
|
|
||||||
|
# Execute all 4 queries concurrently
|
||||||
|
(
|
||||||
|
(resolved_names, resolved_country_codes),
|
||||||
|
resolved_country_names,
|
||||||
|
(resolved_continent_names, continent_country_codes),
|
||||||
|
resolved_topic_ids
|
||||||
|
) = await asyncio.gather(fetch_institutions(), fetch_countries(), fetch_continents(), fetch_topics())
|
||||||
|
|
||||||
|
location_mappings = continent_country_codes.copy()
|
||||||
|
|
||||||
|
# Map of filters inside our Elasticsearch aggregation
|
||||||
|
filters_map: Dict[str, Dict[str, Any]] = {}
|
||||||
|
|
||||||
|
# 1. Institution Filters
|
||||||
|
for inst_id in query_institutions:
|
||||||
|
filters_map[f"inst_{inst_id}"] = {
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships.institutions",
|
||||||
|
"query": {
|
||||||
|
"term": {
|
||||||
|
"authorships.institutions.id": inst_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 2. Country Filters
|
||||||
|
for cc in clean_countries:
|
||||||
|
filters_map[f"country_{cc}"] = {
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships.institutions",
|
||||||
|
"query": {
|
||||||
|
"term": {
|
||||||
|
"authorships.institutions.country_code": cc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 3. Continent/Region Filters
|
||||||
|
for r_code, member_ccs in continent_country_codes.items():
|
||||||
|
if member_ccs:
|
||||||
|
filters_map[f"region_{r_code}"] = {
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships.institutions",
|
||||||
|
"query": {
|
||||||
|
"terms": {
|
||||||
|
"authorships.institutions.country_code": member_ccs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# If no entities specified, return empty
|
||||||
|
if not filters_map:
|
||||||
|
return TrendResponse(series=[], years=years_range, location_mappings=location_mappings)
|
||||||
|
|
||||||
|
# We will accumulate results in a nested structure: entity_key -> topic -> year -> (count, inst_count)
|
||||||
|
accumulated_data: Dict[str, Dict[str, Dict[int, tuple]]] = {
|
||||||
|
key: {t: {yr: (0, 1) for yr in years_range} for t in topics}
|
||||||
|
for key in filters_map
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build topic matching clauses and filters
|
||||||
|
topic_clauses = []
|
||||||
|
topic_filters = {}
|
||||||
|
for t in topics:
|
||||||
|
tid = resolved_topic_ids.get(t)
|
||||||
|
if tid:
|
||||||
|
clause = {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"nested": {"path": "topics", "query": {"term": {"topics.id": tid}}}},
|
||||||
|
{"term": {"primary_topic.id": tid}}
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
clause = {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"nested": {"path": "topics", "query": {"match_phrase": {"topics.display_name": t}}}},
|
||||||
|
{"match_phrase": {"primary_topic.display_name": t}}
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
topic_clauses.append(clause)
|
||||||
|
topic_filters[t] = clause
|
||||||
|
|
||||||
|
# Build query-level entity filters to optimize search performance
|
||||||
|
entity_should_clauses = []
|
||||||
|
if query_institutions:
|
||||||
|
entity_should_clauses.append({
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships.institutions",
|
||||||
|
"query": {
|
||||||
|
"terms": {
|
||||||
|
"authorships.institutions.id": query_institutions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if clean_countries:
|
||||||
|
entity_should_clauses.append({
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships.institutions",
|
||||||
|
"query": {
|
||||||
|
"terms": {
|
||||||
|
"authorships.institutions.country_code": clean_countries
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
all_continent_countries = []
|
||||||
|
for member_ccs in continent_country_codes.values():
|
||||||
|
all_continent_countries.extend(member_ccs)
|
||||||
|
if all_continent_countries:
|
||||||
|
entity_should_clauses.append({
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships.institutions",
|
||||||
|
"query": {
|
||||||
|
"terms": {
|
||||||
|
"authorships.institutions.country_code": list(set(all_continent_countries))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
# Construct the single-pass Elasticsearch query
|
||||||
|
filter_clauses = [
|
||||||
|
{
|
||||||
|
"range": {
|
||||||
|
"publication_year": {
|
||||||
|
"gte": start_year,
|
||||||
|
"lte": end_year
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bool": {
|
||||||
|
"should": topic_clauses,
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
if entity_should_clauses:
|
||||||
|
filter_clauses.append({
|
||||||
|
"bool": {
|
||||||
|
"should": entity_should_clauses,
|
||||||
|
"minimum_should_match": 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
query = {
|
||||||
|
"bool": {
|
||||||
|
"filter": filter_clauses
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build two-layer nested aggregations (topics -> entities -> publication_year)
|
||||||
|
aggregations = {
|
||||||
|
"topics_agg": {
|
||||||
|
"filters": {
|
||||||
|
"filters": topic_filters
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"entities_agg": {
|
||||||
|
"filters": {
|
||||||
|
"filters": filters_map
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"by_year": {
|
||||||
|
"terms": {
|
||||||
|
"field": "publication_year",
|
||||||
|
"size": len(years_range) * 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
res = await elasticsearch.search(
|
||||||
|
index=f"{str(ESIndex.OPENALEX_WORKS)}*",
|
||||||
|
query=query,
|
||||||
|
body={"aggs": aggregations},
|
||||||
|
size=0,
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
|
||||||
|
topics_buckets = res.get("aggregations", {}).get("topics_agg", {}).get("buckets", {})
|
||||||
|
for t_name, t_bucket in topics_buckets.items():
|
||||||
|
entities_buckets = t_bucket.get("entities_agg", {}).get("buckets", {})
|
||||||
|
for entity_key, e_bucket in entities_buckets.items():
|
||||||
|
year_buckets = e_bucket.get("by_year", {}).get("buckets", [])
|
||||||
|
for yr_bucket in year_buckets:
|
||||||
|
yr = int(yr_bucket.get("key"))
|
||||||
|
count = int(yr_bucket.get("doc_count", 0))
|
||||||
|
inst_count = 1
|
||||||
|
if yr in years_range:
|
||||||
|
accumulated_data[entity_key][t_name][yr] = (count, inst_count)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("Error executing single-pass Elasticsearch query: %s", e)
|
||||||
|
|
||||||
|
# Construct lists of raw counts and S-Curves for all series to normalize in parallel
|
||||||
|
series_keys = []
|
||||||
|
raw_lists = []
|
||||||
|
cumsum_lists = []
|
||||||
|
inst_counts_map = {}
|
||||||
|
|
||||||
|
for entity_key, topic_dict in accumulated_data.items():
|
||||||
|
for topic, year_dict in topic_dict.items():
|
||||||
|
raw_counts = []
|
||||||
|
inst_counts = []
|
||||||
|
for yr in years_range:
|
||||||
|
count, inst_count = year_dict[yr]
|
||||||
|
raw_counts.append(count)
|
||||||
|
inst_counts.append(inst_count)
|
||||||
|
|
||||||
|
cumulative_counts = list(np.cumsum(raw_counts))
|
||||||
|
|
||||||
|
series_keys.append((entity_key, topic))
|
||||||
|
raw_lists.append(raw_counts)
|
||||||
|
cumsum_lists.append(cumulative_counts)
|
||||||
|
inst_counts_map[(entity_key, topic)] = inst_counts
|
||||||
|
|
||||||
|
normalized_lookup = {}
|
||||||
|
if raw_lists:
|
||||||
|
# Construct matrices of shape (n_years, n_series)
|
||||||
|
raw_matrix = np.array(raw_lists, dtype=float).T
|
||||||
|
cumsum_matrix = np.array(cumsum_lists, dtype=float).T
|
||||||
|
|
||||||
|
# Batch normalize columns in parallel using MinMaxScaler
|
||||||
|
scaler_raw = MinMaxScaler()
|
||||||
|
normalized_matrix = scaler_raw.fit_transform(raw_matrix)
|
||||||
|
|
||||||
|
scaler_cumsum = MinMaxScaler()
|
||||||
|
normalized_cumsum_matrix = scaler_cumsum.fit_transform(cumsum_matrix)
|
||||||
|
|
||||||
|
# Transpose back to lists of shape (n_series, n_years)
|
||||||
|
normalized_lists = normalized_matrix.T.tolist()
|
||||||
|
normalized_cumsum_lists = normalized_cumsum_matrix.T.tolist()
|
||||||
|
|
||||||
|
for idx, (entity_key, topic) in enumerate(series_keys):
|
||||||
|
normalized_lookup[(entity_key, topic)] = {
|
||||||
|
"normalized": normalized_lists[idx],
|
||||||
|
"cumulative": normalized_cumsum_lists[idx]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Process and build TrendSeries list
|
||||||
|
series_list: List[TrendSeries] = []
|
||||||
|
|
||||||
|
for entity_key, topic_dict in accumulated_data.items():
|
||||||
|
# Resolve details for this entity
|
||||||
|
if entity_key.startswith("inst_"):
|
||||||
|
entity_id = entity_key[len("inst_"):]
|
||||||
|
entity_name = resolved_names.get(entity_id, entity_id)
|
||||||
|
entity_type = "institution"
|
||||||
|
elif entity_key.startswith("country_"):
|
||||||
|
entity_id = entity_key[len("country_"):]
|
||||||
|
entity_name = resolved_country_names.get(entity_id, f"Country {entity_id}")
|
||||||
|
entity_type = "country"
|
||||||
|
elif entity_key.startswith("region_"):
|
||||||
|
entity_id = entity_key[len("region_"):]
|
||||||
|
entity_name = resolved_continent_names.get(entity_id, f"Continent {entity_id}")
|
||||||
|
entity_type = "region"
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
|
topic_data_map: Dict[str, List[TopicYearlyData]] = {}
|
||||||
|
|
||||||
|
for topic, year_dict in topic_dict.items():
|
||||||
|
yearly_data_items: List[TopicYearlyData] = []
|
||||||
|
|
||||||
|
lookup = normalized_lookup.get((entity_key, topic), {})
|
||||||
|
norm_vals = lookup.get("normalized", [0.0] * len(years_range))
|
||||||
|
cum_vals = lookup.get("cumulative", [0.0] * len(years_range))
|
||||||
|
inst_counts = inst_counts_map.get((entity_key, topic), [1] * len(years_range))
|
||||||
|
|
||||||
|
for idx, yr in enumerate(years_range):
|
||||||
|
count, _ = year_dict[yr]
|
||||||
|
yearly_data_items.append(TopicYearlyData(
|
||||||
|
year=yr,
|
||||||
|
raw=count,
|
||||||
|
normalized=norm_vals[idx],
|
||||||
|
cumulative=cum_vals[idx],
|
||||||
|
institutions_count=inst_counts[idx]
|
||||||
|
))
|
||||||
|
|
||||||
|
topic_data_map[topic] = yearly_data_items
|
||||||
|
|
||||||
|
series_list.append(TrendSeries(
|
||||||
|
entity_id=entity_id,
|
||||||
|
entity_name=entity_name,
|
||||||
|
entity_type=entity_type,
|
||||||
|
country_code=resolved_country_codes.get(entity_id) if entity_type == "institution" else None,
|
||||||
|
topic_data=topic_data_map
|
||||||
|
))
|
||||||
|
|
||||||
|
return TrendResponse(series=series_list, years=years_range, location_mappings=location_mappings)
|
||||||
|
|
||||||
@@ -71,6 +71,7 @@ async def get_author_works(
|
|||||||
)
|
)
|
||||||
|
|
||||||
elements, total = _parse_full_work_search_response(data)
|
elements, total = _parse_full_work_search_response(data)
|
||||||
|
await _enrich_work_topic_descriptions(elements)
|
||||||
offset = (page - 1) * size
|
offset = (page - 1) * size
|
||||||
last_page = offset + len(elements) >= total
|
last_page = offset + len(elements) >= total
|
||||||
|
|
||||||
@@ -166,6 +167,15 @@ async def _get_primary_topic_counts_from_es(author_id: str) -> list[dict]:
|
|||||||
"primary_topics": {
|
"primary_topics": {
|
||||||
"terms": {"field": "primary_topic.id", "size": 1000},
|
"terms": {"field": "primary_topic.id", "size": 1000},
|
||||||
},
|
},
|
||||||
|
"all_topics": {
|
||||||
|
"nested": {"path": "topics"},
|
||||||
|
"aggs": {
|
||||||
|
"topic_ids": {
|
||||||
|
"terms": {"field": "topics.id", "size": 1000},
|
||||||
|
"aggs": {"works": {"reverse_nested": {}}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,10 +190,25 @@ async def _get_primary_topic_counts_from_es(author_id: str) -> list[dict]:
|
|||||||
|
|
||||||
aggregations = response.get("aggregations", {})
|
aggregations = response.get("aggregations", {})
|
||||||
buckets = aggregations.get("primary_topics", {}).get("buckets", [])
|
buckets = aggregations.get("primary_topics", {}).get("buckets", [])
|
||||||
|
topic_buckets = (
|
||||||
|
aggregations.get("all_topics", {}).get("topic_ids", {}).get("buckets", [])
|
||||||
|
)
|
||||||
|
|
||||||
|
broad_counts = {
|
||||||
|
bucket["key"]: bucket.get("works", {}).get("doc_count", bucket["doc_count"])
|
||||||
|
for bucket in topic_buckets
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
counts = []
|
counts = []
|
||||||
for bucket in buckets:
|
for bucket in buckets:
|
||||||
counts.append({"id": bucket["key"], "count": bucket["doc_count"]})
|
topic_id = bucket["key"]
|
||||||
|
counts.append(
|
||||||
|
{
|
||||||
|
"id": topic_id,
|
||||||
|
"count": max(broad_counts.get(topic_id, 0), bucket["doc_count"]),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return counts
|
return counts
|
||||||
|
|
||||||
@@ -202,9 +227,44 @@ async def get_work(
|
|||||||
elements, _ = _parse_full_work_search_response(response_by_title)
|
elements, _ = _parse_full_work_search_response(response_by_title)
|
||||||
if not elements:
|
if not elements:
|
||||||
return None
|
return None
|
||||||
|
await _enrich_work_topic_descriptions(elements[:1])
|
||||||
return elements[0]
|
return elements[0]
|
||||||
|
|
||||||
|
|
||||||
|
async def enrich_topic_descriptions(topics: List) -> None:
|
||||||
|
"""Batch-fill missing descriptions on dehydrated topics.
|
||||||
|
|
||||||
|
OpenAlex work and author documents carry dehydrated topics without a
|
||||||
|
description, so we batch-load the details from the openalex-topics index.
|
||||||
|
"""
|
||||||
|
pending = [topic for topic in topics if topic.id and not topic.description]
|
||||||
|
|
||||||
|
if not pending:
|
||||||
|
return
|
||||||
|
|
||||||
|
details = await _get_topic_details(list({topic.id for topic in pending}))
|
||||||
|
|
||||||
|
if not details:
|
||||||
|
return
|
||||||
|
|
||||||
|
for topic in pending:
|
||||||
|
info = details.get(topic.id)
|
||||||
|
if info:
|
||||||
|
topic.description = info.get("description")
|
||||||
|
|
||||||
|
|
||||||
|
async def _enrich_work_topic_descriptions(works: List[Work]) -> None:
|
||||||
|
topics = []
|
||||||
|
|
||||||
|
for work in works:
|
||||||
|
topics.extend(work.topics or [])
|
||||||
|
|
||||||
|
if work.primary_topic:
|
||||||
|
topics.append(work.primary_topic)
|
||||||
|
|
||||||
|
await enrich_topic_descriptions(topics)
|
||||||
|
|
||||||
|
|
||||||
async def _get_topic_details(topic_ids: List[str]) -> dict[str, dict]:
|
async def _get_topic_details(topic_ids: List[str]) -> dict[str, dict]:
|
||||||
if not topic_ids:
|
if not topic_ids:
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ class OpenAlexWorksSearchClient:
|
|||||||
return {
|
return {
|
||||||
"from": (page - 1) * size,
|
"from": (page - 1) * size,
|
||||||
"size": size,
|
"size": size,
|
||||||
|
"track_total_hits": True,
|
||||||
"query": {
|
"query": {
|
||||||
"bool": {
|
"bool": {
|
||||||
"must": must_clauses,
|
"must": must_clauses,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ api/personNetwork.service.ts
|
|||||||
api/persons.service.ts
|
api/persons.service.ts
|
||||||
api/projects.service.ts
|
api/projects.service.ts
|
||||||
api/topics.service.ts
|
api/topics.service.ts
|
||||||
|
api/universityRankings.service.ts
|
||||||
api/works.service.ts
|
api/works.service.ts
|
||||||
configuration.ts
|
configuration.ts
|
||||||
encoder.ts
|
encoder.ts
|
||||||
@@ -38,6 +39,7 @@ model/authorSummaryStats.ts
|
|||||||
model/authorsFilterProperties.ts
|
model/authorsFilterProperties.ts
|
||||||
model/authorsListResponse.ts
|
model/authorsListResponse.ts
|
||||||
model/authorship.ts
|
model/authorship.ts
|
||||||
|
model/autocompleteLocationItem.ts
|
||||||
model/autocompleteResponse.ts
|
model/autocompleteResponse.ts
|
||||||
model/autocompleteResponseMeta.ts
|
model/autocompleteResponseMeta.ts
|
||||||
model/autocompleteResponseResultsInner.ts
|
model/autocompleteResponseResultsInner.ts
|
||||||
@@ -46,6 +48,8 @@ model/bodyChangePassword.ts
|
|||||||
model/bodyGetAccessToken.ts
|
model/bodyGetAccessToken.ts
|
||||||
model/bodyLogin.ts
|
model/bodyLogin.ts
|
||||||
model/bodyRequestOtk.ts
|
model/bodyRequestOtk.ts
|
||||||
|
model/bodyRequestPasswordReset.ts
|
||||||
|
model/bodyResetPassword.ts
|
||||||
model/bundProject.ts
|
model/bundProject.ts
|
||||||
model/bundProjectDetails.ts
|
model/bundProjectDetails.ts
|
||||||
model/bundProjectPage.ts
|
model/bundProjectPage.ts
|
||||||
@@ -164,16 +168,20 @@ model/rankingResponse.ts
|
|||||||
model/score.ts
|
model/score.ts
|
||||||
model/sortDirection.ts
|
model/sortDirection.ts
|
||||||
model/tokenType.ts
|
model/tokenType.ts
|
||||||
|
model/topInstitutionItem.ts
|
||||||
model/topic.ts
|
model/topic.ts
|
||||||
model/topicCount.ts
|
model/topicCount.ts
|
||||||
model/topicDomain.ts
|
model/topicDomain.ts
|
||||||
model/topicField.ts
|
model/topicField.ts
|
||||||
model/topicIds.ts
|
model/topicIds.ts
|
||||||
model/topicSubfield.ts
|
model/topicSubfield.ts
|
||||||
|
model/topicYearlyData.ts
|
||||||
model/topics.ts
|
model/topics.ts
|
||||||
model/topicsByTime.ts
|
model/topicsByTime.ts
|
||||||
model/topicsByYear.ts
|
model/topicsByYear.ts
|
||||||
model/topicsListResponse.ts
|
model/topicsListResponse.ts
|
||||||
|
model/trendResponse.ts
|
||||||
|
model/trendSeries.ts
|
||||||
model/universityRanking.ts
|
model/universityRanking.ts
|
||||||
model/universityTopicData.ts
|
model/universityTopicData.ts
|
||||||
model/updateAccountRequest.ts
|
model/updateAccountRequest.ts
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ In your project:
|
|||||||
npm link
|
npm link
|
||||||
```
|
```
|
||||||
|
|
||||||
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
|
**Note for Windows users:** The Angular CLI has troubles to use linked npm packages.
|
||||||
Please refer to this issue <https://github.com/angular/angular-cli/issues/8284> for a solution / workaround.
|
Please refer to this issue <https://github.com/angular/angular-cli/issues/8284> for a solution / workaround.
|
||||||
Published packages are not effected by this issue.
|
Published packages are not effected by this issue.
|
||||||
|
|
||||||
@@ -58,22 +58,22 @@ Published packages are not effected by this issue.
|
|||||||
In your Angular project:
|
In your Angular project:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
|
|
||||||
import { ApplicationConfig } from '@angular/core';
|
import { ApplicationConfig } from '@angular/core';
|
||||||
import { provideHttpClient } from '@angular/common/http';
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
import { provideApi } from '';
|
import { provideApi } from '';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
// ...
|
// ...
|
||||||
provideHttpClient(),
|
provideHttpClient(),
|
||||||
provideApi()
|
provideApi(),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOTE**
|
**NOTE**
|
||||||
If you're still using `AppModule` and haven't [migrated](https://angular.dev/reference/migrations/standalone) yet, you can still import an Angular module:
|
If you're still using `AppModule` and haven't [migrated](https://angular.dev/reference/migrations/standalone) yet, you can still import an Angular module:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { ApiModule } from '';
|
import { ApiModule } from '';
|
||||||
```
|
```
|
||||||
@@ -86,11 +86,11 @@ import { provideHttpClient } from '@angular/common/http';
|
|||||||
import { provideApi } from '';
|
import { provideApi } from '';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
// ...
|
// ...
|
||||||
provideHttpClient(),
|
provideHttpClient(),
|
||||||
provideApi('http://localhost:9999')
|
provideApi('http://localhost:9999'),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -101,15 +101,15 @@ import { provideHttpClient } from '@angular/common/http';
|
|||||||
import { provideApi } from '';
|
import { provideApi } from '';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
// ...
|
// ...
|
||||||
provideHttpClient(),
|
provideHttpClient(),
|
||||||
provideApi({
|
provideApi({
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
username: 'user',
|
username: 'user',
|
||||||
password: 'password'
|
password: 'password',
|
||||||
})
|
}),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -120,21 +120,22 @@ import { provideHttpClient } from '@angular/common/http';
|
|||||||
import { provideApi, Configuration } from '';
|
import { provideApi, Configuration } from '';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
// ...
|
// ...
|
||||||
provideHttpClient(),
|
provideHttpClient(),
|
||||||
{
|
{
|
||||||
provide: Configuration,
|
provide: Configuration,
|
||||||
useFactory: (authService: AuthService) => new Configuration({
|
useFactory: (authService: AuthService) =>
|
||||||
basePath: 'http://localhost:9999',
|
new Configuration({
|
||||||
withCredentials: true,
|
basePath: 'http://localhost:9999',
|
||||||
username: authService.getUsername(),
|
withCredentials: true,
|
||||||
password: authService.getPassword(),
|
username: authService.getUsername(),
|
||||||
}),
|
password: authService.getPassword(),
|
||||||
deps: [AuthService],
|
}),
|
||||||
multi: false
|
deps: [AuthService],
|
||||||
}
|
multi: false,
|
||||||
],
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -151,12 +152,12 @@ import { HttpClientModule } from '@angular/common/http';
|
|||||||
import { environment } from '../environments/environment';
|
import { environment } from '../environments/environment';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
// ...
|
// ...
|
||||||
provideHttpClient(),
|
provideHttpClient(),
|
||||||
provideUserApi(environment.basePath),
|
provideUserApi(environment.basePath),
|
||||||
provideAdminApi(environment.basePath),
|
provideAdminApi(environment.basePath),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -176,8 +177,8 @@ Example value for use in your Configuration-Provider:
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
new Configuration({
|
new Configuration({
|
||||||
encodeParam: (param: Param) => myFancyParamEncoder(param),
|
encodeParam: (param: Param) => myFancyParamEncoder(param),
|
||||||
})
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
|
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
|
||||||
|
|||||||
@@ -7,77 +7,103 @@
|
|||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
import {
|
||||||
|
HttpHeaders,
|
||||||
|
HttpParams,
|
||||||
|
HttpParameterCodec,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { CustomHttpParameterCodec } from './encoder';
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
import { Configuration } from './configuration';
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
export class BaseService {
|
export class BaseService {
|
||||||
protected basePath = 'http://localhost:8000';
|
protected basePath = 'http://localhost:8000';
|
||||||
public defaultHeaders = new HttpHeaders();
|
public defaultHeaders = new HttpHeaders();
|
||||||
public configuration: Configuration;
|
public configuration: Configuration;
|
||||||
public encoder: HttpParameterCodec;
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
constructor(basePath?: string|string[], configuration?: Configuration) {
|
constructor(basePath?: string | string[], configuration?: Configuration) {
|
||||||
this.configuration = configuration || new Configuration();
|
this.configuration = configuration || new Configuration();
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
if (firstBasePath != undefined) {
|
if (firstBasePath != undefined) {
|
||||||
basePath = firstBasePath;
|
basePath = firstBasePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
if (typeof basePath !== 'string') {
|
||||||
basePath = this.basePath;
|
basePath = this.basePath;
|
||||||
}
|
}
|
||||||
this.configuration.basePath = basePath;
|
this.configuration.basePath = basePath;
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
protected canConsumeForm(consumes: string[]): boolean {
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
return consumes.indexOf('multipart/form-data') !== -1;
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep: boolean = false): HttpParams {
|
protected addToHttpParams(
|
||||||
// If the value is an object (but not a Date), recursively add its keys.
|
httpParams: HttpParams,
|
||||||
if (typeof value === 'object' && !(value instanceof Date)) {
|
value: any,
|
||||||
return this.addToHttpParamsRecursive(httpParams, value, isDeep ? key : undefined, isDeep);
|
key?: string,
|
||||||
}
|
isDeep: boolean = false,
|
||||||
return this.addToHttpParamsRecursive(httpParams, value, key);
|
): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(
|
||||||
|
httpParams,
|
||||||
|
value,
|
||||||
|
isDeep ? key : undefined,
|
||||||
|
isDeep,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep: boolean = false): HttpParams {
|
protected addToHttpParamsRecursive(
|
||||||
if (value === null || value === undefined) {
|
httpParams: HttpParams,
|
||||||
return httpParams;
|
value?: any,
|
||||||
}
|
key?: string,
|
||||||
if (typeof value === 'object') {
|
isDeep: boolean = false,
|
||||||
// If JSON format is preferred, key must be provided.
|
): HttpParams {
|
||||||
if (key != null) {
|
if (value === null || value === undefined) {
|
||||||
return isDeep
|
return httpParams;
|
||||||
? Object.keys(value as Record<string, any>).reduce(
|
|
||||||
(hp, k) => hp.append(`${key}[${k}]`, value[k]),
|
|
||||||
httpParams,
|
|
||||||
)
|
|
||||||
: httpParams.append(key, JSON.stringify(value));
|
|
||||||
}
|
|
||||||
// Otherwise, if it's an array, add each element.
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value.toISOString());
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach(k => {
|
|
||||||
const paramKey = key ? `${key}.${k}` : k;
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
} else if (key != null) {
|
|
||||||
return httpParams.append(key, value);
|
|
||||||
}
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return isDeep
|
||||||
|
? Object.keys(value as Record<string, any>).reduce(
|
||||||
|
(hp, k) => hp.append(`${key}[${k}]`, value[k]),
|
||||||
|
httpParams,
|
||||||
|
)
|
||||||
|
: httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(
|
||||||
|
(elem) =>
|
||||||
|
(httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)),
|
||||||
|
);
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error('key may not be null if value is Date');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach((k) => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(
|
||||||
|
httpParams,
|
||||||
|
value[k],
|
||||||
|
paramKey,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error('key may not be null if value is not object or array');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,42 @@
|
|||||||
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
|
import {
|
||||||
|
NgModule,
|
||||||
|
ModuleWithProviders,
|
||||||
|
SkipSelf,
|
||||||
|
Optional,
|
||||||
|
} from '@angular/core';
|
||||||
import { Configuration } from './configuration';
|
import { Configuration } from './configuration';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
declarations: [],
|
declarations: [],
|
||||||
exports: [],
|
exports: [],
|
||||||
providers: []
|
providers: [],
|
||||||
})
|
})
|
||||||
export class ApiModule {
|
export class ApiModule {
|
||||||
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> {
|
public static forRoot(
|
||||||
return {
|
configurationFactory: () => Configuration,
|
||||||
ngModule: ApiModule,
|
): ModuleWithProviders<ApiModule> {
|
||||||
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
|
return {
|
||||||
};
|
ngModule: ApiModule,
|
||||||
}
|
providers: [{ provide: Configuration, useFactory: configurationFactory }],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
|
constructor(
|
||||||
@Optional() http: HttpClient) {
|
@Optional() @SkipSelf() parentModule: ApiModule,
|
||||||
if (parentModule) {
|
@Optional() http: HttpClient,
|
||||||
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
|
) {
|
||||||
}
|
if (parentModule) {
|
||||||
if (!http) {
|
throw new Error(
|
||||||
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
|
'ApiModule is already loaded. Import in your base AppModule only.',
|
||||||
'See also https://github.com/angular/angular/issues/20575');
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (!http) {
|
||||||
|
throw new Error(
|
||||||
|
'You need to import the HttpClientModule in your AppModule! \n' +
|
||||||
|
'See also https://github.com/angular/angular/issues/20575',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,24 @@ export * from './projects.service';
|
|||||||
import { ProjectsService } from './projects.service';
|
import { ProjectsService } from './projects.service';
|
||||||
export * from './topics.service';
|
export * from './topics.service';
|
||||||
import { TopicsService } from './topics.service';
|
import { TopicsService } from './topics.service';
|
||||||
|
export * from './universityRankings.service';
|
||||||
|
import { UniversityRankingsService } from './universityRankings.service';
|
||||||
export * from './works.service';
|
export * from './works.service';
|
||||||
import { WorksService } from './works.service';
|
import { WorksService } from './works.service';
|
||||||
export const APIS = [AuthService, CompanyConnectionsService, FundingService, INSEServiceService, InstitutionsService, KeywordsService, NewsService, OrganizationService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, WorksService];
|
export const APIS = [
|
||||||
|
AuthService,
|
||||||
|
CompanyConnectionsService,
|
||||||
|
FundingService,
|
||||||
|
INSEServiceService,
|
||||||
|
InstitutionsService,
|
||||||
|
KeywordsService,
|
||||||
|
NewsService,
|
||||||
|
OrganizationService,
|
||||||
|
PatentsService,
|
||||||
|
PersonNetworkService,
|
||||||
|
PersonsService,
|
||||||
|
ProjectsService,
|
||||||
|
TopicsService,
|
||||||
|
UniversityRankingsService,
|
||||||
|
WorksService,
|
||||||
|
];
|
||||||
|
|||||||
+1707
-782
File diff suppressed because it is too large
Load Diff
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* 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 { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { CompanyConnectionsResponse } from '../model/companyConnectionsResponse';
|
import { CompanyConnectionsResponse } from '../model/companyConnectionsResponse';
|
||||||
@@ -22,74 +28,121 @@ 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) {
|
/**
|
||||||
super(basePath, configuration);
|
* Get possible company connections by OpenAlex author ID.
|
||||||
|
* @endpoint get /api/inse-service/authors/{author_id}/company-connections
|
||||||
|
* @param authorId
|
||||||
|
* @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,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<CompanyConnectionsResponse>;
|
||||||
|
public getCompanyConnectionsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<CompanyConnectionsResponse>>;
|
||||||
|
public getCompanyConnectionsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<CompanyConnectionsResponse>>;
|
||||||
|
public getCompanyConnectionsByAuthor(
|
||||||
|
authorId: 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;
|
||||||
* Get possible company connections by OpenAlex author ID.
|
|
||||||
* @endpoint get /api/inse-service/authors/{author_id}/company-connections
|
|
||||||
* @param authorId
|
|
||||||
* @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, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CompanyConnectionsResponse>;
|
|
||||||
public getCompanyConnectionsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CompanyConnectionsResponse>>;
|
|
||||||
public getCompanyConnectionsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CompanyConnectionsResponse>>;
|
|
||||||
public getCompanyConnectionsByAuthor(authorId: 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;
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
]);
|
localVarHeaders = localVarHeaders.set(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'Accept',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
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
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* 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 { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { FundersByAuthorResponse } from '../model/fundersByAuthorResponse';
|
import { FundersByAuthorResponse } from '../model/fundersByAuthorResponse';
|
||||||
@@ -24,138 +30,246 @@ import { HTTPValidationError } from '../model/hTTPValidationError';
|
|||||||
import { PublicationsByAuthorResponse } from '../model/publicationsByAuthorResponse';
|
import { PublicationsByAuthorResponse } from '../model/publicationsByAuthorResponse';
|
||||||
|
|
||||||
// @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 FundingService extends BaseService {
|
export class FundingService 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) {
|
/**
|
||||||
super(basePath, configuration);
|
* Get funding organizations by author.
|
||||||
|
* @endpoint get /api/inse-service/authors/{author_id}/funders
|
||||||
|
* @param authorId
|
||||||
|
* @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 getFundersByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<FundersByAuthorResponse>;
|
||||||
|
public getFundersByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<FundersByAuthorResponse>>;
|
||||||
|
public getFundersByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<FundersByAuthorResponse>>;
|
||||||
|
public getFundersByAuthor(
|
||||||
|
authorId: 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 getFundersByAuthor.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Get funding organizations by author.
|
|
||||||
* @endpoint get /api/inse-service/authors/{author_id}/funders
|
|
||||||
* @param authorId
|
|
||||||
* @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 getFundersByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<FundersByAuthorResponse>;
|
|
||||||
public getFundersByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<FundersByAuthorResponse>>;
|
|
||||||
public getFundersByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<FundersByAuthorResponse>>;
|
|
||||||
public getFundersByAuthor(authorId: 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 getFundersByAuthor.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
]);
|
localVarHeaders = localVarHeaders.set(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'Accept',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
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})}/funders`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<FundersByAuthorResponse>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Get funded publications by author.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/inse-service/authors/{author_id}/publications
|
|
||||||
* @param authorId
|
|
||||||
* @param page
|
|
||||||
* @param pageSize
|
|
||||||
* @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 getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PublicationsByAuthorResponse>;
|
|
||||||
public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PublicationsByAuthorResponse>>;
|
|
||||||
public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PublicationsByAuthorResponse>>;
|
|
||||||
public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, 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 getPublicationsByAuthor.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>page, 'page');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>pageSize, 'page_size');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
'application/json'
|
responseType_ = 'text';
|
||||||
]);
|
} else if (
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
) {
|
||||||
}
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
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})}/publications`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<PublicationsByAuthorResponse>('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/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/funders`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<FundersByAuthorResponse>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get funded publications by author.
|
||||||
|
* @endpoint get /api/inse-service/authors/{author_id}/publications
|
||||||
|
* @param authorId
|
||||||
|
* @param page
|
||||||
|
* @param pageSize
|
||||||
|
* @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 getPublicationsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<PublicationsByAuthorResponse>;
|
||||||
|
public getPublicationsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<PublicationsByAuthorResponse>>;
|
||||||
|
public getPublicationsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<PublicationsByAuthorResponse>>;
|
||||||
|
public getPublicationsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
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 getPublicationsByAuthor.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>page,
|
||||||
|
'page',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>pageSize,
|
||||||
|
'page_size',
|
||||||
|
);
|
||||||
|
|
||||||
|
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/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/publications`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<PublicationsByAuthorResponse>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,205 +9,355 @@
|
|||||||
*/
|
*/
|
||||||
/* 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 { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
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';
|
||||||
|
|
||||||
// @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 INSEServiceService extends BaseService {
|
export class INSEServiceService 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) {
|
/**
|
||||||
super(basePath, configuration);
|
* Builds the topic hierarchy cache.
|
||||||
|
* @endpoint get /api/inse-service/topics/cache
|
||||||
|
* @param pageSize Page size for each search page.
|
||||||
|
* @param saveJson Persist cache JSON to data folder.
|
||||||
|
* @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 buildTopicCache(
|
||||||
|
pageSize?: number,
|
||||||
|
saveJson?: boolean,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<object>;
|
||||||
|
public buildTopicCache(
|
||||||
|
pageSize?: number,
|
||||||
|
saveJson?: boolean,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<object>>;
|
||||||
|
public buildTopicCache(
|
||||||
|
pageSize?: number,
|
||||||
|
saveJson?: boolean,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<object>>;
|
||||||
|
public buildTopicCache(
|
||||||
|
pageSize?: number,
|
||||||
|
saveJson?: boolean,
|
||||||
|
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>pageSize,
|
||||||
|
'page_size',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>saveJson,
|
||||||
|
'save_json',
|
||||||
|
);
|
||||||
|
|
||||||
|
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 =
|
||||||
* Builds the topic hierarchy cache.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/inse-service/topics/cache
|
|
||||||
* @param pageSize Page size for each search page.
|
|
||||||
* @param saveJson Persist cache JSON to data folder.
|
|
||||||
* @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 buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
|
|
||||||
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
|
|
||||||
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
|
|
||||||
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>pageSize, 'page_size');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>saveJson, 'save_json');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
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';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
let localVarPath = `/api/inse-service/topics/cache`;
|
||||||
'application/json'
|
const { basePath, withCredentials } = this.configuration;
|
||||||
]);
|
return this.httpClient.request<object>(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'get',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
`${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();
|
/**
|
||||||
|
* Counts topic hierarchy occurrences from cache.
|
||||||
|
* @endpoint get /api/inse-service/topics/count
|
||||||
|
* @param topic Topic names (repeat parameter).
|
||||||
|
* @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 countTopicHierarchy(
|
||||||
|
topic: Array<string>,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<object>;
|
||||||
|
public countTopicHierarchy(
|
||||||
|
topic: Array<string>,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<object>>;
|
||||||
|
public countTopicHierarchy(
|
||||||
|
topic: Array<string>,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<object>>;
|
||||||
|
public countTopicHierarchy(
|
||||||
|
topic: Array<string>,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (topic === null || topic === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter topic was null or undefined when calling countTopicHierarchy.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
if (topic) {
|
||||||
|
topic.forEach((element) => {
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
localVarQueryParameters,
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
<any>element,
|
||||||
responseType_ = 'text';
|
'topic',
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/inse-service/topics/cache`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<object>('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;
|
||||||
* Counts topic hierarchy occurrences from cache.
|
|
||||||
* @endpoint get /api/inse-service/topics/count
|
|
||||||
* @param topic Topic names (repeat parameter).
|
|
||||||
* @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 countTopicHierarchy(topic: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
|
|
||||||
public countTopicHierarchy(topic: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
|
|
||||||
public countTopicHierarchy(topic: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
|
|
||||||
public countTopicHierarchy(topic: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (topic === null || topic === undefined) {
|
|
||||||
throw new Error('Required parameter topic was null or undefined when calling countTopicHierarchy.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
if (topic) {
|
options?.httpHeaderAccept ??
|
||||||
topic.forEach((element) => {
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
<any>element, 'topic');
|
localVarHeaders = localVarHeaders.set(
|
||||||
})
|
'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/inse-service/topics/count`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<object>('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 =
|
||||||
* Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics).
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/inse-service/topics/hierarchy
|
|
||||||
* @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 getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
|
|
||||||
public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
|
|
||||||
public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
|
|
||||||
public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
]);
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
responseType_ = 'text';
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
} else if (
|
||||||
}
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
|
||||||
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/topics/hierarchy`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<object>('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/topics/count`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<object>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics).
|
||||||
|
* @endpoint get /api/inse-service/topics/hierarchy
|
||||||
|
* @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 getTopicHierarchy(
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<object>;
|
||||||
|
public getTopicHierarchy(
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<object>>;
|
||||||
|
public getTopicHierarchy(
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<object>>;
|
||||||
|
public getTopicHierarchy(
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
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/inse-service/topics/hierarchy`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<object>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* 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 { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { AutocompleteResponse } from '../model/autocompleteResponse';
|
import { AutocompleteResponse } from '../model/autocompleteResponse';
|
||||||
@@ -26,362 +32,593 @@ import { Institution } from '../model/institution';
|
|||||||
import { InstitutionPage } from '../model/institutionPage';
|
import { InstitutionPage } from '../model/institutionPage';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { InstitutionsListResponse } from '../model/institutionsListResponse';
|
import { InstitutionsListResponse } from '../model/institutionsListResponse';
|
||||||
// @ts-ignore
|
|
||||||
import { RankingResponse } from '../model/rankingResponse';
|
|
||||||
|
|
||||||
// @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 InstitutionsService extends BaseService {
|
export class InstitutionsService 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) {
|
/**
|
||||||
super(basePath, configuration);
|
* Returns institution options for autocomplete inputs.
|
||||||
|
* @endpoint get /api/inse-service/institutions/autocomplete
|
||||||
|
* @param query Institution search text, for example \'Duisburg Essen\'.
|
||||||
|
* @param countryCode Optional ISO country code filter.
|
||||||
|
* @param type Optional institution type filter.
|
||||||
|
* @param limit Maximum number of autocomplete options.
|
||||||
|
* @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 autocompleteInstitutions(
|
||||||
|
query: string,
|
||||||
|
countryCode?: string,
|
||||||
|
type?: string,
|
||||||
|
limit?: number,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<AutocompleteResponse>;
|
||||||
|
public autocompleteInstitutions(
|
||||||
|
query: string,
|
||||||
|
countryCode?: string,
|
||||||
|
type?: string,
|
||||||
|
limit?: number,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<AutocompleteResponse>>;
|
||||||
|
public autocompleteInstitutions(
|
||||||
|
query: string,
|
||||||
|
countryCode?: string,
|
||||||
|
type?: string,
|
||||||
|
limit?: number,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<AutocompleteResponse>>;
|
||||||
|
public autocompleteInstitutions(
|
||||||
|
query: string,
|
||||||
|
countryCode?: string,
|
||||||
|
type?: string,
|
||||||
|
limit?: number,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (query === null || query === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter query was null or undefined when calling autocompleteInstitutions.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
* Returns institution options for autocomplete inputs.
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
* @endpoint get /api/inse-service/institutions/autocomplete
|
localVarQueryParameters,
|
||||||
* @param query Institution search text, for example \'Duisburg Essen\'.
|
<any>query,
|
||||||
* @param countryCode Optional ISO country code filter.
|
'query',
|
||||||
* @param type Optional institution type filter.
|
);
|
||||||
* @param limit Maximum number of autocomplete options.
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
localVarQueryParameters,
|
||||||
* @param reportProgress flag to report request and response progress.
|
<any>countryCode,
|
||||||
*/
|
'countryCode',
|
||||||
public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AutocompleteResponse>;
|
);
|
||||||
public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AutocompleteResponse>>;
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AutocompleteResponse>>;
|
localVarQueryParameters,
|
||||||
public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
<any>type,
|
||||||
if (query === null || query === undefined) {
|
'type',
|
||||||
throw new Error('Required parameter query was null or undefined when calling autocompleteInstitutions.');
|
);
|
||||||
}
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>limit,
|
||||||
|
'limit',
|
||||||
|
);
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarHeaders = this.defaultHeaders;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>query, 'query');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>countryCode, 'countryCode');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>type, 'type');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>limit, 'limit');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
]);
|
localVarHeaders = localVarHeaders.set(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'Accept',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
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/institutions/autocomplete`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<AutocompleteResponse>('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 =
|
||||||
* Returns a single institution by ID.
|
options?.context ?? new HttpContext();
|
||||||
* Returns a single institution by its OpenAlex ID.
|
|
||||||
* @endpoint get /api/inse-service/institutions/{id}
|
|
||||||
* @param id
|
|
||||||
* @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 getInstitutionById(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Institution>;
|
|
||||||
public getInstitutionById(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Institution>>;
|
|
||||||
public getInstitutionById(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Institution>>;
|
|
||||||
public getInstitutionById(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (id === null || id === undefined) {
|
|
||||||
throw new Error('Required parameter id was null or undefined when calling getInstitutionById.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
]);
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
responseType_ = 'text';
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
} else if (
|
||||||
}
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
|
||||||
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/institutions/${this.configuration.encodeParam({name: "id", value: id, 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
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarPath = `/api/inse-service/institutions/autocomplete`;
|
||||||
* Returns data for the University Ranking Dashboard.
|
const { basePath, withCredentials } = this.configuration;
|
||||||
* @endpoint get /api/inse-service/university-rankings
|
return this.httpClient.request<AutocompleteResponse>(
|
||||||
* @param topic Research topic (e.g., \'Artificial Intelligence\')
|
'get',
|
||||||
* @param metric Metric to rank by
|
`${basePath}${localVarPath}`,
|
||||||
* @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.
|
context: localVarHttpContext,
|
||||||
*/
|
params: localVarQueryParameters,
|
||||||
public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<RankingResponse>;
|
responseType: <any>responseType_,
|
||||||
public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<RankingResponse>>;
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<RankingResponse>>;
|
headers: localVarHeaders,
|
||||||
public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
observe: observe,
|
||||||
if (topic === null || topic === undefined) {
|
...(localVarTransferCache !== undefined
|
||||||
throw new Error('Required parameter topic was null or undefined when calling getRankingsApiInseServiceUniversityRankingsGet.');
|
? { transferCache: localVarTransferCache }
|
||||||
}
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
/**
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
* Returns a single institution by ID.
|
||||||
<any>topic, 'topic');
|
* Returns a single institution by its OpenAlex ID.
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
* @endpoint get /api/inse-service/institutions/{id}
|
||||||
<any>metric, 'metric');
|
* @param id
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
let localVarHeaders = this.defaultHeaders;
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
public getInstitutionById(
|
||||||
'application/json'
|
id: string,
|
||||||
]);
|
observe?: 'body',
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
reportProgress?: boolean,
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
options?: {
|
||||||
}
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
): Observable<Institution>;
|
||||||
|
public getInstitutionById(
|
||||||
|
id: string,
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
observe?: 'response',
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
reportProgress?: boolean,
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
options?: {
|
||||||
responseType_ = 'text';
|
httpHeaderAccept?: 'application/json';
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
context?: HttpContext;
|
||||||
responseType_ = 'json';
|
transferCache?: boolean;
|
||||||
} else {
|
},
|
||||||
responseType_ = 'blob';
|
): Observable<HttpResponse<Institution>>;
|
||||||
}
|
public getInstitutionById(
|
||||||
}
|
id: string,
|
||||||
|
observe?: 'events',
|
||||||
let localVarPath = `/api/inse-service/university-rankings`;
|
reportProgress?: boolean,
|
||||||
const { basePath, withCredentials } = this.configuration;
|
options?: {
|
||||||
return this.httpClient.request<RankingResponse>('get', `${basePath}${localVarPath}`,
|
httpHeaderAccept?: 'application/json';
|
||||||
{
|
context?: HttpContext;
|
||||||
context: localVarHttpContext,
|
transferCache?: boolean;
|
||||||
params: localVarQueryParameters,
|
},
|
||||||
responseType: <any>responseType_,
|
): Observable<HttpEvent<Institution>>;
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
public getInstitutionById(
|
||||||
headers: localVarHeaders,
|
id: string,
|
||||||
observe: observe,
|
observe: any = 'body',
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
reportProgress: boolean = false,
|
||||||
reportProgress: reportProgress
|
options?: {
|
||||||
}
|
httpHeaderAccept?: 'application/json';
|
||||||
);
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (id === null || id === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter id was null or undefined when calling getInstitutionById.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Returns a list of OpenAlex institutions.
|
|
||||||
* @endpoint get /api/inse-service/institutions
|
|
||||||
* @param search Full-text search, for example \'Duisburg Essen\'.
|
|
||||||
* @param filter OpenAlex filter, for example \'country_code:DE,type:education\'.
|
|
||||||
* @param sort Sort field, for example \'works_count:desc\'.
|
|
||||||
* @param groupBy OpenAlex group_by field, for example \'country_code\'.
|
|
||||||
* @param perPage Results per page.
|
|
||||||
* @param page Page number. Use cursor for deep pagination.
|
|
||||||
* @param cursor Cursor pagination token. Use \'*\' to start.
|
|
||||||
* @param sample Random sample size. Cannot be combined with sort or page.
|
|
||||||
* @param select Comma-separated fields to return.
|
|
||||||
* @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 listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionsListResponse>;
|
|
||||||
public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionsListResponse>>;
|
|
||||||
public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionsListResponse>>;
|
|
||||||
public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
options?.httpHeaderAccept ??
|
||||||
<any>search, 'search');
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
<any>filter, 'filter');
|
localVarHeaders = localVarHeaders.set(
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
'Accept',
|
||||||
<any>sort, 'sort');
|
localVarHttpHeaderAcceptSelected,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
);
|
||||||
<any>groupBy, 'group_by');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>perPage, 'per_page');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>page, 'page');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>cursor, 'cursor');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>sample, 'sample');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>select, 'select');
|
|
||||||
|
|
||||||
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/inse-service/institutions`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<InstitutionsListResponse>('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 =
|
||||||
* Searches for institutions by name.
|
options?.context ?? new HttpContext();
|
||||||
* Searches for institutions by name with pagination.
|
|
||||||
* @endpoint get /api/inse-service/institutions/search
|
|
||||||
* @param name Institution name to search for, for example \'University of Duisburg Essen\'.
|
|
||||||
* @param page Page number (0-indexed).
|
|
||||||
* @param size Number of institutions per page.
|
|
||||||
* @param sortBy Field to sort by, either \'relevance\', \'name\', \'works_count\', or \'citations_count\'.
|
|
||||||
* @param sortingDirection Sorting direction, either \'asc\' or \'desc\'.
|
|
||||||
* @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 searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionPage>;
|
|
||||||
public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionPage>>;
|
|
||||||
public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionPage>>;
|
|
||||||
public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>name, 'name');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>page, 'page');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>size, 'size');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>sortBy, 'sort_by');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>sortingDirection, 'sorting_direction');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
'application/json'
|
responseType_ = 'text';
|
||||||
]);
|
} else if (
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
) {
|
||||||
}
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
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/institutions/search`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<InstitutionPage>('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/inse-service/institutions/${this.configuration.encodeParam({ name: 'id', value: id, 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 OpenAlex institutions.
|
||||||
|
* @endpoint get /api/inse-service/institutions
|
||||||
|
* @param search Full-text search, for example \'Duisburg Essen\'.
|
||||||
|
* @param filter OpenAlex filter, for example \'country_code:DE,type:education\'.
|
||||||
|
* @param sort Sort field, for example \'works_count:desc\'.
|
||||||
|
* @param groupBy OpenAlex group_by field, for example \'country_code\'.
|
||||||
|
* @param perPage Results per page.
|
||||||
|
* @param page Page number. Use cursor for deep pagination.
|
||||||
|
* @param cursor Cursor pagination token. Use \'*\' to start.
|
||||||
|
* @param sample Random sample size. Cannot be combined with sort or page.
|
||||||
|
* @param select Comma-separated fields to return.
|
||||||
|
* @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 listInstitutions(
|
||||||
|
search?: string,
|
||||||
|
filter?: string,
|
||||||
|
sort?: string,
|
||||||
|
groupBy?: string,
|
||||||
|
perPage?: number,
|
||||||
|
page?: number,
|
||||||
|
cursor?: string,
|
||||||
|
sample?: number,
|
||||||
|
select?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<InstitutionsListResponse>;
|
||||||
|
public listInstitutions(
|
||||||
|
search?: string,
|
||||||
|
filter?: string,
|
||||||
|
sort?: string,
|
||||||
|
groupBy?: string,
|
||||||
|
perPage?: number,
|
||||||
|
page?: number,
|
||||||
|
cursor?: string,
|
||||||
|
sample?: number,
|
||||||
|
select?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<InstitutionsListResponse>>;
|
||||||
|
public listInstitutions(
|
||||||
|
search?: string,
|
||||||
|
filter?: string,
|
||||||
|
sort?: string,
|
||||||
|
groupBy?: string,
|
||||||
|
perPage?: number,
|
||||||
|
page?: number,
|
||||||
|
cursor?: string,
|
||||||
|
sample?: number,
|
||||||
|
select?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<InstitutionsListResponse>>;
|
||||||
|
public listInstitutions(
|
||||||
|
search?: string,
|
||||||
|
filter?: string,
|
||||||
|
sort?: string,
|
||||||
|
groupBy?: string,
|
||||||
|
perPage?: number,
|
||||||
|
page?: number,
|
||||||
|
cursor?: string,
|
||||||
|
sample?: number,
|
||||||
|
select?: 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>search,
|
||||||
|
'search',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>filter,
|
||||||
|
'filter',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>sort,
|
||||||
|
'sort',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>groupBy,
|
||||||
|
'group_by',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>perPage,
|
||||||
|
'per_page',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>page,
|
||||||
|
'page',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>cursor,
|
||||||
|
'cursor',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>sample,
|
||||||
|
'sample',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>select,
|
||||||
|
'select',
|
||||||
|
);
|
||||||
|
|
||||||
|
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/inse-service/institutions`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<InstitutionsListResponse>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches for institutions by name.
|
||||||
|
* Searches for institutions by name with pagination.
|
||||||
|
* @endpoint get /api/inse-service/institutions/search
|
||||||
|
* @param name Institution name to search for, for example \'University of Duisburg Essen\'.
|
||||||
|
* @param page Page number (0-indexed).
|
||||||
|
* @param size Number of institutions per page.
|
||||||
|
* @param sortBy Field to sort by, either \'relevance\', \'name\', \'works_count\', or \'citations_count\'.
|
||||||
|
* @param sortingDirection Sorting direction, either \'asc\' or \'desc\'.
|
||||||
|
* @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 searchInstitutionsByName(
|
||||||
|
name?: string,
|
||||||
|
page?: number,
|
||||||
|
size?: number,
|
||||||
|
sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count',
|
||||||
|
sortingDirection?: 'asc' | 'desc',
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<InstitutionPage>;
|
||||||
|
public searchInstitutionsByName(
|
||||||
|
name?: string,
|
||||||
|
page?: number,
|
||||||
|
size?: number,
|
||||||
|
sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count',
|
||||||
|
sortingDirection?: 'asc' | 'desc',
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<InstitutionPage>>;
|
||||||
|
public searchInstitutionsByName(
|
||||||
|
name?: string,
|
||||||
|
page?: number,
|
||||||
|
size?: number,
|
||||||
|
sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count',
|
||||||
|
sortingDirection?: 'asc' | 'desc',
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<InstitutionPage>>;
|
||||||
|
public searchInstitutionsByName(
|
||||||
|
name?: string,
|
||||||
|
page?: number,
|
||||||
|
size?: number,
|
||||||
|
sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count',
|
||||||
|
sortingDirection?: 'asc' | 'desc',
|
||||||
|
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>name,
|
||||||
|
'name',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>page,
|
||||||
|
'page',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>size,
|
||||||
|
'size',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>sortBy,
|
||||||
|
'sort_by',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>sortingDirection,
|
||||||
|
'sorting_direction',
|
||||||
|
);
|
||||||
|
|
||||||
|
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/inse-service/institutions/search`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<InstitutionPage>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* 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 { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { ExtractedKeywordsResponse } from '../model/extractedKeywordsResponse';
|
import { ExtractedKeywordsResponse } from '../model/extractedKeywordsResponse';
|
||||||
@@ -24,84 +30,133 @@ import { HTTPValidationError } from '../model/hTTPValidationError';
|
|||||||
import { KeywordsRequest } from '../model/keywordsRequest';
|
import { KeywordsRequest } from '../model/keywordsRequest';
|
||||||
|
|
||||||
// @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 KeywordsService extends BaseService {
|
export class KeywordsService 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) {
|
/**
|
||||||
super(basePath, configuration);
|
* Extracts keywords from text.
|
||||||
|
* @endpoint post /api/inse-service/keywords/extract
|
||||||
|
* @param keywordsRequest
|
||||||
|
* @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 extractKeywords(
|
||||||
|
keywordsRequest: KeywordsRequest,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<ExtractedKeywordsResponse>;
|
||||||
|
public extractKeywords(
|
||||||
|
keywordsRequest: KeywordsRequest,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<ExtractedKeywordsResponse>>;
|
||||||
|
public extractKeywords(
|
||||||
|
keywordsRequest: KeywordsRequest,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<ExtractedKeywordsResponse>>;
|
||||||
|
public extractKeywords(
|
||||||
|
keywordsRequest: KeywordsRequest,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (keywordsRequest === null || keywordsRequest === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter keywordsRequest was null or undefined when calling extractKeywords.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Extracts keywords from text.
|
|
||||||
* @endpoint post /api/inse-service/keywords/extract
|
|
||||||
* @param keywordsRequest
|
|
||||||
* @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 extractKeywords(keywordsRequest: KeywordsRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<ExtractedKeywordsResponse>;
|
|
||||||
public extractKeywords(keywordsRequest: KeywordsRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ExtractedKeywordsResponse>>;
|
|
||||||
public extractKeywords(keywordsRequest: KeywordsRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ExtractedKeywordsResponse>>;
|
|
||||||
public extractKeywords(keywordsRequest: KeywordsRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (keywordsRequest === null || keywordsRequest === undefined) {
|
|
||||||
throw new Error('Required parameter keywordsRequest was null or undefined when calling extractKeywords.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
]);
|
localVarHeaders = localVarHeaders.set(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'Accept',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
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/inse-service/keywords/extract`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<ExtractedKeywordsResponse>('post', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
body: keywordsRequest,
|
|
||||||
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;
|
||||||
|
|
||||||
|
// 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/inse-service/keywords/extract`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<ExtractedKeywordsResponse>(
|
||||||
|
'post',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
body: keywordsRequest,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1122
-532
File diff suppressed because it is too large
Load Diff
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* 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 { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { CreateOrganizationRequest } from '../model/createOrganizationRequest';
|
import { CreateOrganizationRequest } from '../model/createOrganizationRequest';
|
||||||
@@ -28,287 +34,545 @@ import { OrganizationPage } from '../model/organizationPage';
|
|||||||
import { UpdateOrganizationRequest } from '../model/updateOrganizationRequest';
|
import { UpdateOrganizationRequest } from '../model/updateOrganizationRequest';
|
||||||
|
|
||||||
// @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 OrganizationService extends BaseService {
|
export class OrganizationService 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) {
|
/**
|
||||||
super(basePath, configuration);
|
* Create Organization
|
||||||
|
* @endpoint post /api/organizations
|
||||||
|
* @param createOrganizationRequest
|
||||||
|
* @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 createOrganisation(
|
||||||
|
createOrganizationRequest: CreateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
||||||
|
public createOrganisation(
|
||||||
|
createOrganizationRequest: CreateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<
|
||||||
|
HttpResponse<InseOrganizationManagementModelOrganizationProfile>
|
||||||
|
>;
|
||||||
|
public createOrganisation(
|
||||||
|
createOrganizationRequest: CreateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
||||||
|
public createOrganisation(
|
||||||
|
createOrganizationRequest: CreateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (
|
||||||
|
createOrganizationRequest === null ||
|
||||||
|
createOrganizationRequest === undefined
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Create Organization
|
|
||||||
* @endpoint post /api/organizations
|
|
||||||
* @param createOrganizationRequest
|
|
||||||
* @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 createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
|
||||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InseOrganizationManagementModelOrganizationProfile>>;
|
|
||||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
|
||||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (createOrganizationRequest === null || createOrganizationRequest === undefined) {
|
|
||||||
throw new Error('Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
|
'HTTPBearer',
|
||||||
|
'Authorization',
|
||||||
|
localVarHeaders,
|
||||||
|
'Bearer ',
|
||||||
|
);
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
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;
|
|
||||||
|
|
||||||
|
|
||||||
// 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/organizations`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>('post', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
body: createOrganizationRequest,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Delete Organization
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint delete /api/organizations/{organization_id}
|
|
||||||
* @param organizationId
|
|
||||||
* @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 deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
|
||||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
|
||||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
|
||||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (organizationId === null || organizationId === undefined) {
|
|
||||||
throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganisation.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
// to determine the Content-Type header
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
const consumes: string[] = ['application/json'];
|
||||||
|
const httpContentTypeSelected: string | undefined =
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.selectHeaderContentType(consumes);
|
||||||
'application/json'
|
if (httpContentTypeSelected !== undefined) {
|
||||||
]);
|
localVarHeaders = localVarHeaders.set(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'Content-Type',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
httpContentTypeSelected,
|
||||||
}
|
);
|
||||||
|
|
||||||
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/organizations/${this.configuration.encodeParam({name: "organizationId", value: organizationId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`;
|
|
||||||
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 responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
* Get Organizations
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
* @endpoint get /api/organizations
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
* @param page
|
responseType_ = 'text';
|
||||||
* @param pageSize
|
} else if (
|
||||||
* @param offset
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
* @param secureFgpAcc
|
) {
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
responseType_ = 'json';
|
||||||
* @param reportProgress flag to report request and response progress.
|
} else {
|
||||||
*/
|
responseType_ = 'blob';
|
||||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<OrganizationPage>;
|
}
|
||||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<OrganizationPage>>;
|
|
||||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<OrganizationPage>>;
|
|
||||||
public getOrganisations(page?: number, pageSize?: number, offset?: 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>page, 'page');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>pageSize, 'page_size');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>offset, 'offset');
|
|
||||||
|
|
||||||
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/organizations`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<OrganizationPage>('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/organizations`;
|
||||||
* Update Organization
|
const { basePath, withCredentials } = this.configuration;
|
||||||
* @endpoint put /api/organizations/{organization_id}
|
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>(
|
||||||
* @param organizationId
|
'post',
|
||||||
* @param updateOrganizationRequest
|
`${basePath}${localVarPath}`,
|
||||||
* @param secureFgpAcc
|
{
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
context: localVarHttpContext,
|
||||||
* @param reportProgress flag to report request and response progress.
|
body: createOrganizationRequest,
|
||||||
*/
|
responseType: <any>responseType_,
|
||||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InseOrganizationManagementModelOrganizationProfile>>;
|
headers: localVarHeaders,
|
||||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
observe: observe,
|
||||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
...(localVarTransferCache !== undefined
|
||||||
if (organizationId === null || organizationId === undefined) {
|
? { transferCache: localVarTransferCache }
|
||||||
throw new Error('Required parameter organizationId was null or undefined when calling updateOrganisation.');
|
: {}),
|
||||||
}
|
reportProgress: reportProgress,
|
||||||
if (updateOrganizationRequest === null || updateOrganizationRequest === undefined) {
|
},
|
||||||
throw new Error('Required parameter updateOrganizationRequest was null or undefined when calling updateOrganisation.');
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Delete Organization
|
||||||
// authentication (HTTPBearer) required
|
* @endpoint delete /api/organizations/{organization_id}
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
* @param organizationId
|
||||||
|
* @param secureFgpAcc
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
'application/json'
|
* @param reportProgress flag to report request and response progress.
|
||||||
]);
|
*/
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
public deleteOrganisation(
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
organizationId: string,
|
||||||
}
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
// to determine the Content-Type header
|
},
|
||||||
const consumes: string[] = [
|
): Observable<any>;
|
||||||
'application/json'
|
public deleteOrganisation(
|
||||||
];
|
organizationId: string,
|
||||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
secureFgpAcc?: string,
|
||||||
if (httpContentTypeSelected !== undefined) {
|
observe?: 'response',
|
||||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
reportProgress?: boolean,
|
||||||
}
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
context?: HttpContext;
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
transferCache?: boolean;
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
},
|
||||||
responseType_ = 'text';
|
): Observable<HttpResponse<any>>;
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
public deleteOrganisation(
|
||||||
responseType_ = 'json';
|
organizationId: string,
|
||||||
} else {
|
secureFgpAcc?: string,
|
||||||
responseType_ = 'blob';
|
observe?: 'events',
|
||||||
}
|
reportProgress?: boolean,
|
||||||
}
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
let localVarPath = `/api/organizations/${this.configuration.encodeParam({name: "organizationId", value: organizationId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`;
|
context?: HttpContext;
|
||||||
const { basePath, withCredentials } = this.configuration;
|
transferCache?: boolean;
|
||||||
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>('put', `${basePath}${localVarPath}`,
|
},
|
||||||
{
|
): Observable<HttpEvent<any>>;
|
||||||
context: localVarHttpContext,
|
public deleteOrganisation(
|
||||||
body: updateOrganizationRequest,
|
organizationId: string,
|
||||||
responseType: <any>responseType_,
|
secureFgpAcc?: string,
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
observe: any = 'body',
|
||||||
headers: localVarHeaders,
|
reportProgress: boolean = false,
|
||||||
observe: observe,
|
options?: {
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
httpHeaderAccept?: 'application/json';
|
||||||
reportProgress: reportProgress
|
context?: HttpContext;
|
||||||
}
|
transferCache?: boolean;
|
||||||
);
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (organizationId === null || organizationId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter organizationId was null or undefined when calling deleteOrganisation.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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/organizations/${this.configuration.encodeParam({ name: 'organizationId', value: organizationId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: 'uuid' })}`;
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Organizations
|
||||||
|
* @endpoint get /api/organizations
|
||||||
|
* @param page
|
||||||
|
* @param pageSize
|
||||||
|
* @param offset
|
||||||
|
* @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 getOrganisations(
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
offset?: number,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<OrganizationPage>;
|
||||||
|
public getOrganisations(
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
offset?: number,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<OrganizationPage>>;
|
||||||
|
public getOrganisations(
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
offset?: number,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<OrganizationPage>>;
|
||||||
|
public getOrganisations(
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
offset?: 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>page,
|
||||||
|
'page',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>pageSize,
|
||||||
|
'page_size',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>offset,
|
||||||
|
'offset',
|
||||||
|
);
|
||||||
|
|
||||||
|
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/organizations`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<OrganizationPage>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Organization
|
||||||
|
* @endpoint put /api/organizations/{organization_id}
|
||||||
|
* @param organizationId
|
||||||
|
* @param updateOrganizationRequest
|
||||||
|
* @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 updateOrganisation(
|
||||||
|
organizationId: string,
|
||||||
|
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
||||||
|
public updateOrganisation(
|
||||||
|
organizationId: string,
|
||||||
|
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<
|
||||||
|
HttpResponse<InseOrganizationManagementModelOrganizationProfile>
|
||||||
|
>;
|
||||||
|
public updateOrganisation(
|
||||||
|
organizationId: string,
|
||||||
|
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
||||||
|
public updateOrganisation(
|
||||||
|
organizationId: string,
|
||||||
|
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (organizationId === null || organizationId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter organizationId was null or undefined when calling updateOrganisation.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
updateOrganizationRequest === null ||
|
||||||
|
updateOrganizationRequest === undefined
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter updateOrganizationRequest was null or undefined when calling updateOrganisation.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// 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/organizations/${this.configuration.encodeParam({ name: 'organizationId', value: organizationId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: 'uuid' })}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>(
|
||||||
|
'put',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
body: updateOrganizationRequest,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* 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 { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { AllPatentsResponse } from '../model/allPatentsResponse';
|
import { AllPatentsResponse } from '../model/allPatentsResponse';
|
||||||
@@ -30,338 +36,657 @@ import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse';
|
|||||||
import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse';
|
import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse';
|
||||||
|
|
||||||
// @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 PatentsService extends BaseService {
|
export class PatentsService 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) {
|
/**
|
||||||
super(basePath, configuration);
|
* Get all patents with pagination and search.
|
||||||
|
* @endpoint get /api/inse-service/patents
|
||||||
|
* @param page
|
||||||
|
* @param size
|
||||||
|
* @param search
|
||||||
|
* @param source
|
||||||
|
* @param sortBy
|
||||||
|
* @param sortDirection
|
||||||
|
* @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 getAllPatents(
|
||||||
|
page?: number,
|
||||||
|
size?: number,
|
||||||
|
search?: string,
|
||||||
|
source?: string,
|
||||||
|
sortBy?: string,
|
||||||
|
sortDirection?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<AllPatentsResponse>;
|
||||||
|
public getAllPatents(
|
||||||
|
page?: number,
|
||||||
|
size?: number,
|
||||||
|
search?: string,
|
||||||
|
source?: string,
|
||||||
|
sortBy?: string,
|
||||||
|
sortDirection?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<AllPatentsResponse>>;
|
||||||
|
public getAllPatents(
|
||||||
|
page?: number,
|
||||||
|
size?: number,
|
||||||
|
search?: string,
|
||||||
|
source?: string,
|
||||||
|
sortBy?: string,
|
||||||
|
sortDirection?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<AllPatentsResponse>>;
|
||||||
|
public getAllPatents(
|
||||||
|
page?: number,
|
||||||
|
size?: number,
|
||||||
|
search?: string,
|
||||||
|
source?: string,
|
||||||
|
sortBy?: string,
|
||||||
|
sortDirection?: 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>search,
|
||||||
|
'search',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>source,
|
||||||
|
'source',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>sortBy,
|
||||||
|
'sort_by',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>sortDirection,
|
||||||
|
'sort_direction',
|
||||||
|
);
|
||||||
|
|
||||||
|
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 =
|
||||||
* Get all patents with pagination and search.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/inse-service/patents
|
|
||||||
* @param page
|
|
||||||
* @param size
|
|
||||||
* @param search
|
|
||||||
* @param source
|
|
||||||
* @param sortBy
|
|
||||||
* @param sortDirection
|
|
||||||
* @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 getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AllPatentsResponse>;
|
|
||||||
public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AllPatentsResponse>>;
|
|
||||||
public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AllPatentsResponse>>;
|
|
||||||
public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>page, 'page');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>size, 'size');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>search, 'search');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>source, 'source');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>sortBy, 'sort_by');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>sortDirection, 'sort_direction');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
'application/json'
|
responseType_ = 'text';
|
||||||
]);
|
} else if (
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
) {
|
||||||
}
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
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/patents`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<AllPatentsResponse>('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/inse-service/patents`;
|
||||||
* Get pre-indexed org patents for an institution.
|
const { basePath, withCredentials } = this.configuration;
|
||||||
* @endpoint get /api/inse-service/institutions/{id}/org-patents
|
return this.httpClient.request<AllPatentsResponse>(
|
||||||
* @param id
|
'get',
|
||||||
* @param matchType Filter patents by match type.
|
`${basePath}${localVarPath}`,
|
||||||
* @param page
|
{
|
||||||
* @param size
|
context: localVarHttpContext,
|
||||||
* @param source
|
params: localVarQueryParameters,
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
responseType: <any>responseType_,
|
||||||
* @param reportProgress flag to report request and response progress.
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
*/
|
headers: localVarHeaders,
|
||||||
public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<OrgPatentsResponse>;
|
observe: observe,
|
||||||
public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<OrgPatentsResponse>>;
|
...(localVarTransferCache !== undefined
|
||||||
public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<OrgPatentsResponse>>;
|
? { transferCache: localVarTransferCache }
|
||||||
public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
: {}),
|
||||||
if (id === null || id === undefined) {
|
reportProgress: reportProgress,
|
||||||
throw new Error('Required parameter id was null or undefined when calling getOrgPatentsByInstitution.');
|
},
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
/**
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
* Get pre-indexed org patents for an institution.
|
||||||
<any>matchType, 'match_type');
|
* @endpoint get /api/inse-service/institutions/{id}/org-patents
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
* @param id
|
||||||
<any>page, 'page');
|
* @param matchType Filter patents by match type.
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
* @param page
|
||||||
<any>size, 'size');
|
* @param size
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
* @param source
|
||||||
<any>source, 'source');
|
* @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 localVarHeaders = this.defaultHeaders;
|
*/
|
||||||
|
public getOrgPatentsByInstitution(
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
id: string,
|
||||||
'application/json'
|
matchType?: 'institution' | 'name' | 'both' | 'all',
|
||||||
]);
|
page?: number,
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
size?: number,
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
source?: string,
|
||||||
}
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
): Observable<OrgPatentsResponse>;
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
public getOrgPatentsByInstitution(
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
id: string,
|
||||||
responseType_ = 'text';
|
matchType?: 'institution' | 'name' | 'both' | 'all',
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
page?: number,
|
||||||
responseType_ = 'json';
|
size?: number,
|
||||||
} else {
|
source?: string,
|
||||||
responseType_ = 'blob';
|
observe?: 'response',
|
||||||
}
|
reportProgress?: boolean,
|
||||||
}
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/org-patents`;
|
context?: HttpContext;
|
||||||
const { basePath, withCredentials } = this.configuration;
|
transferCache?: boolean;
|
||||||
return this.httpClient.request<OrgPatentsResponse>('get', `${basePath}${localVarPath}`,
|
},
|
||||||
{
|
): Observable<HttpResponse<OrgPatentsResponse>>;
|
||||||
context: localVarHttpContext,
|
public getOrgPatentsByInstitution(
|
||||||
params: localVarQueryParameters,
|
id: string,
|
||||||
responseType: <any>responseType_,
|
matchType?: 'institution' | 'name' | 'both' | 'all',
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
page?: number,
|
||||||
headers: localVarHeaders,
|
size?: number,
|
||||||
observe: observe,
|
source?: string,
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
observe?: 'events',
|
||||||
reportProgress: reportProgress
|
reportProgress?: boolean,
|
||||||
}
|
options?: {
|
||||||
);
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<OrgPatentsResponse>>;
|
||||||
|
public getOrgPatentsByInstitution(
|
||||||
|
id: string,
|
||||||
|
matchType?: 'institution' | 'name' | 'both' | 'all',
|
||||||
|
page?: number,
|
||||||
|
size?: number,
|
||||||
|
source?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (id === null || id === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter id was null or undefined when calling getOrgPatentsByInstitution.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
* Returns one publication by OpenAlex ID or DOI.
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
* @endpoint get /api/inse-service/patents/{identifier}
|
localVarQueryParameters,
|
||||||
* @param identifier
|
<any>matchType,
|
||||||
* @param prefix Application Prefix (EP or US)
|
'match_type',
|
||||||
* @param title Do we want to fallback to title search if ID and DOI dont work?
|
);
|
||||||
* @param fillingDate Filling date in YYYY-MM-DD format
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
localVarQueryParameters,
|
||||||
* @param reportProgress flag to report request and response progress.
|
<any>page,
|
||||||
*/
|
'page',
|
||||||
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PatentEntry>;
|
);
|
||||||
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PatentEntry>>;
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PatentEntry>>;
|
localVarQueryParameters,
|
||||||
public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
<any>size,
|
||||||
if (identifier === null || identifier === undefined) {
|
'size',
|
||||||
throw new Error('Required parameter identifier was null or undefined when calling getPatentByIdOrTitle.');
|
);
|
||||||
}
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>source,
|
||||||
|
'source',
|
||||||
|
);
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarHeaders = this.defaultHeaders;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>prefix, 'prefix');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>title, 'title');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>fillingDate, 'filling_date');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
]);
|
localVarHeaders = localVarHeaders.set(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'Accept',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
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/patents/${this.configuration.encodeParam({name: "identifier", value: identifier, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<PatentEntry>('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 =
|
||||||
* Get patents matched to an author by name.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/inse-service/authors/{author_id}/patents
|
|
||||||
* @param authorId
|
|
||||||
* @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 getPatentsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PatentsByAuthorResponse>;
|
|
||||||
public getPatentsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PatentsByAuthorResponse>>;
|
|
||||||
public getPatentsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PatentsByAuthorResponse>>;
|
|
||||||
public getPatentsByAuthor(authorId: 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 getPatentsByAuthor.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
]);
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
responseType_ = 'text';
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
} else if (
|
||||||
}
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
|
||||||
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})}/patents`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<PatentsByAuthorResponse>('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/institutions/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/org-patents`;
|
||||||
* Get patents matched to an institution by assignee name.
|
const { basePath, withCredentials } = this.configuration;
|
||||||
* @endpoint get /api/inse-service/institutions/{id}/patents
|
return this.httpClient.request<OrgPatentsResponse>(
|
||||||
* @param id
|
'get',
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
`${basePath}${localVarPath}`,
|
||||||
* @param reportProgress flag to report request and response progress.
|
{
|
||||||
*/
|
context: localVarHttpContext,
|
||||||
public getPatentsByInstitution(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PatentsByInstitutionResponse>;
|
params: localVarQueryParameters,
|
||||||
public getPatentsByInstitution(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PatentsByInstitutionResponse>>;
|
responseType: <any>responseType_,
|
||||||
public getPatentsByInstitution(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PatentsByInstitutionResponse>>;
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
public getPatentsByInstitution(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
headers: localVarHeaders,
|
||||||
if (id === null || id === undefined) {
|
observe: observe,
|
||||||
throw new Error('Required parameter id was null or undefined when calling getPatentsByInstitution.');
|
...(localVarTransferCache !== undefined
|
||||||
}
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Returns one publication by OpenAlex ID or DOI.
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
* @endpoint get /api/inse-service/patents/{identifier}
|
||||||
'application/json'
|
* @param identifier
|
||||||
]);
|
* @param prefix Application Prefix (EP or US)
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
* @param title Do we want to fallback to title search if ID and DOI dont work?
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
* @param fillingDate Filling date in YYYY-MM-DD format
|
||||||
}
|
* @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.
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
*/
|
||||||
|
public getPatentByIdOrTitle(
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
identifier: string,
|
||||||
|
prefix?: string,
|
||||||
|
title?: string,
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
fillingDate?: string,
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
observe?: 'body',
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
reportProgress?: boolean,
|
||||||
responseType_ = 'text';
|
options?: {
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
httpHeaderAccept?: 'application/json';
|
||||||
responseType_ = 'json';
|
context?: HttpContext;
|
||||||
} else {
|
transferCache?: boolean;
|
||||||
responseType_ = 'blob';
|
},
|
||||||
}
|
): Observable<PatentEntry>;
|
||||||
}
|
public getPatentByIdOrTitle(
|
||||||
|
identifier: string,
|
||||||
let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/patents`;
|
prefix?: string,
|
||||||
const { basePath, withCredentials } = this.configuration;
|
title?: string,
|
||||||
return this.httpClient.request<PatentsByInstitutionResponse>('get', `${basePath}${localVarPath}`,
|
fillingDate?: string,
|
||||||
{
|
observe?: 'response',
|
||||||
context: localVarHttpContext,
|
reportProgress?: boolean,
|
||||||
responseType: <any>responseType_,
|
options?: {
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
httpHeaderAccept?: 'application/json';
|
||||||
headers: localVarHeaders,
|
context?: HttpContext;
|
||||||
observe: observe,
|
transferCache?: boolean;
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
},
|
||||||
reportProgress: reportProgress
|
): Observable<HttpResponse<PatentEntry>>;
|
||||||
}
|
public getPatentByIdOrTitle(
|
||||||
);
|
identifier: string,
|
||||||
|
prefix?: string,
|
||||||
|
title?: string,
|
||||||
|
fillingDate?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<PatentEntry>>;
|
||||||
|
public getPatentByIdOrTitle(
|
||||||
|
identifier: string,
|
||||||
|
prefix?: string,
|
||||||
|
title?: string,
|
||||||
|
fillingDate?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (identifier === null || identifier === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter identifier was null or undefined when calling getPatentByIdOrTitle.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>prefix,
|
||||||
|
'prefix',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>title,
|
||||||
|
'title',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>fillingDate,
|
||||||
|
'filling_date',
|
||||||
|
);
|
||||||
|
|
||||||
|
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/inse-service/patents/${this.configuration.encodeParam({ name: 'identifier', value: identifier, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<PatentEntry>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get patents matched to an author by name.
|
||||||
|
* @endpoint get /api/inse-service/authors/{author_id}/patents
|
||||||
|
* @param authorId
|
||||||
|
* @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 getPatentsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<PatentsByAuthorResponse>;
|
||||||
|
public getPatentsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<PatentsByAuthorResponse>>;
|
||||||
|
public getPatentsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<PatentsByAuthorResponse>>;
|
||||||
|
public getPatentsByAuthor(
|
||||||
|
authorId: 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 getPatentsByAuthor.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/patents`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<PatentsByAuthorResponse>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get patents matched to an institution by assignee name.
|
||||||
|
* @endpoint get /api/inse-service/institutions/{id}/patents
|
||||||
|
* @param id
|
||||||
|
* @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 getPatentsByInstitution(
|
||||||
|
id: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<PatentsByInstitutionResponse>;
|
||||||
|
public getPatentsByInstitution(
|
||||||
|
id: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<PatentsByInstitutionResponse>>;
|
||||||
|
public getPatentsByInstitution(
|
||||||
|
id: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<PatentsByInstitutionResponse>>;
|
||||||
|
public getPatentsByInstitution(
|
||||||
|
id: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (id === null || id === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter id was null or undefined when calling getPatentsByInstitution.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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/inse-service/institutions/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/patents`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<PatentsByInstitutionResponse>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* 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 { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { CollaborationNetwork } from '../model/collaborationNetwork';
|
import { CollaborationNetwork } from '../model/collaborationNetwork';
|
||||||
@@ -24,86 +30,139 @@ import { FilterProperties } from '../model/filterProperties';
|
|||||||
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 PersonNetworkService extends BaseService {
|
export class PersonNetworkService 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) {
|
/**
|
||||||
super(basePath, configuration);
|
* Get a person\'s collaboration network.
|
||||||
|
* Returns a person\'s collaboration network based on their works and co-authors.
|
||||||
|
* @endpoint post /api/person/network/{raw_user_id}
|
||||||
|
* @param rawUserId The raw user ID of the person.
|
||||||
|
* @param filterProperties
|
||||||
|
* @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 getCollaborationNetwork(
|
||||||
|
rawUserId: string,
|
||||||
|
filterProperties?: FilterProperties,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<CollaborationNetwork>;
|
||||||
|
public getCollaborationNetwork(
|
||||||
|
rawUserId: string,
|
||||||
|
filterProperties?: FilterProperties,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<CollaborationNetwork>>;
|
||||||
|
public getCollaborationNetwork(
|
||||||
|
rawUserId: string,
|
||||||
|
filterProperties?: FilterProperties,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<CollaborationNetwork>>;
|
||||||
|
public getCollaborationNetwork(
|
||||||
|
rawUserId: string,
|
||||||
|
filterProperties?: FilterProperties,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (rawUserId === null || rawUserId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter rawUserId was null or undefined when calling getCollaborationNetwork.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Get a person\'s collaboration network.
|
|
||||||
* Returns a person\'s collaboration network based on their works and co-authors.
|
|
||||||
* @endpoint post /api/person/network/{raw_user_id}
|
|
||||||
* @param rawUserId The raw user ID of the person.
|
|
||||||
* @param filterProperties
|
|
||||||
* @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 getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CollaborationNetwork>;
|
|
||||||
public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CollaborationNetwork>>;
|
|
||||||
public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CollaborationNetwork>>;
|
|
||||||
public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (rawUserId === null || rawUserId === undefined) {
|
|
||||||
throw new Error('Required parameter rawUserId was null or undefined when calling getCollaborationNetwork.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
]);
|
localVarHeaders = localVarHeaders.set(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'Accept',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
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/person/network/${this.configuration.encodeParam({name: "rawUserId", value: rawUserId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<CollaborationNetwork>('post', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
body: filterProperties,
|
|
||||||
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;
|
||||||
|
|
||||||
|
// 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/person/network/${this.configuration.encodeParam({ name: 'rawUserId', value: rawUserId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<CollaborationNetwork>(
|
||||||
|
'post',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
body: filterProperties,
|
||||||
|
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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,578 @@
|
|||||||
|
/**
|
||||||
|
* 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 { AutocompleteLocationItem } from '../model/autocompleteLocationItem';
|
||||||
|
// @ts-ignore
|
||||||
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
// @ts-ignore
|
||||||
|
import { RankingResponse } from '../model/rankingResponse';
|
||||||
|
// @ts-ignore
|
||||||
|
import { TopInstitutionItem } from '../model/topInstitutionItem';
|
||||||
|
// @ts-ignore
|
||||||
|
import { TrendResponse } from '../model/trendResponse';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class UniversityRankingsService extends BaseService {
|
||||||
|
constructor(
|
||||||
|
protected httpClient: HttpClient,
|
||||||
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||||
|
@Optional() configuration?: Configuration,
|
||||||
|
) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns country and continent options for autocomplete inputs.
|
||||||
|
* @endpoint get /api/inse-service/university-rankings/autocomplete-locations
|
||||||
|
* @param query Query text to search for countries/continents
|
||||||
|
* @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 getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet(
|
||||||
|
query: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<Array<AutocompleteLocationItem>>;
|
||||||
|
public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet(
|
||||||
|
query: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<Array<AutocompleteLocationItem>>>;
|
||||||
|
public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet(
|
||||||
|
query: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<Array<AutocompleteLocationItem>>>;
|
||||||
|
public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet(
|
||||||
|
query: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (query === null || query === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter query was null or undefined when calling getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
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/university-rankings/autocomplete-locations`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<Array<AutocompleteLocationItem>>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns data for the University Ranking Dashboard.
|
||||||
|
* @endpoint get /api/inse-service/university-rankings
|
||||||
|
* @param topic Research topic display name or OpenAlex ID (e.g., \'Artificial Intelligence\')
|
||||||
|
* @param metric Metric to rank by
|
||||||
|
* @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 getRankingsApiInseServiceUniversityRankingsGet(
|
||||||
|
topic: string,
|
||||||
|
metric?: 'publications' | 'citations',
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<RankingResponse>;
|
||||||
|
public getRankingsApiInseServiceUniversityRankingsGet(
|
||||||
|
topic: string,
|
||||||
|
metric?: 'publications' | 'citations',
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<RankingResponse>>;
|
||||||
|
public getRankingsApiInseServiceUniversityRankingsGet(
|
||||||
|
topic: string,
|
||||||
|
metric?: 'publications' | 'citations',
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<RankingResponse>>;
|
||||||
|
public getRankingsApiInseServiceUniversityRankingsGet(
|
||||||
|
topic: string,
|
||||||
|
metric?: 'publications' | 'citations',
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (topic === null || topic === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter topic was null or undefined when calling getRankingsApiInseServiceUniversityRankingsGet.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>topic,
|
||||||
|
'topic',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>metric,
|
||||||
|
'metric',
|
||||||
|
);
|
||||||
|
|
||||||
|
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/inse-service/university-rankings`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<RankingResponse>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns top institutions filtered by country/region and sorted by topic-level publications count.
|
||||||
|
* @endpoint get /api/inse-service/university-rankings/top-institutions
|
||||||
|
* @param topic Research topic
|
||||||
|
* @param region Region identifier (e.g. EU)
|
||||||
|
* @param country Country code (e.g. DE)
|
||||||
|
* @param limit Max suggestions to return
|
||||||
|
* @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 getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet(
|
||||||
|
topic: string,
|
||||||
|
region?: string,
|
||||||
|
country?: string,
|
||||||
|
limit?: number,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<Array<TopInstitutionItem>>;
|
||||||
|
public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet(
|
||||||
|
topic: string,
|
||||||
|
region?: string,
|
||||||
|
country?: string,
|
||||||
|
limit?: number,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<Array<TopInstitutionItem>>>;
|
||||||
|
public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet(
|
||||||
|
topic: string,
|
||||||
|
region?: string,
|
||||||
|
country?: string,
|
||||||
|
limit?: number,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<Array<TopInstitutionItem>>>;
|
||||||
|
public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet(
|
||||||
|
topic: string,
|
||||||
|
region?: string,
|
||||||
|
country?: string,
|
||||||
|
limit?: number,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (topic === null || topic === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter topic was null or undefined when calling getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>topic,
|
||||||
|
'topic',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>region,
|
||||||
|
'region',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>country,
|
||||||
|
'country',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>limit,
|
||||||
|
'limit',
|
||||||
|
);
|
||||||
|
|
||||||
|
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/inse-service/university-rankings/top-institutions`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<Array<TopInstitutionItem>>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns timeseries publication data for compared institutions, countries and regions.
|
||||||
|
* @endpoint get /api/inse-service/university-rankings/trend
|
||||||
|
* @param topics List of topics to analyze
|
||||||
|
* @param institutions List of OpenAlex Institution IDs
|
||||||
|
* @param countries List of country codes
|
||||||
|
* @param regions List of region identifiers
|
||||||
|
* @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 getTrendApiInseServiceUniversityRankingsTrendGet(
|
||||||
|
topics: Array<string>,
|
||||||
|
institutions?: Array<string>,
|
||||||
|
countries?: Array<string>,
|
||||||
|
regions?: Array<string>,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<TrendResponse>;
|
||||||
|
public getTrendApiInseServiceUniversityRankingsTrendGet(
|
||||||
|
topics: Array<string>,
|
||||||
|
institutions?: Array<string>,
|
||||||
|
countries?: Array<string>,
|
||||||
|
regions?: Array<string>,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<TrendResponse>>;
|
||||||
|
public getTrendApiInseServiceUniversityRankingsTrendGet(
|
||||||
|
topics: Array<string>,
|
||||||
|
institutions?: Array<string>,
|
||||||
|
countries?: Array<string>,
|
||||||
|
regions?: Array<string>,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<TrendResponse>>;
|
||||||
|
public getTrendApiInseServiceUniversityRankingsTrendGet(
|
||||||
|
topics: Array<string>,
|
||||||
|
institutions?: Array<string>,
|
||||||
|
countries?: Array<string>,
|
||||||
|
regions?: Array<string>,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (topics === null || topics === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter topics was null or undefined when calling getTrendApiInseServiceUniversityRankingsTrendGet.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
if (topics) {
|
||||||
|
topics.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'topics',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (institutions) {
|
||||||
|
institutions.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'institutions',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (countries) {
|
||||||
|
countries.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'countries',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (regions) {
|
||||||
|
regions.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'regions',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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/inse-service/university-rankings/trend`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<TrendResponse>(
|
||||||
|
'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
+197
-171
@@ -1,193 +1,219 @@
|
|||||||
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
import {
|
||||||
|
HttpHeaders,
|
||||||
|
HttpParams,
|
||||||
|
HttpParameterCodec,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
/**
|
/**
|
||||||
* @deprecated Since 5.0. Use credentials instead
|
* @deprecated Since 5.0. Use credentials instead
|
||||||
*/
|
*/
|
||||||
apiKeys?: {[ key: string ]: string};
|
apiKeys?: { [key: string]: string };
|
||||||
username?: string;
|
username?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
/**
|
/**
|
||||||
* @deprecated Since 5.0. Use credentials instead
|
* @deprecated Since 5.0. Use credentials instead
|
||||||
*/
|
*/
|
||||||
accessToken?: string | (() => string);
|
accessToken?: string | (() => string);
|
||||||
basePath?: string;
|
basePath?: string;
|
||||||
withCredentials?: boolean;
|
withCredentials?: boolean;
|
||||||
/**
|
/**
|
||||||
* Takes care of encoding query- and form-parameters.
|
* Takes care of encoding query- and form-parameters.
|
||||||
*/
|
*/
|
||||||
encoder?: HttpParameterCodec;
|
encoder?: HttpParameterCodec;
|
||||||
/**
|
/**
|
||||||
* Override the default method for encoding path parameters in various
|
* Override the default method for encoding path parameters in various
|
||||||
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
|
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
|
||||||
* <p>
|
* <p>
|
||||||
* See {@link README.md} for more details
|
* See {@link README.md} for more details
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
encodeParam?: (param: Param) => string;
|
encodeParam?: (param: Param) => string;
|
||||||
/**
|
/**
|
||||||
* The keys are the names in the securitySchemes section of the OpenAPI
|
* The keys are the names in the securitySchemes section of the OpenAPI
|
||||||
* document. They should map to the value used for authentication
|
* document. They should map to the value used for authentication
|
||||||
* minus any standard prefixes such as 'Basic' or 'Bearer'.
|
* minus any standard prefixes such as 'Basic' or 'Bearer'.
|
||||||
*/
|
*/
|
||||||
credentials?: {[ key: string ]: string | (() => string | undefined)};
|
credentials?: { [key: string]: string | (() => string | undefined) };
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Configuration {
|
export class Configuration {
|
||||||
/**
|
/**
|
||||||
* @deprecated Since 5.0. Use credentials instead
|
* @deprecated Since 5.0. Use credentials instead
|
||||||
*/
|
*/
|
||||||
apiKeys?: {[ key: string ]: string};
|
apiKeys?: { [key: string]: string };
|
||||||
username?: string;
|
username?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
/**
|
/**
|
||||||
* @deprecated Since 5.0. Use credentials instead
|
* @deprecated Since 5.0. Use credentials instead
|
||||||
*/
|
*/
|
||||||
accessToken?: string | (() => string);
|
accessToken?: string | (() => string);
|
||||||
basePath?: string;
|
basePath?: string;
|
||||||
withCredentials?: boolean;
|
withCredentials?: boolean;
|
||||||
/**
|
/**
|
||||||
* Takes care of encoding query- and form-parameters.
|
* Takes care of encoding query- and form-parameters.
|
||||||
*/
|
*/
|
||||||
encoder?: HttpParameterCodec;
|
encoder?: HttpParameterCodec;
|
||||||
/**
|
/**
|
||||||
* Encoding of various path parameter
|
* Encoding of various path parameter
|
||||||
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
|
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
|
||||||
* <p>
|
* <p>
|
||||||
* See {@link README.md} for more details
|
* See {@link README.md} for more details
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
encodeParam: (param: Param) => string;
|
encodeParam: (param: Param) => string;
|
||||||
/**
|
/**
|
||||||
* The keys are the names in the securitySchemes section of the OpenAPI
|
* The keys are the names in the securitySchemes section of the OpenAPI
|
||||||
* document. They should map to the value used for authentication
|
* document. They should map to the value used for authentication
|
||||||
* minus any standard prefixes such as 'Basic' or 'Bearer'.
|
* minus any standard prefixes such as 'Basic' or 'Bearer'.
|
||||||
*/
|
*/
|
||||||
credentials: {[ key: string ]: string | (() => string | undefined)};
|
credentials: { [key: string]: string | (() => string | undefined) };
|
||||||
|
|
||||||
constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) {
|
constructor({
|
||||||
if (apiKeys) {
|
accessToken,
|
||||||
this.apiKeys = apiKeys;
|
apiKeys,
|
||||||
}
|
basePath,
|
||||||
if (username !== undefined) {
|
credentials,
|
||||||
this.username = username;
|
encodeParam,
|
||||||
}
|
encoder,
|
||||||
if (password !== undefined) {
|
password,
|
||||||
this.password = password;
|
username,
|
||||||
}
|
withCredentials,
|
||||||
if (accessToken !== undefined) {
|
}: ConfigurationParameters = {}) {
|
||||||
this.accessToken = accessToken;
|
if (apiKeys) {
|
||||||
}
|
this.apiKeys = apiKeys;
|
||||||
if (basePath !== undefined) {
|
}
|
||||||
this.basePath = basePath;
|
if (username !== undefined) {
|
||||||
}
|
this.username = username;
|
||||||
if (withCredentials !== undefined) {
|
}
|
||||||
this.withCredentials = withCredentials;
|
if (password !== undefined) {
|
||||||
}
|
this.password = password;
|
||||||
if (encoder) {
|
}
|
||||||
this.encoder = encoder;
|
if (accessToken !== undefined) {
|
||||||
}
|
this.accessToken = accessToken;
|
||||||
this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param));
|
}
|
||||||
this.credentials = credentials ?? {};
|
if (basePath !== undefined) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
}
|
||||||
|
if (withCredentials !== undefined) {
|
||||||
|
this.withCredentials = withCredentials;
|
||||||
|
}
|
||||||
|
if (encoder) {
|
||||||
|
this.encoder = encoder;
|
||||||
|
}
|
||||||
|
this.encodeParam =
|
||||||
|
encodeParam ?? ((param) => this.defaultEncodeParam(param));
|
||||||
|
this.credentials = credentials ?? {};
|
||||||
|
|
||||||
// init default HTTPBearer credential
|
// init default HTTPBearer credential
|
||||||
if (!this.credentials['HTTPBearer']) {
|
if (!this.credentials['HTTPBearer']) {
|
||||||
this.credentials['HTTPBearer'] = () => {
|
this.credentials['HTTPBearer'] = () => {
|
||||||
return typeof this.accessToken === 'function'
|
return typeof this.accessToken === 'function'
|
||||||
? this.accessToken()
|
? this.accessToken()
|
||||||
: this.accessToken;
|
: this.accessToken;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the correct content-type to use for a request.
|
||||||
|
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
|
||||||
|
* If no content type is found return the first found type if the contentTypes is not empty
|
||||||
|
* @param contentTypes - the array of content types that are available for selection
|
||||||
|
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
||||||
|
*/
|
||||||
|
public selectHeaderContentType(contentTypes: string[]): string | undefined {
|
||||||
|
if (contentTypes.length === 0) {
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const type = contentTypes.find((x: string) => this.isJsonMime(x));
|
||||||
* Select the correct content-type to use for a request.
|
if (type === undefined) {
|
||||||
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
|
return contentTypes[0];
|
||||||
* If no content type is found return the first found type if the contentTypes is not empty
|
}
|
||||||
* @param contentTypes - the array of content types that are available for selection
|
return type;
|
||||||
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
}
|
||||||
*/
|
|
||||||
public selectHeaderContentType (contentTypes: string[]): string | undefined {
|
|
||||||
if (contentTypes.length === 0) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const type = contentTypes.find((x: string) => this.isJsonMime(x));
|
/**
|
||||||
if (type === undefined) {
|
* Select the correct accept content-type to use for a request.
|
||||||
return contentTypes[0];
|
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
|
||||||
}
|
* If no content type is found return the first found type if the contentTypes is not empty
|
||||||
return type;
|
* @param accepts - the array of content types that are available for selection.
|
||||||
|
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
||||||
|
*/
|
||||||
|
public selectHeaderAccept(accepts: string[]): string | undefined {
|
||||||
|
if (accepts.length === 0) {
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const type = accepts.find((x: string) => this.isJsonMime(x));
|
||||||
* Select the correct accept content-type to use for a request.
|
if (type === undefined) {
|
||||||
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
|
return accepts[0];
|
||||||
* If no content type is found return the first found type if the contentTypes is not empty
|
|
||||||
* @param accepts - the array of content types that are available for selection.
|
|
||||||
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
|
||||||
*/
|
|
||||||
public selectHeaderAccept(accepts: string[]): string | undefined {
|
|
||||||
if (accepts.length === 0) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const type = accepts.find((x: string) => this.isJsonMime(x));
|
|
||||||
if (type === undefined) {
|
|
||||||
return accepts[0];
|
|
||||||
}
|
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the given MIME is a JSON MIME.
|
* Check if the given MIME is a JSON MIME.
|
||||||
* JSON MIME examples:
|
* JSON MIME examples:
|
||||||
* application/json
|
* application/json
|
||||||
* application/json; charset=UTF8
|
* application/json; charset=UTF8
|
||||||
* APPLICATION/JSON
|
* APPLICATION/JSON
|
||||||
* application/vnd.company+json
|
* application/vnd.company+json
|
||||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||||
* @return True if the given MIME is JSON, false otherwise.
|
* @return True if the given MIME is JSON, false otherwise.
|
||||||
*/
|
*/
|
||||||
public isJsonMime(mime: string): boolean {
|
public isJsonMime(mime: string): boolean {
|
||||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
const jsonMime: RegExp = new RegExp(
|
||||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
'^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$',
|
||||||
}
|
'i',
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
mime !== null &&
|
||||||
|
(jsonMime.test(mime) ||
|
||||||
|
mime.toLowerCase() === 'application/json-patch+json')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public lookupCredential(key: string): string | undefined {
|
public lookupCredential(key: string): string | undefined {
|
||||||
const value = this.credentials[key];
|
const value = this.credentials[key];
|
||||||
return typeof value === 'function'
|
return typeof value === 'function' ? value() : value;
|
||||||
? value()
|
}
|
||||||
: value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
public addCredentialToHeaders(
|
||||||
const value = this.lookupCredential(credentialKey);
|
credentialKey: string,
|
||||||
return value
|
headerName: string,
|
||||||
? headers.set(headerName, (prefix ?? '') + value)
|
headers: HttpHeaders,
|
||||||
: headers;
|
prefix?: string,
|
||||||
}
|
): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value ? headers.set(headerName, (prefix ?? '') + value) : headers;
|
||||||
|
}
|
||||||
|
|
||||||
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
public addCredentialToQuery(
|
||||||
const value = this.lookupCredential(credentialKey);
|
credentialKey: string,
|
||||||
return value
|
paramName: string,
|
||||||
? query.set(paramName, value)
|
query: HttpParams,
|
||||||
: query;
|
): HttpParams {
|
||||||
}
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value ? query.set(paramName, value) : query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
// It only works for the 'simple' parameter style.
|
// It only works for the 'simple' parameter style.
|
||||||
// Date-handling only works for the 'date-time' format.
|
// Date-handling only works for the 'date-time' format.
|
||||||
// All other styles and Date-formats are probably handled incorrectly.
|
// All other styles and Date-formats are probably handled incorrectly.
|
||||||
//
|
//
|
||||||
// But: if that's all you need (i.e.: the most common use-case): no need for customization!
|
// But: if that's all you need (i.e.: the most common use-case): no need for customization!
|
||||||
|
|
||||||
const value = param.dataFormat === 'date-time' && param.value instanceof Date
|
const value =
|
||||||
? (param.value as Date).toISOString()
|
param.dataFormat === 'date-time' && param.value instanceof Date
|
||||||
: param.value;
|
? (param.value as Date).toISOString()
|
||||||
|
: param.value;
|
||||||
|
|
||||||
return encodeURIComponent(String(value));
|
return encodeURIComponent(String(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import { HttpParameterCodec } from '@angular/common/http';
|
|||||||
* Workaround for https://github.com/angular/angular/issues/18261
|
* Workaround for https://github.com/angular/angular/issues/18261
|
||||||
*/
|
*/
|
||||||
export class CustomHttpParameterCodec implements HttpParameterCodec {
|
export class CustomHttpParameterCodec implements HttpParameterCodec {
|
||||||
encodeKey(k: string): string {
|
encodeKey(k: string): string {
|
||||||
return encodeURIComponent(k);
|
return encodeURIComponent(k);
|
||||||
}
|
}
|
||||||
encodeValue(v: string): string {
|
encodeValue(v: string): string {
|
||||||
return encodeURIComponent(v);
|
return encodeURIComponent(v);
|
||||||
}
|
}
|
||||||
decodeKey(k: string): string {
|
decodeKey(k: string): string {
|
||||||
return decodeURIComponent(k);
|
return decodeURIComponent(k);
|
||||||
}
|
}
|
||||||
decodeValue(v: string): string {
|
decodeValue(v: string): string {
|
||||||
return decodeURIComponent(v);
|
return decodeURIComponent(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,9 @@
|
|||||||
*/
|
*/
|
||||||
import { AccessToken } from './accessToken';
|
import { AccessToken } from './accessToken';
|
||||||
|
|
||||||
|
|
||||||
export interface AccessResponse {
|
export interface AccessResponse {
|
||||||
/**
|
/**
|
||||||
* The access token issued upon successful authentication.
|
* The access token issued upon successful authentication.
|
||||||
*/
|
*/
|
||||||
access_token: AccessToken;
|
access_token: AccessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,46 +10,42 @@
|
|||||||
import { TokenType } from './tokenType';
|
import { TokenType } from './tokenType';
|
||||||
import { UserRole } from './userRole';
|
import { UserRole } from './userRole';
|
||||||
|
|
||||||
|
|
||||||
export interface AccessToken {
|
export interface AccessToken {
|
||||||
/**
|
/**
|
||||||
* The unique identifier of the real account associated with this token.
|
* The unique identifier of the real account associated with this token.
|
||||||
*/
|
*/
|
||||||
real_account_id: string;
|
real_account_id: string;
|
||||||
/**
|
/**
|
||||||
* The timestamp indicating when the token will expire.
|
* The timestamp indicating when the token will expire.
|
||||||
*/
|
*/
|
||||||
expires_at: string;
|
expires_at: string;
|
||||||
/**
|
/**
|
||||||
* The epoch value for the token. Used for versioning of tokens.
|
* The epoch value for the token. Used for versioning of tokens.
|
||||||
*/
|
*/
|
||||||
epoch?: number;
|
epoch?: number;
|
||||||
/**
|
/**
|
||||||
* The type of the token, which is always ACCESS_TOKEN for this class.
|
* The type of the token, which is always ACCESS_TOKEN for this class.
|
||||||
*/
|
*/
|
||||||
token_type?: TokenType;
|
token_type?: TokenType;
|
||||||
/**
|
/**
|
||||||
* A unique fingerprint of the user, used for additional security checks.
|
* A unique fingerprint of the user, used for additional security checks.
|
||||||
*/
|
*/
|
||||||
user_fingerprint_hash: string;
|
user_fingerprint_hash: string;
|
||||||
/**
|
/**
|
||||||
* The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation.
|
* The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation.
|
||||||
*/
|
*/
|
||||||
effective_account_id: string;
|
effective_account_id: string;
|
||||||
/**
|
/**
|
||||||
* The specific role this access token grants within its organization.
|
* The specific role this access token grants within its organization.
|
||||||
*/
|
*/
|
||||||
effective_role?: UserRole;
|
effective_role?: UserRole;
|
||||||
/**
|
/**
|
||||||
* The unique identifier of the organization associated with this access token.
|
* The unique identifier of the organization associated with this access token.
|
||||||
*/
|
*/
|
||||||
effective_organization_id: string;
|
effective_organization_id: string;
|
||||||
/**
|
/**
|
||||||
* The raw string representation of the access token. This is the actual token that can be used for authentication and authorization purposes.
|
* The raw string representation of the access token. This is the actual token that can be used for authentication and authorization purposes.
|
||||||
*/
|
*/
|
||||||
raw_token: string;
|
raw_token: string;
|
||||||
}
|
}
|
||||||
export namespace AccessToken {
|
export namespace AccessToken {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,9 @@
|
|||||||
*/
|
*/
|
||||||
import { AccountProfile } from './accountProfile';
|
import { AccountProfile } from './accountProfile';
|
||||||
|
|
||||||
|
|
||||||
export interface AccountPage {
|
export interface AccountPage {
|
||||||
items: Array<AccountProfile>;
|
items: Array<AccountProfile>;
|
||||||
total: number;
|
total: number;
|
||||||
page: number;
|
page: number;
|
||||||
page_size: number;
|
page_size: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,21 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
import { UserRole } from './userRole';
|
import { UserRole } from './userRole';
|
||||||
|
|
||||||
|
|
||||||
export interface AccountProfile {
|
export interface AccountProfile {
|
||||||
id: string;
|
id: string;
|
||||||
email: string;
|
email: string;
|
||||||
name: string;
|
name: string;
|
||||||
role: UserRole;
|
role: UserRole;
|
||||||
organization_id: string;
|
permissions?: Array<string>;
|
||||||
organization_name: string;
|
organization_id: string;
|
||||||
deleted: boolean;
|
organization_name: string;
|
||||||
activated: boolean;
|
deleted: boolean;
|
||||||
is_current?: boolean;
|
activated: boolean;
|
||||||
is_real_account?: boolean;
|
is_current?: boolean;
|
||||||
is_impersonating?: boolean;
|
is_real_account?: boolean;
|
||||||
|
is_impersonating?: boolean;
|
||||||
}
|
}
|
||||||
export namespace AccountProfile {
|
export namespace AccountProfile {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,9 @@
|
|||||||
*/
|
*/
|
||||||
import { PatentEntry } from './patentEntry';
|
import { PatentEntry } from './patentEntry';
|
||||||
|
|
||||||
|
|
||||||
export interface AllPatentsResponse {
|
export interface AllPatentsResponse {
|
||||||
total: number;
|
total: number;
|
||||||
page: number;
|
page: number;
|
||||||
size: number;
|
size: number;
|
||||||
patents: Array<PatentEntry>;
|
patents: Array<PatentEntry>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,27 +15,25 @@ import { AuthorIds } from './authorIds';
|
|||||||
import { AuthorSummaryStats } from './authorSummaryStats';
|
import { AuthorSummaryStats } from './authorSummaryStats';
|
||||||
import { WorkTopic } from './workTopic';
|
import { WorkTopic } from './workTopic';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A person who creates scholarly works
|
* A person who creates scholarly works
|
||||||
*/
|
*/
|
||||||
export interface Author {
|
export interface Author {
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
orcid?: string | null;
|
orcid?: string | null;
|
||||||
display_name?: string | null;
|
display_name?: string | null;
|
||||||
display_name_alternatives?: Array<string> | null;
|
display_name_alternatives?: Array<string> | null;
|
||||||
longest_name?: string | null;
|
longest_name?: string | null;
|
||||||
parsed_longest_name?: AuthorParsedLongestName | null;
|
parsed_longest_name?: AuthorParsedLongestName | null;
|
||||||
works_count?: number | null;
|
works_count?: number | null;
|
||||||
cited_by_count?: number | null;
|
cited_by_count?: number | null;
|
||||||
summary_stats?: AuthorSummaryStats | null;
|
summary_stats?: AuthorSummaryStats | null;
|
||||||
affiliations?: Array<AuthorAffiliationsInner> | null;
|
affiliations?: Array<AuthorAffiliationsInner> | null;
|
||||||
last_known_institutions?: Array<DehydratedInstitution> | null;
|
last_known_institutions?: Array<DehydratedInstitution> | null;
|
||||||
topics?: Array<WorkTopic> | null;
|
topics?: Array<WorkTopic> | null;
|
||||||
counts_by_year?: Array<AuthorCountsByYearInner> | null;
|
counts_by_year?: Array<AuthorCountsByYearInner> | null;
|
||||||
ids?: AuthorIds | null;
|
ids?: AuthorIds | null;
|
||||||
works_api_url?: string | null;
|
works_api_url?: string | null;
|
||||||
created_date?: string | null;
|
created_date?: string | null;
|
||||||
updated_date?: string | null;
|
updated_date?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,10 @@
|
|||||||
*/
|
*/
|
||||||
import { DehydratedInstitution } from './dehydratedInstitution';
|
import { DehydratedInstitution } from './dehydratedInstitution';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AuthorAffiliationsInner
|
* AuthorAffiliationsInner
|
||||||
*/
|
*/
|
||||||
export interface AuthorAffiliationsInner {
|
export interface AuthorAffiliationsInner {
|
||||||
institution?: DehydratedInstitution | null;
|
institution?: DehydratedInstitution | null;
|
||||||
years?: Array<number> | null;
|
years?: Array<number> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,11 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AuthorCountsByYearInner
|
* AuthorCountsByYearInner
|
||||||
*/
|
*/
|
||||||
export interface AuthorCountsByYearInner {
|
export interface AuthorCountsByYearInner {
|
||||||
year?: number | null;
|
year?: number | null;
|
||||||
works_count?: number | null;
|
works_count?: number | null;
|
||||||
cited_by_count?: number | null;
|
cited_by_count?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,11 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* External identifiers:
|
* External identifiers:
|
||||||
*/
|
*/
|
||||||
export interface AuthorIds {
|
export interface AuthorIds {
|
||||||
openalex?: string | null;
|
openalex?: string | null;
|
||||||
orcid?: string | null;
|
orcid?: string | null;
|
||||||
scopus?: string | null;
|
scopus?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,22 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType';
|
import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType';
|
||||||
|
|
||||||
|
|
||||||
export interface AuthorNetworkNode {
|
export interface AuthorNetworkNode {
|
||||||
/**
|
/**
|
||||||
* The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID.
|
* The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID.
|
||||||
*/
|
*/
|
||||||
raw_id: string;
|
raw_id: string;
|
||||||
/**
|
/**
|
||||||
* The display name of the node.
|
* The display name of the node.
|
||||||
*/
|
*/
|
||||||
display_name: string;
|
display_name: string;
|
||||||
/**
|
/**
|
||||||
* The category of the node, either \'author\', \'institution\', or \'work\'.
|
* The category of the node, either \'author\', \'institution\', or \'work\'.
|
||||||
*/
|
*/
|
||||||
category: CollaborationNetworkNodeType;
|
category: CollaborationNetworkNodeType;
|
||||||
}
|
}
|
||||||
export namespace AuthorNetworkNode {
|
export namespace AuthorNetworkNode {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,13 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The longest name parsed into its component parts.
|
* The longest name parsed into its component parts.
|
||||||
*/
|
*/
|
||||||
export interface AuthorParsedLongestName {
|
export interface AuthorParsedLongestName {
|
||||||
first?: string | null;
|
first?: string | null;
|
||||||
middle?: string | null;
|
middle?: string | null;
|
||||||
last?: string | null;
|
last?: string | null;
|
||||||
suffix?: string | null;
|
suffix?: string | null;
|
||||||
nickname?: string | null;
|
nickname?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,9 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface AuthorPositionCount {
|
export interface AuthorPositionCount {
|
||||||
first?: number;
|
first?: number;
|
||||||
middle?: number;
|
middle?: number;
|
||||||
last?: number;
|
last?: number;
|
||||||
unknown?: number;
|
unknown?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,11 @@
|
|||||||
*/
|
*/
|
||||||
import { Model2YrMeanCitedness } from './model2YrMeanCitedness';
|
import { Model2YrMeanCitedness } from './model2YrMeanCitedness';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Citation metrics:
|
* Citation metrics:
|
||||||
*/
|
*/
|
||||||
export interface AuthorSummaryStats {
|
export interface AuthorSummaryStats {
|
||||||
'2yr_mean_citedness'?: Model2YrMeanCitedness | null;
|
'2yr_mean_citedness'?: Model2YrMeanCitedness | null;
|
||||||
h_index?: number | null;
|
h_index?: number | null;
|
||||||
i10_index?: number | null;
|
i10_index?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,19 +8,17 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface AuthorsFilterProperties {
|
export interface AuthorsFilterProperties {
|
||||||
/**
|
/**
|
||||||
* The list of raw institution IDs to include in the collaboration network. If empty, all institutions will be included.
|
* The list of raw institution IDs to include in the collaboration network. If empty, all institutions will be included.
|
||||||
*/
|
*/
|
||||||
allowed_institutions?: Array<string>;
|
allowed_institutions?: Array<string>;
|
||||||
/**
|
/**
|
||||||
* The minimum number of collaborations required for an author to be included in the collaboration network.
|
* The minimum number of collaborations required for an author to be included in the collaboration network.
|
||||||
*/
|
*/
|
||||||
min_collaborations?: number;
|
min_collaborations?: number;
|
||||||
/**
|
/**
|
||||||
* The maximum number of collaborations allowed for an author to be included in the collaboration network.
|
* The maximum number of collaborations allowed for an author to be included in the collaboration network.
|
||||||
*/
|
*/
|
||||||
max_collaborations?: number;
|
max_collaborations?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,11 @@ import { Meta } from './meta';
|
|||||||
import { Author } from './author';
|
import { Author } from './author';
|
||||||
import { GroupByResult } from './groupByResult';
|
import { GroupByResult } from './groupByResult';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AuthorsListResponse
|
* AuthorsListResponse
|
||||||
*/
|
*/
|
||||||
export interface AuthorsListResponse {
|
export interface AuthorsListResponse {
|
||||||
meta?: Meta | null;
|
meta?: Meta | null;
|
||||||
results?: Array<Author> | null;
|
results?: Array<Author> | null;
|
||||||
group_by?: Array<GroupByResult> | null;
|
group_by?: Array<GroupByResult> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,17 +10,15 @@
|
|||||||
import { DehydratedInstitution } from './dehydratedInstitution';
|
import { DehydratedInstitution } from './dehydratedInstitution';
|
||||||
import { DehydratedAuthor } from './dehydratedAuthor';
|
import { DehydratedAuthor } from './dehydratedAuthor';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author and their affiliation for a work
|
* Author and their affiliation for a work
|
||||||
*/
|
*/
|
||||||
export interface Authorship {
|
export interface Authorship {
|
||||||
author_position?: string | null;
|
author_position?: string | null;
|
||||||
author?: DehydratedAuthor | null;
|
author?: DehydratedAuthor | null;
|
||||||
institutions?: Array<DehydratedInstitution> | null;
|
institutions?: Array<DehydratedInstitution> | null;
|
||||||
countries?: Array<string> | null;
|
countries?: Array<string> | null;
|
||||||
is_corresponding?: boolean | null;
|
is_corresponding?: boolean | null;
|
||||||
raw_author_name?: string | null;
|
raw_author_name?: string | null;
|
||||||
raw_affiliation_strings?: Array<string> | null;
|
raw_affiliation_strings?: Array<string> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface AutocompleteLocationItem {
|
||||||
|
id: string;
|
||||||
|
display_name: string;
|
||||||
|
code: string;
|
||||||
|
type: AutocompleteLocationItem.TypeEnum;
|
||||||
|
}
|
||||||
|
export namespace AutocompleteLocationItem {
|
||||||
|
export const TypeEnum = {
|
||||||
|
Country: 'country',
|
||||||
|
Continent: 'continent',
|
||||||
|
} as const;
|
||||||
|
export type TypeEnum = (typeof TypeEnum)[keyof typeof TypeEnum];
|
||||||
|
}
|
||||||
@@ -10,12 +10,10 @@
|
|||||||
import { AutocompleteResponseMeta } from './autocompleteResponseMeta';
|
import { AutocompleteResponseMeta } from './autocompleteResponseMeta';
|
||||||
import { AutocompleteResponseResultsInner } from './autocompleteResponseResultsInner';
|
import { AutocompleteResponseResultsInner } from './autocompleteResponseResultsInner';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AutocompleteResponse
|
* AutocompleteResponse
|
||||||
*/
|
*/
|
||||||
export interface AutocompleteResponse {
|
export interface AutocompleteResponse {
|
||||||
meta?: AutocompleteResponseMeta | null;
|
meta?: AutocompleteResponseMeta | null;
|
||||||
results?: Array<AutocompleteResponseResultsInner> | null;
|
results?: Array<AutocompleteResponseResultsInner> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,10 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AutocompleteResponseMeta
|
* AutocompleteResponseMeta
|
||||||
*/
|
*/
|
||||||
export interface AutocompleteResponseMeta {
|
export interface AutocompleteResponseMeta {
|
||||||
count?: number | null;
|
count?: number | null;
|
||||||
db_response_time_ms?: number | null;
|
db_response_time_ms?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,17 +8,15 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AutocompleteResponseResultsInner
|
* AutocompleteResponseResultsInner
|
||||||
*/
|
*/
|
||||||
export interface AutocompleteResponseResultsInner {
|
export interface AutocompleteResponseResultsInner {
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
display_name?: string | null;
|
display_name?: string | null;
|
||||||
hint?: string | null;
|
hint?: string | null;
|
||||||
cited_by_count?: number | null;
|
cited_by_count?: number | null;
|
||||||
works_count?: number | null;
|
works_count?: number | null;
|
||||||
entity_type?: string | null;
|
entity_type?: string | null;
|
||||||
external_id?: string | null;
|
external_id?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,16 +8,14 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Award
|
* Award
|
||||||
*/
|
*/
|
||||||
export interface Award {
|
export interface Award {
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
display_name?: string | null;
|
display_name?: string | null;
|
||||||
funder_award_id?: string | null;
|
funder_award_id?: string | null;
|
||||||
funder_id?: string | null;
|
funder_id?: string | null;
|
||||||
funder_display_name?: string | null;
|
funder_display_name?: string | null;
|
||||||
doi?: string | null;
|
doi?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,13 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface BodyChangePassword {
|
export interface BodyChangePassword {
|
||||||
/**
|
/**
|
||||||
* Current password
|
* Current password
|
||||||
*/
|
*/
|
||||||
current_password: string;
|
current_password: string;
|
||||||
/**
|
/**
|
||||||
* New password
|
* New password
|
||||||
*/
|
*/
|
||||||
new_password: string;
|
new_password: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,13 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface BodyGetAccessToken {
|
export interface BodyGetAccessToken {
|
||||||
/**
|
/**
|
||||||
* User\'s account ID
|
* User\'s account ID
|
||||||
*/
|
*/
|
||||||
real_account_id: string;
|
real_account_id: string;
|
||||||
/**
|
/**
|
||||||
* Effective account ID for the access token
|
* Effective account ID for the access token
|
||||||
*/
|
*/
|
||||||
effective_account_id: string;
|
effective_account_id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,13 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface BodyLogin {
|
export interface BodyLogin {
|
||||||
/**
|
/**
|
||||||
* User\'s account ID
|
* User\'s account ID
|
||||||
*/
|
*/
|
||||||
account_id: string;
|
account_id: string;
|
||||||
/**
|
/**
|
||||||
* One-time code sent to user\'s email
|
* One-time code sent to user\'s email
|
||||||
*/
|
*/
|
||||||
email_code: string;
|
email_code: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,13 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface BodyRequestOtk {
|
export interface BodyRequestOtk {
|
||||||
/**
|
/**
|
||||||
* User\'s email address
|
* User\'s email address
|
||||||
*/
|
*/
|
||||||
email: string;
|
email: string;
|
||||||
/**
|
/**
|
||||||
* User\'s password
|
* User\'s password
|
||||||
*/
|
*/
|
||||||
password: string;
|
password: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface BodyRequestPasswordReset {
|
||||||
|
/**
|
||||||
|
* User's email address
|
||||||
|
*/
|
||||||
|
email: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface BodyResetPassword {
|
||||||
|
/**
|
||||||
|
* Password reset token from the reset link
|
||||||
|
*/
|
||||||
|
reset_token: string;
|
||||||
|
/**
|
||||||
|
* New password
|
||||||
|
*/
|
||||||
|
new_password: string;
|
||||||
|
}
|
||||||
@@ -8,35 +8,33 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface BundProject {
|
export interface BundProject {
|
||||||
funding_code?: string | null;
|
funding_code?: string | null;
|
||||||
department?: string | null;
|
department?: string | null;
|
||||||
department_fullname?: string | null;
|
department_fullname?: string | null;
|
||||||
referat?: string | null;
|
referat?: string | null;
|
||||||
project_sponsor?: string | null;
|
project_sponsor?: string | null;
|
||||||
project_sponsor_fullname?: string | null;
|
project_sponsor_fullname?: string | null;
|
||||||
work_unit?: string | null;
|
work_unit?: string | null;
|
||||||
recipient?: string | null;
|
recipient?: string | null;
|
||||||
municipal_code?: string | null;
|
municipal_code?: string | null;
|
||||||
municipality?: string | null;
|
municipality?: string | null;
|
||||||
place?: string | null;
|
place?: string | null;
|
||||||
state?: string | null;
|
state?: string | null;
|
||||||
country?: string | null;
|
country?: string | null;
|
||||||
implementing_agency?: string | null;
|
implementing_agency?: string | null;
|
||||||
topic?: string | null;
|
topic?: string | null;
|
||||||
performance_plan_system?: string | null;
|
performance_plan_system?: string | null;
|
||||||
performance_plan_system_text?: string | null;
|
performance_plan_system_text?: string | null;
|
||||||
funding_start?: string | null;
|
funding_start?: string | null;
|
||||||
funding_end?: string | null;
|
funding_end?: string | null;
|
||||||
grant_amount?: number | null;
|
grant_amount?: number | null;
|
||||||
funding_profile?: string | null;
|
funding_profile?: string | null;
|
||||||
joint_project?: string | null;
|
joint_project?: string | null;
|
||||||
funding_type?: string | null;
|
funding_type?: string | null;
|
||||||
publication_date?: string | null;
|
publication_date?: string | null;
|
||||||
unix_timestamp?: number | null;
|
unix_timestamp?: number | null;
|
||||||
date?: string | null;
|
date?: string | null;
|
||||||
'new'?: boolean | null;
|
new?: boolean | null;
|
||||||
duration?: string | null;
|
duration?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,50 +8,48 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean summary model for a Bund (federal) project, consolidating all fields into semantic English names with proper native types.
|
* Clean summary model for a Bund (federal) project, consolidating all fields into semantic English names with proper native types.
|
||||||
*/
|
*/
|
||||||
export interface BundProjectDetails {
|
export interface BundProjectDetails {
|
||||||
/**
|
/**
|
||||||
* The ID of the Bund project
|
* The ID of the Bund project
|
||||||
*/
|
*/
|
||||||
id: string;
|
id: string;
|
||||||
funding_reference?: string | null;
|
funding_reference?: string | null;
|
||||||
title?: string | null;
|
title?: string | null;
|
||||||
description?: string | null;
|
description?: string | null;
|
||||||
joint_project?: string | null;
|
joint_project?: string | null;
|
||||||
funding_type?: string | null;
|
funding_type?: string | null;
|
||||||
funding_profile?: string | null;
|
funding_profile?: string | null;
|
||||||
funding_amount?: number | null;
|
funding_amount?: number | null;
|
||||||
funding_start_date?: string | null;
|
funding_start_date?: string | null;
|
||||||
funding_end_date?: string | null;
|
funding_end_date?: string | null;
|
||||||
duration?: string | null;
|
duration?: string | null;
|
||||||
performance_plan_code?: string | null;
|
performance_plan_code?: string | null;
|
||||||
performance_plan_fullname?: string | null;
|
performance_plan_fullname?: string | null;
|
||||||
executing_agency?: string | null;
|
executing_agency?: string | null;
|
||||||
funding_recipient?: string | null;
|
funding_recipient?: string | null;
|
||||||
project_agency?: string | null;
|
project_agency?: string | null;
|
||||||
project_agency_fullname?: string | null;
|
project_agency_fullname?: string | null;
|
||||||
department?: string | null;
|
department?: string | null;
|
||||||
department_fullname?: string | null;
|
department_fullname?: string | null;
|
||||||
division?: string | null;
|
division?: string | null;
|
||||||
location?: string | null;
|
location?: string | null;
|
||||||
municipality?: string | null;
|
municipality?: string | null;
|
||||||
state?: string | null;
|
state?: string | null;
|
||||||
country?: string | null;
|
country?: string | null;
|
||||||
municipality_code?: string | null;
|
municipality_code?: string | null;
|
||||||
publication_date?: string | null;
|
publication_date?: string | null;
|
||||||
is_new?: boolean | null;
|
is_new?: boolean | null;
|
||||||
record_date?: string | null;
|
record_date?: string | null;
|
||||||
unix_timestamp?: number | null;
|
unix_timestamp?: number | null;
|
||||||
/**
|
/**
|
||||||
* All persons associated with the Bund project (from nested Arb object)
|
* All persons associated with the Bund project (from nested Arb object)
|
||||||
*/
|
*/
|
||||||
associated_persons?: Array<string>;
|
associated_persons?: Array<string>;
|
||||||
/**
|
/**
|
||||||
* All institutions associated with the Bund project
|
* All institutions associated with the Bund project
|
||||||
*/
|
*/
|
||||||
institutions?: Array<string>;
|
institutions?: Array<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,23 +9,21 @@
|
|||||||
*/
|
*/
|
||||||
import { BundProject } from './bundProject';
|
import { BundProject } from './bundProject';
|
||||||
|
|
||||||
|
|
||||||
export interface BundProjectPage {
|
export interface BundProjectPage {
|
||||||
/**
|
/**
|
||||||
* The current page number.
|
* The current page number.
|
||||||
*/
|
*/
|
||||||
page?: number;
|
page?: number;
|
||||||
/**
|
/**
|
||||||
* The requested page size.
|
* The requested page size.
|
||||||
*/
|
*/
|
||||||
size?: number;
|
size?: number;
|
||||||
/**
|
/**
|
||||||
* The total number of items.
|
* The total number of items.
|
||||||
*/
|
*/
|
||||||
total?: number;
|
total?: number;
|
||||||
/**
|
/**
|
||||||
* The bund projects on this page.
|
* The bund projects on this page.
|
||||||
*/
|
*/
|
||||||
elements?: Array<BundProject>;
|
elements?: Array<BundProject>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,27 +8,25 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface CareerMetrics {
|
export interface CareerMetrics {
|
||||||
first_publication_year?: number | null;
|
first_publication_year?: number | null;
|
||||||
last_publication_year?: number | null;
|
last_publication_year?: number | null;
|
||||||
career_age?: number | null;
|
career_age?: number | null;
|
||||||
career_span?: number | null;
|
career_span?: number | null;
|
||||||
career_stage?: string | null;
|
career_stage?: string | null;
|
||||||
/**
|
/**
|
||||||
* Number of distinct years with at least one publication.
|
* Number of distinct years with at least one publication.
|
||||||
*/
|
*/
|
||||||
active_years?: number;
|
active_years?: number;
|
||||||
/**
|
/**
|
||||||
* Number of publications used for career metrics.
|
* Number of publications used for career metrics.
|
||||||
*/
|
*/
|
||||||
publication_count?: number;
|
publication_count?: number;
|
||||||
publications_per_active_year?: number | null;
|
publications_per_active_year?: number | null;
|
||||||
publications_per_career_year?: number | null;
|
publications_per_career_year?: number | null;
|
||||||
years_since_last_publication?: number | null;
|
years_since_last_publication?: number | null;
|
||||||
/**
|
/**
|
||||||
* True if publication years look suspicious.
|
* True if publication years look suspicious.
|
||||||
*/
|
*/
|
||||||
has_suspicious_publication_years?: boolean;
|
has_suspicious_publication_years?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,31 +13,29 @@ import { CollaborationNetworkEdge } from './collaborationNetworkEdge';
|
|||||||
import { InstitutionNetworkNode } from './institutionNetworkNode';
|
import { InstitutionNetworkNode } from './institutionNetworkNode';
|
||||||
import { AuthorNetworkNode } from './authorNetworkNode';
|
import { AuthorNetworkNode } from './authorNetworkNode';
|
||||||
|
|
||||||
|
|
||||||
export interface CollaborationNetwork {
|
export interface CollaborationNetwork {
|
||||||
/**
|
/**
|
||||||
* The raw person ID of the person whose collaboration network this is.
|
* The raw person ID of the person whose collaboration network this is.
|
||||||
*/
|
*/
|
||||||
raw_person_id: string;
|
raw_person_id: string;
|
||||||
/**
|
/**
|
||||||
* The work nodes in the collaboration network.
|
* The work nodes in the collaboration network.
|
||||||
*/
|
*/
|
||||||
work_nodes: Array<WorkNetworkNode>;
|
work_nodes: Array<WorkNetworkNode>;
|
||||||
/**
|
/**
|
||||||
* The author nodes in the collaboration network.
|
* The author nodes in the collaboration network.
|
||||||
*/
|
*/
|
||||||
author_nodes: Array<AuthorNetworkNode>;
|
author_nodes: Array<AuthorNetworkNode>;
|
||||||
/**
|
/**
|
||||||
* The institution nodes in the collaboration network.
|
* The institution nodes in the collaboration network.
|
||||||
*/
|
*/
|
||||||
institution_nodes: Array<InstitutionNetworkNode>;
|
institution_nodes: Array<InstitutionNetworkNode>;
|
||||||
/**
|
/**
|
||||||
* The collaboration edges in the collaboration network. A collaboration edge represents a collaboration between two nodes. A -> W and A -> I
|
* The collaboration edges in the collaboration network. A collaboration edge represents a collaboration between two nodes. A -> W and A -> I
|
||||||
*/
|
*/
|
||||||
collaboration_edges: Array<CollaborationNetworkEdge>;
|
collaboration_edges: Array<CollaborationNetworkEdge>;
|
||||||
/**
|
/**
|
||||||
* The filter information for the collaboration network, including the minimum and maximum publication years of the works in the collaboration network.
|
* The filter information for the collaboration network, including the minimum and maximum publication years of the works in the collaboration network.
|
||||||
*/
|
*/
|
||||||
filter_information: FilterInformation;
|
filter_information: FilterInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,13 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface CollaborationNetworkEdge {
|
export interface CollaborationNetworkEdge {
|
||||||
/**
|
/**
|
||||||
* The raw ID of the source node.
|
* The raw ID of the source node.
|
||||||
*/
|
*/
|
||||||
raw_source_id: string;
|
raw_source_id: string;
|
||||||
/**
|
/**
|
||||||
* The raw ID of the target node.
|
* The raw ID of the target node.
|
||||||
*/
|
*/
|
||||||
raw_target_id: string;
|
raw_target_id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,10 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export const CollaborationNetworkNodeType = {
|
export const CollaborationNetworkNodeType = {
|
||||||
Author: 'author',
|
Author: 'author',
|
||||||
Institution: 'institution',
|
Institution: 'institution',
|
||||||
Work: 'work'
|
Work: 'work',
|
||||||
} as const;
|
} as const;
|
||||||
export type CollaborationNetworkNodeType = typeof CollaborationNetworkNodeType[keyof typeof CollaborationNetworkNodeType];
|
export type CollaborationNetworkNodeType =
|
||||||
|
(typeof CollaborationNetworkNodeType)[keyof typeof CollaborationNetworkNodeType];
|
||||||
|
|||||||
@@ -9,19 +9,17 @@
|
|||||||
*/
|
*/
|
||||||
import { MatchedOfficer } from './matchedOfficer';
|
import { MatchedOfficer } from './matchedOfficer';
|
||||||
|
|
||||||
|
|
||||||
export interface CompanyConnection {
|
export interface CompanyConnection {
|
||||||
company_number?: string | null;
|
company_number?: string | null;
|
||||||
company_name?: string | null;
|
company_name?: string | null;
|
||||||
company_status?: string | null;
|
company_status?: string | null;
|
||||||
register_art?: string | null;
|
register_art?: string | null;
|
||||||
register_nummer?: string | null;
|
register_nummer?: string | null;
|
||||||
native_company_number?: string | null;
|
native_company_number?: string | null;
|
||||||
registrar?: string | null;
|
registrar?: string | null;
|
||||||
registered_office?: string | null;
|
registered_office?: string | null;
|
||||||
registered_address?: string | null;
|
registered_address?: string | null;
|
||||||
retrieved_at?: string | null;
|
retrieved_at?: string | null;
|
||||||
matched_officers?: Array<MatchedOfficer>;
|
matched_officers?: Array<MatchedOfficer>;
|
||||||
officers?: Array<MatchedOfficer>;
|
officers?: Array<MatchedOfficer>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,17 +9,15 @@
|
|||||||
*/
|
*/
|
||||||
import { CompanyConnection } from './companyConnection';
|
import { CompanyConnection } from './companyConnection';
|
||||||
|
|
||||||
|
|
||||||
export interface CompanyConnectionsResponse {
|
export interface CompanyConnectionsResponse {
|
||||||
author_id: string;
|
author_id: string;
|
||||||
display_name?: string | null;
|
display_name?: string | null;
|
||||||
is_ude_author: boolean;
|
is_ude_author: boolean;
|
||||||
institution_scope?: string | null;
|
institution_scope?: string | null;
|
||||||
matching_institutions?: Array<string>;
|
matching_institutions?: Array<string>;
|
||||||
matching_method?: string | null;
|
matching_method?: string | null;
|
||||||
company_count: number;
|
company_count: number;
|
||||||
has_more_results: boolean;
|
has_more_results: boolean;
|
||||||
common_name_warning: boolean;
|
common_name_warning: boolean;
|
||||||
connections?: Array<CompanyConnection>;
|
connections?: Array<CompanyConnection>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,32 +10,30 @@
|
|||||||
import { Keywords } from './keywords';
|
import { Keywords } from './keywords';
|
||||||
import { Topics } from './topics';
|
import { Topics } from './topics';
|
||||||
|
|
||||||
|
|
||||||
export interface CordisEuProject {
|
export interface CordisEuProject {
|
||||||
/**
|
/**
|
||||||
* Unique identifier for the project, typically the CORDIS ID
|
* Unique identifier for the project, typically the CORDIS ID
|
||||||
*/
|
*/
|
||||||
id: string;
|
id: string;
|
||||||
rcn?: string | null;
|
rcn?: string | null;
|
||||||
acronym?: string | null;
|
acronym?: string | null;
|
||||||
title?: string | null;
|
title?: string | null;
|
||||||
objective?: string | null;
|
objective?: string | null;
|
||||||
frameworkProgramme?: string | null;
|
frameworkProgramme?: string | null;
|
||||||
fundingScheme?: string | null;
|
fundingScheme?: string | null;
|
||||||
legalBasis?: string | null;
|
legalBasis?: string | null;
|
||||||
masterCall?: string | null;
|
masterCall?: string | null;
|
||||||
subCall?: string | null;
|
subCall?: string | null;
|
||||||
topics?: Topics | null;
|
topics?: Topics | null;
|
||||||
nature?: string | null;
|
nature?: string | null;
|
||||||
status?: string | null;
|
status?: string | null;
|
||||||
ecMaxContribution?: number | null;
|
ecMaxContribution?: number | null;
|
||||||
totalCost?: number | null;
|
totalCost?: number | null;
|
||||||
startDate?: string | null;
|
startDate?: string | null;
|
||||||
endDate?: string | null;
|
endDate?: string | null;
|
||||||
ecSignatureDate?: string | null;
|
ecSignatureDate?: string | null;
|
||||||
contentUpdateDate?: string | null;
|
contentUpdateDate?: string | null;
|
||||||
grantDoi?: string | null;
|
grantDoi?: string | null;
|
||||||
humanValidated?: boolean | null;
|
humanValidated?: boolean | null;
|
||||||
keywords?: Keywords | null;
|
keywords?: Keywords | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,23 +9,21 @@
|
|||||||
*/
|
*/
|
||||||
import { CordisEuProject } from './cordisEuProject';
|
import { CordisEuProject } from './cordisEuProject';
|
||||||
|
|
||||||
|
|
||||||
export interface CordisEuProjectPage {
|
export interface CordisEuProjectPage {
|
||||||
/**
|
/**
|
||||||
* The current page number.
|
* The current page number.
|
||||||
*/
|
*/
|
||||||
page?: number;
|
page?: number;
|
||||||
/**
|
/**
|
||||||
* The requested page size.
|
* The requested page size.
|
||||||
*/
|
*/
|
||||||
size?: number;
|
size?: number;
|
||||||
/**
|
/**
|
||||||
* The total number of items.
|
* The total number of items.
|
||||||
*/
|
*/
|
||||||
total?: number;
|
total?: number;
|
||||||
/**
|
/**
|
||||||
* The CORDIS EU projects on this page.
|
* The CORDIS EU projects on this page.
|
||||||
*/
|
*/
|
||||||
elements?: Array<CordisEuProject>;
|
elements?: Array<CordisEuProject>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,7 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cost of this request in USD
|
* Cost of this request in USD
|
||||||
*/
|
*/
|
||||||
export interface CostUsd {
|
export interface CostUsd {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,16 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
import { UserRole } from './userRole';
|
import { UserRole } from './userRole';
|
||||||
|
|
||||||
|
|
||||||
export interface CreateAccountRequest {
|
export interface CreateAccountRequest {
|
||||||
email: string;
|
email: string;
|
||||||
name: string;
|
name: string;
|
||||||
role?: UserRole;
|
role?: UserRole;
|
||||||
organization_id: string;
|
organization_id: string;
|
||||||
password: string;
|
password: string;
|
||||||
openalex_person_id?: string | null;
|
openalex_person_id?: string | null;
|
||||||
}
|
}
|
||||||
export namespace CreateAccountRequest {
|
export namespace CreateAccountRequest {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface CreateOrganizationRequest {
|
export interface CreateOrganizationRequest {
|
||||||
name: string;
|
name: string;
|
||||||
other_inst_id?: string | null;
|
other_inst_id?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user