Skip to content

Commit a0f924b

Browse files
committed
Remove all_metrics
1 parent f113a11 commit a0f924b

File tree

3 files changed

+173
-174
lines changed

3 files changed

+173
-174
lines changed

docs/reference/scival/InstitutionMetrics.rst

Lines changed: 113 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,18 @@ For **nested metrics** (like CollaborationImpact), `metric_type` contains the ma
8484
.. note::
8585
**Unified Data Structure**: InstitutionMetrics uses a unified `MetricData` structure with `entity_id` and `entity_name` fields. For institutions, these fields contain the institution ID and institution name respectively. This structure is compatible with `AuthorMetrics` and other SciVal metric classes, enabling consistent data analysis across different entity types.
8686
87-
**Getting All Metrics at Once**
87+
**Concatenating Metrics**
88+
8889
89-
You can retrieve all available metrics in a single list using the `all_metrics` property:
9090
9191
.. code-block:: python
9292
93-
>>> all_data = institution_metrics.all_metrics
94-
>>> len(all_data)
95-
28
96-
>>> # Convert to pandas DataFrame for analysis
9793
>>> import pandas as pd
98-
>>> df = pd.DataFrame(all_data)
94+
>>>
95+
>>> collab_data = []
96+
>>> collab_data.extend(institution_metrics.Collaboration)
97+
>>> collab_data.extend(institution_metrics.CollaborationImpact)
98+
>>> df = pd.DataFrame(collab_data)
9999
>>> df.head()
100100
101101
@@ -137,56 +137,56 @@ You can retrieve all available metrics in a single list using the `all_metrics`
137137
<th>0</th>
138138
<td>309021</td>
139139
<td>Humboldt University of Berlin</td>
140-
<td>Academic-corporate collaboration</td>
141-
<td>AcademicCorporateCollaboration</td>
140+
<td>Institutional collaboration</td>
141+
<td>Collaboration</td>
142142
<td>all</td>
143-
<td>1015.000000</td>
144-
<td>4.469594</td>
145-
<td>NaN</td>
143+
<td>980.000000</td>
144+
<td>4.32</td>
145+
<td>None</td>
146146
</tr>
147147
<tr>
148148
<th>1</th>
149149
<td>309021</td>
150150
<td>Humboldt University of Berlin</td>
151-
<td>No academic-corporate collaboration</td>
152-
<td>AcademicCorporateCollaboration</td>
151+
<td>International collaboration</td>
152+
<td>Collaboration</td>
153153
<td>all</td>
154-
<td>21694.000000</td>
155-
<td>95.530410</td>
156-
<td>NaN</td>
154+
<td>12754.000000</td>
155+
<td>56.16</td>
156+
<td>None</td>
157157
</tr>
158158
<tr>
159159
<th>2</th>
160160
<td>309021</td>
161161
<td>Humboldt University of Berlin</td>
162-
<td>Academic-corporate collaboration</td>
163-
<td>AcademicCorporateCollaborationImpact</td>
162+
<td>National collaboration</td>
163+
<td>Collaboration</td>
164164
<td>all</td>
165-
<td>59.104435</td>
166-
<td>NaN</td>
167-
<td>NaN</td>
165+
<td>6728.000000</td>
166+
<td>29.63</td>
167+
<td>None</td>
168168
</tr>
169169
<tr>
170170
<th>3</th>
171171
<td>309021</td>
172172
<td>Humboldt University of Berlin</td>
173-
<td>No academic-corporate collaboration</td>
174-
<td>AcademicCorporateCollaborationImpact</td>
173+
<td>Single authorship</td>
174+
<td>Collaboration</td>
175175
<td>all</td>
176-
<td>14.222181</td>
177-
<td>NaN</td>
178-
<td>NaN</td>
176+
<td>2247.000000</td>
177+
<td>9.89</td>
178+
<td>None</td>
179179
</tr>
180180
<tr>
181181
<th>4</th>
182182
<td>309021</td>
183183
<td>Humboldt University of Berlin</td>
184-
<td>Collaboration</td>
185184
<td>Institutional collaboration</td>
185+
<td>CollaborationImpact</td>
186186
<td>all</td>
187-
<td>980.000000</td>
188-
<td>4.320000</td>
187+
<td>8.610204</td>
189188
<td>NaN</td>
189+
<td>None</td>
190190
</tr>
191191
</tbody>
192192
</table>
@@ -204,8 +204,8 @@ You can analyze multiple institutions simultaneously and retrieve metrics `by_ye
204204
InstitutionMetrics for 2 institution(s):
205205
- Technical University of Berlin (ID: 309050)
206206
- Heidelberg University  (ID: 309076)
207-
>>> # Get all collaboration metrics for all institutions
208-
>>> df = pd.DataFrame(multi_institutions.all_metrics)
207+
>>> # Get CitedPublications metrics
208+
>>> df = pd.DataFrame(multi_institutions.CitedPublications)
209209
>>> df.head()
210210
211211
.. raw:: html
@@ -227,6 +227,7 @@ You can analyze multiple institutions simultaneously and retrieve metrics `by_ye
227227
font-size: 12px;
228228
}
229229
</style>
230+
<div>
230231
<table border="1" class="dataframe">
231232
<thead>
232233
<tr style="text-align: right;">
@@ -246,56 +247,111 @@ You can analyze multiple institutions simultaneously and retrieve metrics `by_ye
246247
<th>0</th>
247248
<td>309050</td>
248249
<td>Technical University of Berlin</td>
249-
<td>AcademicCorporateCollaboration</td>
250-
<td>Academic-corporate collaboration</td>
250+
<td>CitedPublications</td>
251+
<td>CitedPublications</td>
251252
<td>2024</td>
252-
<td>282.0</td>
253-
<td>7.770736</td>
254-
<td>NaN</td>
253+
<td>2400</td>
254+
<td>66.133920</td>
255+
<td>None</td>
255256
</tr>
256257
<tr>
257258
<th>1</th>
258259
<td>309050</td>
259260
<td>Technical University of Berlin</td>
260-
<td>AcademicCorporateCollaboration</td>
261-
<td>Academic-corporate collaboration</td>
261+
<td>CitedPublications</td>
262+
<td>CitedPublications</td>
262263
<td>2020</td>
263-
<td>285.0</td>
264-
<td>7.740358</td>
265-
<td>NaN</td>
264+
<td>3294</td>
265+
<td>89.462250</td>
266+
<td>None</td>
266267
</tr>
267268
<tr>
268269
<th>2</th>
269270
<td>309050</td>
270271
<td>Technical University of Berlin</td>
271-
<td>AcademicCorporateCollaboration</td>
272-
<td>Academic-corporate collaboration</td>
272+
<td>CitedPublications</td>
273+
<td>CitedPublications</td>
273274
<td>2021</td>
274-
<td>250.0</td>
275-
<td>6.529120</td>
276-
<td>NaN</td>
275+
<td>3385</td>
276+
<td>88.404290</td>
277+
<td>None</td>
277278
</tr>
278279
<tr>
279280
<th>3</th>
280281
<td>309050</td>
281282
<td>Technical University of Berlin</td>
282-
<td>AcademicCorporateCollaboration</td>
283-
<td>Academic-corporate collaboration</td>
283+
<td>CitedPublications</td>
284+
<td>CitedPublications</td>
284285
<td>2022</td>
285-
<td>249.0</td>
286-
<td>6.709782</td>
287-
<td>NaN</td>
286+
<td>3209</td>
287+
<td>86.472650</td>
288+
<td>None</td>
288289
</tr>
289290
<tr>
290291
<th>4</th>
291292
<td>309050</td>
292293
<td>Technical University of Berlin</td>
293-
<td>AcademicCorporateCollaboration</td>
294-
<td>Academic-corporate collaboration</td>
294+
<td>CitedPublications</td>
295+
<td>CitedPublications</td>
295296
<td>2023</td>
296-
<td>253.0</td>
297-
<td>6.693122</td>
298-
<td>NaN</td>
297+
<td>3044</td>
298+
<td>80.529100</td>
299+
<td>None</td>
300+
</tr>
301+
<tr>
302+
<th>5</th>
303+
<td>309076</td>
304+
<td>Heidelberg University</td>
305+
<td>CitedPublications</td>
306+
<td>CitedPublications</td>
307+
<td>2024</td>
308+
<td>5937</td>
309+
<td>72.517410</td>
310+
<td>None</td>
311+
</tr>
312+
<tr>
313+
<th>6</th>
314+
<td>309076</td>
315+
<td>Heidelberg University</td>
316+
<td>CitedPublications</td>
317+
<td>CitedPublications</td>
318+
<td>2020</td>
319+
<td>7423</td>
320+
<td>92.005455</td>
321+
<td>None</td>
322+
</tr>
323+
<tr>
324+
<th>7</th>
325+
<td>309076</td>
326+
<td>Heidelberg University</td>
327+
<td>CitedPublications</td>
328+
<td>CitedPublications</td>
329+
<td>2021</td>
330+
<td>7828</td>
331+
<td>90.864770</td>
332+
<td>None</td>
333+
</tr>
334+
<tr>
335+
<th>8</th>
336+
<td>309076</td>
337+
<td>Heidelberg University</td>
338+
<td>CitedPublications</td>
339+
<td>CitedPublications</td>
340+
<td>2022</td>
341+
<td>7354</td>
342+
<td>88.166885</td>
343+
<td>None</td>
344+
</tr>
345+
<tr>
346+
<th>9</th>
347+
<td>309076</td>
348+
<td>Heidelberg University</td>
349+
<td>CitedPublications</td>
350+
<td>CitedPublications</td>
351+
<td>2023</td>
352+
<td>6921</td>
353+
<td>85.150100</td>
354+
<td>None</td>
299355
</tr>
300356
</tbody>
301357
</table>

pybliometrics/scival/institution_metrics.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,6 @@ def AcademicCorporateCollaborationImpact(self) -> Optional[list]:
2424
"""
2525
return extract_metric_data(self._json, 'AcademicCorporateCollaborationImpact', self._by_year, "institution")
2626

27-
@property
28-
def all_metrics(self) -> Optional[list]:
29-
"""Get all available metrics concatenated into a single list.
30-
Returns list of MetricData namedtuples with unified structure:
31-
(entity_id, entity_name, metric, metric_type, year, value, percentage, threshold)
32-
"""
33-
all_metrics = []
34-
35-
# List of all metric properties
36-
if self._metric_types:
37-
metric_properties = self._metric_types.split(",")
38-
39-
for prop_name in metric_properties:
40-
metrics = getattr(self, prop_name)
41-
if metrics:
42-
all_metrics.extend(metrics)
43-
44-
return all_metrics or None
45-
4627
@property
4728
def institutions(self) -> Optional[list]:
4829
"""A list of namedtuples representing institutions and their basic info
@@ -168,9 +149,8 @@ def __init__(self,
168149
Note:
169150
All metric properties return lists of MetricData namedtuples with
170151
unified structure: `(entity_id, entity_name, metric, metric_type,
171-
year, value, percentage, threshold)`. Use the `all_metrics` property
172-
to get all metrics concatenated into a single list for easy data
173-
manipulation and analysis.
152+
year, value, percentage, threshold)`.
153+
174154
"""
175155
self._view = ''
176156
self._refresh = refresh

0 commit comments

Comments
 (0)