litdb 2.2.0__tar.gz → 2.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {litdb-2.2.0/src/litdb.egg-info → litdb-2.2.1}/PKG-INFO +1 -1
- {litdb-2.2.0 → litdb-2.2.1}/pyproject.toml +1 -1
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/coa.py +22 -7
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/mcp_server.py +17 -9
- {litdb-2.2.0 → litdb-2.2.1/src/litdb.egg-info}/PKG-INFO +1 -1
- {litdb-2.2.0 → litdb-2.2.1}/LICENSE +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/README.org +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/setup.cfg +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/__init__.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/app.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/audio.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/bibtex.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/chat.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/cli.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/__init__.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/data_processing.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/export.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/filters.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/install.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/manage.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/openalex_commands.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/research_commands.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/review.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/search.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/tags.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/utilities.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/crawl.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/db.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/doe_collaborators.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/extract.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/gpt.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/images.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/lab.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/lsearch.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/openalex.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/pdf.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/research.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/server.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/summary.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/utils.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb/youtube.py +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb.egg-info/SOURCES.txt +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb.egg-info/dependency_links.txt +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb.egg-info/entry_points.txt +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb.egg-info/requires.txt +0 -0
- {litdb-2.2.0 → litdb-2.2.1}/src/litdb.egg-info/top_level.txt +0 -0
|
@@ -8,6 +8,7 @@ import pandas as pd
|
|
|
8
8
|
from nameparser import HumanName
|
|
9
9
|
import requests
|
|
10
10
|
import base64
|
|
11
|
+
from io import BytesIO
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
def get_coa(orcid, email=None):
|
|
@@ -121,10 +122,21 @@ def get_coa(orcid, email=None):
|
|
|
121
122
|
)
|
|
122
123
|
|
|
123
124
|
today = datetime.date.today().strftime("%Y-%m-%d.xlsx")
|
|
124
|
-
|
|
125
|
+
filename = f"{orcid}-{today}"
|
|
126
|
+
|
|
127
|
+
# Determine output path
|
|
128
|
+
if get_ipython():
|
|
129
|
+
# Jupyter: use in-memory buffer
|
|
130
|
+
buffer = BytesIO()
|
|
131
|
+
xw = pd.ExcelWriter(buffer, engine="xlsxwriter")
|
|
132
|
+
else:
|
|
133
|
+
# MCP/CLI: save to Downloads folder
|
|
134
|
+
from pathlib import Path
|
|
135
|
+
|
|
136
|
+
downloads_path = Path.home() / "Downloads" / filename
|
|
137
|
+
xw = pd.ExcelWriter(str(downloads_path), engine="xlsxwriter")
|
|
125
138
|
|
|
126
139
|
# Table 4
|
|
127
|
-
xw = pd.ExcelWriter(coa_file, engine="xlsxwriter")
|
|
128
140
|
df.to_excel(xw, index=False, sheet_name="Table 4")
|
|
129
141
|
|
|
130
142
|
sheet = xw.sheets["Table 4"]
|
|
@@ -159,9 +171,12 @@ def get_coa(orcid, email=None):
|
|
|
159
171
|
xw.close()
|
|
160
172
|
|
|
161
173
|
if get_ipython():
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
174
|
+
# Jupyter: display download link
|
|
175
|
+
excel_bytes = buffer.getvalue()
|
|
176
|
+
b64 = base64.b64encode(excel_bytes).decode("utf-8")
|
|
177
|
+
uri = f'<pre>{filename}</pre><br><a href="data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,{b64}" download="{filename}">Download COA</a>'
|
|
178
|
+
display(HTML(uri))
|
|
179
|
+
return None
|
|
166
180
|
else:
|
|
167
|
-
|
|
181
|
+
# Return path for MCP server / CLI
|
|
182
|
+
return str(downloads_path)
|
|
@@ -599,26 +599,34 @@ def generate_nsf_coa(orcid: str, email: str = None) -> str:
|
|
|
599
599
|
"""Generate NSF Collaborators and Other Affiliations (COA) Table 4.
|
|
600
600
|
|
|
601
601
|
Creates an Excel file with co-authors from publications in the last 4 years.
|
|
602
|
+
The file will be saved directly to your Downloads folder.
|
|
602
603
|
|
|
603
604
|
Args:
|
|
604
605
|
orcid: The ORCID identifier (with or without https://orcid.org/ prefix).
|
|
605
606
|
email: Optional email for OpenAlex API polite pool (recommended for better rate limits).
|
|
606
607
|
|
|
607
608
|
Returns:
|
|
608
|
-
|
|
609
|
+
Success message with file location.
|
|
609
610
|
"""
|
|
610
611
|
try:
|
|
611
|
-
get_coa(orcid, email)
|
|
612
|
-
|
|
613
|
-
|
|
612
|
+
file_path = get_coa(orcid, email)
|
|
613
|
+
if file_path is None:
|
|
614
|
+
# Running in Jupyter - get_coa handles display itself
|
|
615
|
+
return "COA generated and displayed in Jupyter"
|
|
614
616
|
|
|
615
|
-
|
|
616
|
-
today = datetime.date.today().strftime("%Y-%m-%d.xlsx")
|
|
617
|
-
filename = f"{orcid_clean}-{today}"
|
|
617
|
+
return f"""✅ NSF COA Excel file successfully generated!
|
|
618
618
|
|
|
619
|
-
|
|
619
|
+
📁 File saved to: {file_path}
|
|
620
|
+
|
|
621
|
+
The Excel file contains:
|
|
622
|
+
• Table 4: Unique co-authors with their affiliations and last active dates
|
|
623
|
+
• All authors sheet: Complete list of all co-authors from each publication
|
|
624
|
+
|
|
625
|
+
This includes all co-authors from publications in the last 4 years.
|
|
626
|
+
|
|
627
|
+
You can open the file from your Downloads folder or use the path above to locate it."""
|
|
620
628
|
except Exception as e:
|
|
621
|
-
return f"
|
|
629
|
+
return f"❌ Failed to generate NSF COA file: {str(e)}\n\nMake sure you have write access to your Downloads folder."
|
|
622
630
|
|
|
623
631
|
|
|
624
632
|
def main():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|