Skip to content

Commit 9280a27

Browse files
authored
Merge pull request #87 from digital-science:v1.4
vV1.4
2 parents a18836f + 728b163 commit 9280a27

File tree

5 files changed

+65
-24
lines changed

5 files changed

+65
-24
lines changed

CHANGELOG.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# Changelog
22

3+
## v 1.4
4+
5+
* Fix CLI [history bug](https://github.com/digital-science/dimcli/issues/80)
6+
* Added DSL grammar for DSL [V2.10](https://docs.dimensions.ai/dsl/releasenotes.html#version-2-10-0-2024-april-week-of-29th)
7+
38
## v 1.3
49

510
* Function `extract_affiliations` return an extra column for unstructured data, with the input string.
611

712
## v 1.2
813

9-
* Added DSL grammar for DSL V2.8
14+
* Added DSL grammar for DSL [V2.8](https://docs.dimensions.ai/dsl/releasenotes.html#version-2-8-0-2023-september-week-of-25th)
1015
* New utility function: [utils.explode_nested_repeated_field](https://digital-science.github.io/dimcli/modules.html#dimcli.utils.misc_utils.explode_nested_repeated_field)
1116

1217
## v 1.1
@@ -29,7 +34,7 @@
2934
## v 0.9.9
3035

3136
* New parameters for [DslDataset.as_dataframe()](https://digital-science.github.io/dimcli/modules.html#dimcli.core.api.DslDataset.as_dataframe)
32-
* Improvements to the `--nice` and `--links` rendering of dataframes with Dimesions data
37+
* Improvements to the `--nice` and `--links` rendering of dataframes with Dimensions data
3338
- with hyperlinks, drop IDs if title is present
3439
- affiliations as a list with GRID links
3540
- generic 'default_transform' method for extra column not in transformations

dimcli/VERSION.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# !/usr/bin/env python
22
# -*- coding: UTF-8 -*-
33

4-
__version__ = "1.3" # LATEST? => https://pypi.org/project/dimcli/
4+
__version__ = "1.4" # LATEST? => https://pypi.org/project/dimcli/
55
__copyright__ = "CopyRight (C) 2018-2024 by Digital Science"
66
__license__ = "MIT"
77
__author__ = "Michele Pasin"

dimcli/core/dsl_grammar_core.py

+48-12
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,11 @@
577577
"fieldsets": ["basics", "extras", "categories", "studies"],
578578
"metrics": {"count": {"description": "Total count", "name": "count"}},
579579
"search_fields": [
580-
"title_only",
581-
"raw_affiliations",
582580
"full_data",
581+
"title_only",
583582
"investigators",
584583
"title_abstract_only",
584+
"raw_affiliations",
585585
],
586586
},
587587
"datasets": {
@@ -875,7 +875,7 @@
875875
"type": "string",
876876
},
877877
"repository": {
878-
"description": "Repository associtated with the dataset.",
878+
"description": "Repository associated with the dataset.",
879879
"is_entity": True,
880880
"is_facet": True,
881881
"is_filter": True,
@@ -958,7 +958,7 @@
958958
},
959959
"fieldsets": ["basics", "categories"],
960960
"metrics": {"count": {"description": "Total count", "name": "count"}},
961-
"search_fields": ["full_data", "title_only", "title_abstract_only"],
961+
"search_fields": ["title_abstract_only", "title_only", "full_data"],
962962
},
963963
"funder_groups": {
964964
"fields": {
@@ -1005,6 +1005,15 @@
10051005
"long_description": None,
10061006
"type": "string",
10071007
},
1008+
"active_status": {
1009+
"description": None,
1010+
"is_entity": False,
1011+
"is_facet": True,
1012+
"is_filter": True,
1013+
"is_multivalue": False,
1014+
"long_description": None,
1015+
"type": "string",
1016+
},
10081017
"active_year": {
10091018
"description": "List of active years for a grant.",
10101019
"is_entity": False,
@@ -1428,6 +1437,15 @@
14281437
"long_description": None,
14291438
"type": "states",
14301439
},
1440+
"research_org_types": {
1441+
"description": "Type of organisation to which investigators are affiliated. This field only contains information for organisations with GRID IDs.",
1442+
"is_entity": False,
1443+
"is_facet": True,
1444+
"is_filter": True,
1445+
"is_multivalue": False,
1446+
"long_description": None,
1447+
"type": "string",
1448+
},
14311449
"research_orgs": {
14321450
"description": "GRID organisations receiving the grant (note: identifiers are automatically extracted from the source text and can be missing in some cases).",
14331451
"is_entity": True,
@@ -1493,11 +1511,11 @@
14931511
},
14941512
"search_fields": [
14951513
"concepts",
1496-
"title_only",
1497-
"raw_affiliations",
14981514
"full_data",
1515+
"title_only",
14991516
"investigators",
15001517
"title_abstract_only",
1518+
"raw_affiliations",
15011519
],
15021520
},
15031521
"organizations": {
@@ -2207,7 +2225,7 @@
22072225
"is_entity": False,
22082226
"is_facet": False,
22092227
"is_filter": True,
2210-
"is_multivalue": False,
2228+
"is_multivalue": True,
22112229
"long_description": None,
22122230
"type": "json",
22132231
},
@@ -2344,8 +2362,8 @@
23442362
"inventors",
23452363
"title_only",
23462364
"assignees",
2347-
"full_data",
23482365
"title_abstract_only",
2366+
"full_data",
23492367
],
23502368
},
23512369
"policy_documents": {
@@ -2551,7 +2569,7 @@
25512569
},
25522570
"fieldsets": ["basics", "categories"],
25532571
"metrics": {"count": {"description": "Total count", "name": "count"}},
2554-
"search_fields": ["full_data", "title_only"],
2572+
"search_fields": ["title_only", "full_data"],
25552573
},
25562574
"publications": {
25572575
"fields": {
@@ -2816,6 +2834,15 @@
28162834
"long_description": None,
28172835
"type": "string",
28182836
},
2837+
"document_type": {
2838+
"description": "Document type prediction based on the content and metadata of a publication.",
2839+
"is_entity": False,
2840+
"is_facet": True,
2841+
"is_filter": True,
2842+
"is_multivalue": False,
2843+
"long_description": None,
2844+
"type": "string",
2845+
},
28192846
"doi": {
28202847
"description": "Digital object identifier.",
28212848
"is_entity": False,
@@ -3095,6 +3122,15 @@
30953122
"long_description": None,
30963123
"type": "string",
30973124
},
3125+
"research_org_types": {
3126+
"description": "Types of organisation associated with the publication. This field only contains information for organisations with GRID IDs.",
3127+
"is_entity": False,
3128+
"is_facet": True,
3129+
"is_filter": True,
3130+
"is_multivalue": True,
3131+
"long_description": None,
3132+
"type": "string",
3133+
},
30983134
"research_orgs": {
30993135
"description": "GRID organisations associated to a publication. Identifiers are automatically extracted from author affiliations text, so they can be missing in some cases (note: this field supports :ref:`filter-functions`: ``count``).",
31003136
"is_entity": True,
@@ -3242,14 +3278,14 @@
32423278
},
32433279
"search_fields": [
32443280
"acknowledgements",
3245-
"authors",
32463281
"concepts",
32473282
"full_data_exact",
3248-
"full_data",
32493283
"terms",
32503284
"title_abstract_only",
32513285
"raw_affiliations",
3286+
"authors",
32523287
"title_only",
3288+
"full_data",
32533289
],
32543290
},
32553291
"reports": {
@@ -3617,7 +3653,7 @@
36173653
},
36183654
"fieldsets": ["basics", "categories"],
36193655
"metrics": {"count": {"description": "Total count", "name": "count"}},
3620-
"search_fields": ["full_data", "concepts", "title_abstract_only"],
3656+
"search_fields": ["concepts", "title_abstract_only", "full_data"],
36213657
},
36223658
"research_org_groups": {
36233659
"fields": {

dimcli/repl/history.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ def __init__(self, filename):
2424
# print("HISTORY: ", filename)
2525
super(SelectiveFileHistory, self).__init__(filename)
2626

27-
def append_string(self, string):
28-
" Add string to the history only if it is a valid DSL query"
27+
def append_string(self, string: str) -> None:
28+
"DIMCLI override: add string to the history only if it is a valid DSL query"
2929
l = G.allowed_starts_dsl_query()
30-
for x in l:
31-
if string.startswith(x):
32-
self._loaded_strings.append(string)
33-
self.store_string(string)
34-
return
30+
if string.startswith(tuple(l)):
31+
self._loaded_strings.insert(0, string)
32+
self.store_string(string)
33+

dimcli/repl/repl.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
>>> .export_as_html: save results from last query as HTML file.
5757
>>> .export_as_bar_chart: save results from last query as Plotly bar chart.
5858
>>> .export_as_jupyter: save results from last query as Jupyter notebook.
59-
>>> .export_as_gsheets: save results from last query as Google Sheets (requires gpread credentials).
59+
>>> .export_as_gsheets: save results from last query as Google Sheets (requires gspread credentials).
6060
>>> .show [optional: N]: print N results from last query, trying to build URLs for objects. Default N=10.
6161
>>> .json_compact: print results of last query as single-line JSON.
6262
>>> .json_full: print results of last query as formatted JSON.
@@ -303,7 +303,8 @@ def run(instance="live"):
303303
click.secho(f"Using endpoint: {CLIENT._url} - DSL version: {_info}", dim=True)
304304

305305
# history
306-
session = PromptSession(history=SelectiveFileHistory(USER_HISTORY_FILE))
306+
session = PromptSession(history=SelectiveFileHistory(USER_HISTORY_FILE)) ### December 30, 2024
307+
# session = PromptSession()
307308

308309
databuffer = DslResultsBuffer()
309310

0 commit comments

Comments
 (0)