openalex-reporting 0.1.0__py3-none-any.whl

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.
oar/__init__.py ADDED
@@ -0,0 +1,48 @@
1
+ """OAR — a bibliometric warehouse for any set of OpenAlex works.
2
+
3
+ import oar
4
+
5
+ oar.build(name="epfl", institution="I5124864")
6
+ oar.indicators() # output, impact, collaboration, open access
7
+ oar.baseline(country="CH") # the same indicators for a reference set
8
+ oar.partners() # who the set publishes with
9
+
10
+ The build reads OAM for the work set and the citation scores, and the OpenAlex
11
+ API for titles, authors and affiliations. The result is one DuckDB file. After
12
+ that, nothing here needs OAM or the network.
13
+
14
+ See the README for the indicators and for what a baseline compares against.
15
+ """
16
+
17
+ import re
18
+ from importlib.metadata import PackageNotFoundError, version
19
+ from pathlib import Path
20
+
21
+ from .build import build, status
22
+ from .config import set_data_dir
23
+ from .db import connect
24
+ from .doc import doc
25
+ from .indicators import baseline, indicators, partners, works
26
+
27
+
28
+ def _package_version():
29
+ try:
30
+ return version("openalex-reporting")
31
+ except PackageNotFoundError:
32
+ text = (Path(__file__).resolve().parents[1] / "pyproject.toml").read_text()
33
+ match = re.search(r'(?m)^version = "([^"]+)"', text)
34
+ if match is None:
35
+ raise RuntimeError("pyproject.toml has no version")
36
+ return match.group(1)
37
+
38
+
39
+ __version__ = _package_version()
40
+
41
+ __all__ = [
42
+ "baseline", "build", "connect", "doc", "indicators", "partners",
43
+ "set_data_dir", "status", "works",
44
+ ]
45
+
46
+
47
+ def __dir__():
48
+ return sorted(__all__ + ["__version__"])