Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -109,6 +109,45 @@ def get_client_ip(request: Request) -> str:
|
|
| 109 |
OPF_BASE = "https://v2.sherpa.ac.uk/cgi/retrieve" # Open Policy Finder (Jisc)
|
| 110 |
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
ROUTE_KEYWORDS = {
|
| 113 |
"journals": [
|
| 114 |
"find journal", "find a journal", "which journal", "where to publish",
|
|
@@ -784,6 +823,7 @@ async def analyze_journal(req: JournalRequest, request: Request):
|
|
| 784 |
for j in parsed.get("extended_list", []):
|
| 785 |
j["ku_apc_covered"] = is_ku_apc_covered(j.get("publisher", ""), j.get("quartile", ""))
|
| 786 |
|
|
|
|
| 787 |
return {"result": parsed}
|
| 788 |
|
| 789 |
|
|
@@ -809,6 +849,7 @@ async def check_license(req: LicenseRequest, request: Request):
|
|
| 809 |
if isinstance(parsed.get("journals"), list):
|
| 810 |
parsed["journals"] = await enrich_journals(parsed["journals"])
|
| 811 |
|
|
|
|
| 812 |
return {"result": parsed}
|
| 813 |
|
| 814 |
|
|
@@ -828,14 +869,23 @@ async def find_repository(req: RepoRequest, request: Request):
|
|
| 828 |
raise HTTPException(500, parsed["error"])
|
| 829 |
|
| 830 |
repos = parsed.get("repositories", [])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 831 |
for r in repos:
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
"
|
| 835 |
-
|
| 836 |
-
|
|
|
|
| 837 |
|
| 838 |
-
# Khazna is always prepended above
|
| 839 |
parsed["repositories"] = repos
|
| 840 |
return {"result": parsed}
|
| 841 |
|
|
|
|
| 109 |
OPF_BASE = "https://v2.sherpa.ac.uk/cgi/retrieve" # Open Policy Finder (Jisc)
|
| 110 |
|
| 111 |
|
| 112 |
+
# ββ Khazna β KU Institutional Repository (always first in results) βββββββββ
|
| 113 |
+
KHAZNA = {
|
| 114 |
+
"name": "Khazna β Khalifa University Research Portal",
|
| 115 |
+
"type": "Institutional",
|
| 116 |
+
"url": "https://khazna.ku.ac.ae",
|
| 117 |
+
"scope": "Khalifa University institutional repository for articles, theses, datasets and research output.",
|
| 118 |
+
"fit_reason": "Primary institutional repository for all KU researchers. Deposit here for KU compliance and visibility.",
|
| 119 |
+
"data_types_accepted": "All types β articles, datasets, theses, preprints, reports",
|
| 120 |
+
"max_file_size": "Contact library for large datasets",
|
| 121 |
+
"licences_supported": "CC BY, CC BY-NC, CC BY-NC-ND, Restricted",
|
| 122 |
+
"persistent_identifier": "Handle",
|
| 123 |
+
"versioning": "Yes",
|
| 124 |
+
"embargo_support": "Yes",
|
| 125 |
+
"access_model": "Mixed",
|
| 126 |
+
"cost": "Free",
|
| 127 |
+
"certification": "Institutional",
|
| 128 |
+
"fair_alignment": "High",
|
| 129 |
+
"funder_compliance_note": "Satisfies KU institutional OA and RDM policy requirements.",
|
| 130 |
+
"sensitive_data_suitable": "Conditional",
|
| 131 |
+
"confidence": "High",
|
| 132 |
+
"verification_status": "Confirmed β KU institutional repository",
|
| 133 |
+
"risk_flag": None,
|
| 134 |
+
"is_khazna": True,
|
| 135 |
+
"verify_links": {
|
| 136 |
+
"re3data": "https://www.re3data.org/search?query=Khalifa+University",
|
| 137 |
+
"fairsharing": "https://fairsharing.org/search?q=Khalifa+University",
|
| 138 |
+
"khazna_contact": "mailto:khazna@ku.ac.ae",
|
| 139 |
+
},
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
KHAZNA_DEPOSIT_CARD = {
|
| 143 |
+
"title": "ποΈ Deposit to Khazna β KU Institutional Repository",
|
| 144 |
+
"url": "https://khazna.ku.ac.ae",
|
| 145 |
+
"contact": "khazna@ku.ac.ae",
|
| 146 |
+
"library_url": "https://library.ku.ac.ae/lib",
|
| 147 |
+
"message": "As a KU researcher, deposit your accepted manuscript (or metadata record if under embargo) to Khazna for institutional visibility and compliance.",
|
| 148 |
+
"metadata_tip": "Even if depositing data in a domain-specific repository, always register metadata in Khazna so your work appears in KU's research portfolio.",
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
ROUTE_KEYWORDS = {
|
| 152 |
"journals": [
|
| 153 |
"find journal", "find a journal", "which journal", "where to publish",
|
|
|
|
| 823 |
for j in parsed.get("extended_list", []):
|
| 824 |
j["ku_apc_covered"] = is_ku_apc_covered(j.get("publisher", ""), j.get("quartile", ""))
|
| 825 |
|
| 826 |
+
parsed["khazna"] = KHAZNA_DEPOSIT_CARD
|
| 827 |
return {"result": parsed}
|
| 828 |
|
| 829 |
|
|
|
|
| 849 |
if isinstance(parsed.get("journals"), list):
|
| 850 |
parsed["journals"] = await enrich_journals(parsed["journals"])
|
| 851 |
|
| 852 |
+
parsed["khazna"] = KHAZNA_DEPOSIT_CARD
|
| 853 |
return {"result": parsed}
|
| 854 |
|
| 855 |
|
|
|
|
| 869 |
raise HTTPException(500, parsed["error"])
|
| 870 |
|
| 871 |
repos = parsed.get("repositories", [])
|
| 872 |
+
|
| 873 |
+
# Always prepend Khazna as first repository for KU researchers
|
| 874 |
+
has_khazna = any("khazna" in r.get("url", "").lower() for r in repos)
|
| 875 |
+
if not has_khazna:
|
| 876 |
+
repos.insert(0, KHAZNA)
|
| 877 |
+
else:
|
| 878 |
+
repos = [r for r in repos if "khazna" not in r.get("url", "").lower()]
|
| 879 |
+
repos.insert(0, KHAZNA)
|
| 880 |
+
|
| 881 |
for r in repos:
|
| 882 |
+
if not r.get("is_khazna"):
|
| 883 |
+
clean_name = re.sub(r"[^\w\s]", "", r.get("name", ""))
|
| 884 |
+
r["verify_links"] = {
|
| 885 |
+
"re3data": f"https://www.re3data.org/search?query={clean_name}",
|
| 886 |
+
"fairsharing": f"https://fairsharing.org/search?q={clean_name}",
|
| 887 |
+
}
|
| 888 |
|
|
|
|
| 889 |
parsed["repositories"] = repos
|
| 890 |
return {"result": parsed}
|
| 891 |
|