pub-analyzer 0.1.2__py3-none-any.whl → 0.3.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.
Potentially problematic release.
This version of pub-analyzer might be problematic. Click here for more details.
- pub_analyzer/css/body.tcss +48 -35
- pub_analyzer/css/buttons.tcss +0 -1
- pub_analyzer/css/collapsible.tcss +31 -0
- pub_analyzer/css/main.tcss +4 -0
- pub_analyzer/css/summary.tcss +75 -0
- pub_analyzer/internal/identifier.py +36 -10
- pub_analyzer/internal/render.py +1 -1
- pub_analyzer/internal/report.py +177 -53
- pub_analyzer/internal/templates/author/{author_resume.typ → author_summary.typ} +4 -3
- pub_analyzer/internal/templates/author/report.typ +4 -3
- pub_analyzer/internal/templates/author/sources.typ +7 -5
- pub_analyzer/internal/templates/author/works.typ +12 -12
- pub_analyzer/internal/templates/author/works_extended.typ +4 -4
- pub_analyzer/main.py +6 -7
- pub_analyzer/models/author.py +20 -28
- pub_analyzer/models/concept.py +19 -0
- pub_analyzer/models/institution.py +22 -5
- pub_analyzer/models/report.py +14 -14
- pub_analyzer/models/source.py +59 -3
- pub_analyzer/models/topic.py +59 -0
- pub_analyzer/models/work.py +30 -7
- pub_analyzer/widgets/author/cards.py +15 -14
- pub_analyzer/widgets/author/core.py +80 -115
- pub_analyzer/widgets/author/tables.py +1 -1
- pub_analyzer/widgets/common/__init__.py +6 -6
- pub_analyzer/widgets/common/filesystem.py +16 -13
- pub_analyzer/widgets/common/filters.py +111 -0
- pub_analyzer/widgets/common/input.py +14 -5
- pub_analyzer/widgets/common/selector.py +1 -1
- pub_analyzer/widgets/common/summary.py +7 -0
- pub_analyzer/widgets/institution/cards.py +13 -15
- pub_analyzer/widgets/institution/core.py +81 -115
- pub_analyzer/widgets/institution/tables.py +1 -1
- pub_analyzer/widgets/report/cards.py +33 -31
- pub_analyzer/widgets/report/concept.py +47 -0
- pub_analyzer/widgets/report/core.py +90 -20
- pub_analyzer/widgets/report/export.py +2 -2
- pub_analyzer/widgets/report/grants.py +46 -0
- pub_analyzer/widgets/report/locations.py +14 -12
- pub_analyzer/widgets/report/source.py +22 -14
- pub_analyzer/widgets/report/topic.py +55 -0
- pub_analyzer/widgets/report/work.py +70 -34
- pub_analyzer/widgets/search/__init__.py +4 -4
- pub_analyzer/widgets/search/results.py +15 -16
- pub_analyzer/widgets/sidebar.py +11 -9
- {pub_analyzer-0.1.2.dist-info → pub_analyzer-0.3.0.dist-info}/METADATA +31 -7
- pub_analyzer-0.3.0.dist-info/RECORD +69 -0
- {pub_analyzer-0.1.2.dist-info → pub_analyzer-0.3.0.dist-info}/WHEEL +1 -1
- pub_analyzer/css/author.tcss +0 -78
- pub_analyzer/css/institution.tcss +0 -78
- pub_analyzer-0.1.2.dist-info/RECORD +0 -62
- {pub_analyzer-0.1.2.dist-info → pub_analyzer-0.3.0.dist-info}/LICENSE +0 -0
- {pub_analyzer-0.1.2.dist-info → pub_analyzer-0.3.0.dist-info}/entry_points.txt +0 -0
pub_analyzer/css/body.tcss
CHANGED
|
@@ -14,38 +14,51 @@ SideBar {
|
|
|
14
14
|
|
|
15
15
|
background: $bg-secondary-color;
|
|
16
16
|
color: $text-primary-color;
|
|
17
|
-
transition: width 250ms in_out_cubic;
|
|
18
|
-
}
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
18
|
+
Button {
|
|
19
|
+
text-align: start;
|
|
20
|
+
}
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
#sidebar-title {
|
|
23
|
+
width: 100%;
|
|
24
|
+
content-align: left middle;
|
|
25
|
+
text-style: bold;
|
|
26
|
+
border-bottom: heavy $text-primary-color;
|
|
27
|
+
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
29
|
+
.sidebar-options-column {
|
|
30
|
+
margin: 1;
|
|
31
|
+
padding: 1 1;
|
|
32
|
+
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
.sidebar-buttons-column {
|
|
35
|
+
height: 1fr;
|
|
36
|
+
|
|
37
|
+
.sidebar-option {
|
|
38
|
+
content-align: left middle;
|
|
39
|
+
margin: 1 0;
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
#module-version-label {
|
|
45
|
+
color: $text-primary-color 25%;
|
|
46
|
+
text-align: center;
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
43
49
|
}
|
|
44
50
|
|
|
45
|
-
SideBar
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
.-dark-mode SideBar {
|
|
52
|
+
background: $bg-secondary-color-darken;
|
|
53
|
+
color: $text-primary-color-darken;
|
|
54
|
+
|
|
55
|
+
#sidebar-title {
|
|
56
|
+
border-bottom: heavy $text-primary-color-darken;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#module-version-label {
|
|
60
|
+
color: $text-primary-color-darken 25%;
|
|
61
|
+
}
|
|
49
62
|
}
|
|
50
63
|
|
|
51
64
|
/* Main Content CSS */
|
|
@@ -55,20 +68,20 @@ MainContent {
|
|
|
55
68
|
|
|
56
69
|
padding: 2 1 0 1;
|
|
57
70
|
height: 100%;
|
|
71
|
+
|
|
72
|
+
.title {
|
|
73
|
+
content-align: left middle;
|
|
74
|
+
text-style: bold;
|
|
75
|
+
border-bottom: heavy $text-primary-color;
|
|
76
|
+
width: 100%
|
|
77
|
+
}
|
|
58
78
|
}
|
|
59
79
|
|
|
60
80
|
.-dark-mode MainContent {
|
|
61
81
|
background: $bg-main-color-darken;
|
|
62
82
|
color: $text-primary-color-darken;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
MainContent .title {
|
|
66
|
-
content-align: left middle;
|
|
67
|
-
text-style: bold;
|
|
68
|
-
border-bottom: heavy $text-primary-color;
|
|
69
|
-
width: 100%
|
|
70
|
-
}
|
|
71
83
|
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
.title {
|
|
85
|
+
border-bottom: heavy $text-primary-color-darken;
|
|
86
|
+
}
|
|
74
87
|
}
|
pub_analyzer/css/buttons.tcss
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* COLORS */
|
|
2
|
+
$bg-main-color: white;
|
|
3
|
+
$bg-secondary-color: #e5e7eb;
|
|
4
|
+
$bg-secondary-color-accent: #d1d5db;
|
|
5
|
+
$text-primary-color: black;
|
|
6
|
+
|
|
7
|
+
$bg-main-color-darken: #1e293b;
|
|
8
|
+
$bg-secondary-color-darken: #0f172a;
|
|
9
|
+
$text-primary-color-darken: black;
|
|
10
|
+
|
|
11
|
+
CollapsibleTitle {
|
|
12
|
+
background: transparent;
|
|
13
|
+
color: $text-primary-color;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
CollapsibleTitle:hover {
|
|
17
|
+
background: transparent;
|
|
18
|
+
text-style: bold;
|
|
19
|
+
color: $text-primary-color;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
CollapsibleTitle:focus {
|
|
23
|
+
background: transparent;
|
|
24
|
+
text-style: bold;
|
|
25
|
+
color: $text-primary-color;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Collapsible {
|
|
29
|
+
background: transparent;
|
|
30
|
+
border: none;
|
|
31
|
+
}
|
pub_analyzer/css/main.tcss
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* COLORS */
|
|
2
|
+
$bg-main-color: white;
|
|
3
|
+
$bg-secondary-color: #e5e7eb;
|
|
4
|
+
$bg-secondary-color-accent: #d1d5db;
|
|
5
|
+
$text-primary-color: black;
|
|
6
|
+
|
|
7
|
+
$bg-main-color-darken: #1e293b;
|
|
8
|
+
$bg-secondary-color-darken: #0f172a;
|
|
9
|
+
$text-primary-color-darken: black;
|
|
10
|
+
|
|
11
|
+
SummaryWidget {
|
|
12
|
+
height: 1fr;
|
|
13
|
+
margin: 1 2;
|
|
14
|
+
|
|
15
|
+
/* Titles */
|
|
16
|
+
.block-title {
|
|
17
|
+
text-align: center;
|
|
18
|
+
width: 100%;
|
|
19
|
+
border-bottom: solid $text-primary-color;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Block Container */
|
|
23
|
+
.block-container {
|
|
24
|
+
padding: 1;
|
|
25
|
+
height: auto;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Cards */
|
|
29
|
+
.cards-container {
|
|
30
|
+
height: auto;
|
|
31
|
+
margin: 1 0 0 0 ;
|
|
32
|
+
|
|
33
|
+
layout: grid;
|
|
34
|
+
grid-size: 3 1;
|
|
35
|
+
grid-rows: 14;
|
|
36
|
+
grid-columns: 1fr;
|
|
37
|
+
grid-gutter: 1 2;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Info Container */
|
|
41
|
+
.info-container {
|
|
42
|
+
height: auto;
|
|
43
|
+
|
|
44
|
+
Label {
|
|
45
|
+
text-align: center;
|
|
46
|
+
width: 1fr;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Table */
|
|
51
|
+
.table-container {
|
|
52
|
+
height: auto;
|
|
53
|
+
margin: 1 0 0 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Filter Container */
|
|
57
|
+
.filter-collapsible {
|
|
58
|
+
margin-top: 1;
|
|
59
|
+
|
|
60
|
+
DateRangeFilter {
|
|
61
|
+
margin-top: 1;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Buttons */
|
|
66
|
+
.button-container {
|
|
67
|
+
align: center middle;
|
|
68
|
+
height: 5;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.-dark-mode SummaryWidget {
|
|
73
|
+
color: $text-primary-color-darken;
|
|
74
|
+
background: $bg-secondary-color;
|
|
75
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"""Functions to extract OpenAlex IDs from Models."""
|
|
2
2
|
|
|
3
|
-
from pub_analyzer.models.author import Author, AuthorResult, DehydratedAuthor
|
|
4
|
-
from pub_analyzer.models.institution import DehydratedInstitution, Institution, InstitutionResult
|
|
3
|
+
from pub_analyzer.models.author import Author, AuthorOpenAlexKey, AuthorResult, DehydratedAuthor
|
|
4
|
+
from pub_analyzer.models.institution import DehydratedInstitution, Institution, InstitutionOpenAlexKey, InstitutionResult
|
|
5
|
+
from pub_analyzer.models.source import DehydratedSource, Source
|
|
5
6
|
from pub_analyzer.models.work import Work
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
def get_author_id(author: Author | AuthorResult | DehydratedAuthor) ->
|
|
9
|
+
def get_author_id(author: Author | AuthorResult | DehydratedAuthor) -> AuthorOpenAlexKey:
|
|
9
10
|
"""Extract OpenAlex ID from author Model.
|
|
10
11
|
|
|
11
12
|
Args:
|
|
@@ -25,12 +26,12 @@ def get_author_id(author: Author | AuthorResult | DehydratedAuthor) -> str:
|
|
|
25
26
|
```
|
|
26
27
|
"""
|
|
27
28
|
if author.id.path:
|
|
28
|
-
return author.id.path.rpartition(
|
|
29
|
+
return author.id.path.rpartition("/")[2]
|
|
29
30
|
else:
|
|
30
|
-
return
|
|
31
|
+
return ""
|
|
31
32
|
|
|
32
33
|
|
|
33
|
-
def get_institution_id(institution: Institution | InstitutionResult | DehydratedInstitution) ->
|
|
34
|
+
def get_institution_id(institution: Institution | InstitutionResult | DehydratedInstitution) -> InstitutionOpenAlexKey:
|
|
34
35
|
"""Extract OpenAlex ID from institution Model.
|
|
35
36
|
|
|
36
37
|
Args:
|
|
@@ -50,9 +51,9 @@ def get_institution_id(institution: Institution | InstitutionResult | Dehydrated
|
|
|
50
51
|
```
|
|
51
52
|
"""
|
|
52
53
|
if institution.id.path:
|
|
53
|
-
return institution.id.path.rpartition(
|
|
54
|
+
return institution.id.path.rpartition("/")[2]
|
|
54
55
|
else:
|
|
55
|
-
return
|
|
56
|
+
return ""
|
|
56
57
|
|
|
57
58
|
|
|
58
59
|
def get_work_id(work: Work) -> str:
|
|
@@ -75,6 +76,31 @@ def get_work_id(work: Work) -> str:
|
|
|
75
76
|
```
|
|
76
77
|
"""
|
|
77
78
|
if work.id.path:
|
|
78
|
-
return work.id.path.rpartition(
|
|
79
|
+
return work.id.path.rpartition("/")[2]
|
|
79
80
|
else:
|
|
80
|
-
return
|
|
81
|
+
return ""
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def get_source_id(source: DehydratedSource | Source) -> str:
|
|
85
|
+
"""Extract OpenAlex ID from Source Model.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
source: Source model instance.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
Source OpenAlex ID.
|
|
92
|
+
|
|
93
|
+
Example:
|
|
94
|
+
```python
|
|
95
|
+
from pub_analyzer.internal.identifier import get_source_id
|
|
96
|
+
from pub_analyzer.models.source import Source
|
|
97
|
+
|
|
98
|
+
source = Source(id="https://openalex.org/S000000000", **kwargs)
|
|
99
|
+
print(get_source_id(source))
|
|
100
|
+
# 'S000000000'
|
|
101
|
+
```
|
|
102
|
+
"""
|
|
103
|
+
if source.id.path:
|
|
104
|
+
return source.id.path.rpartition("/")[2]
|
|
105
|
+
else:
|
|
106
|
+
return ""
|
pub_analyzer/internal/render.py
CHANGED
|
@@ -30,7 +30,7 @@ async def render_template_report(report: AuthorReport | InstitutionReport) -> st
|
|
|
30
30
|
|
|
31
31
|
# Render template
|
|
32
32
|
env = Environment(loader=FileSystemLoader(searchpath=templates_path), enable_async=True, trim_blocks=True, lstrip_blocks=True)
|
|
33
|
-
return await env.get_template("report.typ").render_async(report=report, version=version(
|
|
33
|
+
return await env.get_template("report.typ").render_async(report=report, version=version("pub-analyzer"))
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
async def render_report(report: AuthorReport | InstitutionReport, file_path: pathlib.Path) -> bytes:
|