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.
Files changed (46) hide show
  1. {litdb-2.2.0/src/litdb.egg-info → litdb-2.2.1}/PKG-INFO +1 -1
  2. {litdb-2.2.0 → litdb-2.2.1}/pyproject.toml +1 -1
  3. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/coa.py +22 -7
  4. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/mcp_server.py +17 -9
  5. {litdb-2.2.0 → litdb-2.2.1/src/litdb.egg-info}/PKG-INFO +1 -1
  6. {litdb-2.2.0 → litdb-2.2.1}/LICENSE +0 -0
  7. {litdb-2.2.0 → litdb-2.2.1}/README.org +0 -0
  8. {litdb-2.2.0 → litdb-2.2.1}/setup.cfg +0 -0
  9. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/__init__.py +0 -0
  10. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/app.py +0 -0
  11. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/audio.py +0 -0
  12. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/bibtex.py +0 -0
  13. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/chat.py +0 -0
  14. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/cli.py +0 -0
  15. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/__init__.py +0 -0
  16. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/data_processing.py +0 -0
  17. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/export.py +0 -0
  18. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/filters.py +0 -0
  19. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/install.py +0 -0
  20. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/manage.py +0 -0
  21. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/openalex_commands.py +0 -0
  22. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/research_commands.py +0 -0
  23. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/review.py +0 -0
  24. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/search.py +0 -0
  25. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/tags.py +0 -0
  26. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/commands/utilities.py +0 -0
  27. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/crawl.py +0 -0
  28. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/db.py +0 -0
  29. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/doe_collaborators.py +0 -0
  30. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/extract.py +0 -0
  31. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/gpt.py +0 -0
  32. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/images.py +0 -0
  33. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/lab.py +0 -0
  34. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/lsearch.py +0 -0
  35. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/openalex.py +0 -0
  36. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/pdf.py +0 -0
  37. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/research.py +0 -0
  38. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/server.py +0 -0
  39. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/summary.py +0 -0
  40. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/utils.py +0 -0
  41. {litdb-2.2.0 → litdb-2.2.1}/src/litdb/youtube.py +0 -0
  42. {litdb-2.2.0 → litdb-2.2.1}/src/litdb.egg-info/SOURCES.txt +0 -0
  43. {litdb-2.2.0 → litdb-2.2.1}/src/litdb.egg-info/dependency_links.txt +0 -0
  44. {litdb-2.2.0 → litdb-2.2.1}/src/litdb.egg-info/entry_points.txt +0 -0
  45. {litdb-2.2.0 → litdb-2.2.1}/src/litdb.egg-info/requires.txt +0 -0
  46. {litdb-2.2.0 → litdb-2.2.1}/src/litdb.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: litdb
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: A literature database tool with GPT integration.
5
5
  Author-email: John Kitchin <jkitchin@andrew.cmu.edu>
6
6
  Maintainer-email: John Kitchin <jkitchin@andrew.cmu.edu>
@@ -7,7 +7,7 @@ where = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "litdb"
10
- version = "2.2.0"
10
+ version = "2.2.1"
11
11
  authors = [
12
12
  {name = "John Kitchin", email = "jkitchin@andrew.cmu.edu"},
13
13
  ]
@@ -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
- coa_file = f"{orcid}-{today}"
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
- with open(coa_file, "rb") as f:
163
- b64 = base64.b64encode(f.read()).decode("utf-8")
164
- uri = f'<pre>{coa_file}</pre><br><a href="data:text/plain;base64,{b64}" download="{coa_file}">Download COA</a>'
165
- display(HTML(uri))
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
- print(f"Created {coa_file}")
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
- Status message with the filename of the generated Excel file.
609
+ Success message with file location.
609
610
  """
610
611
  try:
611
- get_coa(orcid, email)
612
- # The get_coa function prints the filename, so we extract it from the pattern
613
- import datetime
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
- orcid_clean = orcid.replace("https://orcid.org/", "")
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
- return f"Successfully generated NSF COA file: {filename}\n\nThe file contains:\n- Table 4: Unique co-authors with their affiliations and last active dates\n- All authors sheet: Complete list of all co-authors from each publication\n\nThis includes all co-authors from publications in the last 4 years."
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"Error generating NSF COA file: {str(e)}"
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():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: litdb
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: A literature database tool with GPT integration.
5
5
  Author-email: John Kitchin <jkitchin@andrew.cmu.edu>
6
6
  Maintainer-email: John Kitchin <jkitchin@andrew.cmu.edu>
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