Skip to content

Commit

Permalink
Merge pull request #87 from digital-science:v1.4
Browse files Browse the repository at this point in the history
vV1.4
  • Loading branch information
lambdamusic authored Dec 30, 2024
2 parents a18836f + 728b163 commit 9280a27
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 24 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Changelog

## v 1.4

* Fix CLI [history bug](https://github.com/digital-science/dimcli/issues/80)
* Added DSL grammar for DSL [V2.10](https://docs.dimensions.ai/dsl/releasenotes.html#version-2-10-0-2024-april-week-of-29th)

## v 1.3

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

## v 1.2

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

## v 1.1
Expand All @@ -29,7 +34,7 @@
## v 0.9.9

* New parameters for [DslDataset.as_dataframe()](https://digital-science.github.io/dimcli/modules.html#dimcli.core.api.DslDataset.as_dataframe)
* Improvements to the `--nice` and `--links` rendering of dataframes with Dimesions data
* Improvements to the `--nice` and `--links` rendering of dataframes with Dimensions data
- with hyperlinks, drop IDs if title is present
- affiliations as a list with GRID links
- generic 'default_transform' method for extra column not in transformations
Expand Down
2 changes: 1 addition & 1 deletion dimcli/VERSION.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# !/usr/bin/env python
# -*- coding: UTF-8 -*-

__version__ = "1.3" # LATEST? => https://pypi.org/project/dimcli/
__version__ = "1.4" # LATEST? => https://pypi.org/project/dimcli/
__copyright__ = "CopyRight (C) 2018-2024 by Digital Science"
__license__ = "MIT"
__author__ = "Michele Pasin"
Expand Down
60 changes: 48 additions & 12 deletions dimcli/core/dsl_grammar_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,11 @@
"fieldsets": ["basics", "extras", "categories", "studies"],
"metrics": {"count": {"description": "Total count", "name": "count"}},
"search_fields": [
"title_only",
"raw_affiliations",
"full_data",
"title_only",
"investigators",
"title_abstract_only",
"raw_affiliations",
],
},
"datasets": {
Expand Down Expand Up @@ -875,7 +875,7 @@
"type": "string",
},
"repository": {
"description": "Repository associtated with the dataset.",
"description": "Repository associated with the dataset.",
"is_entity": True,
"is_facet": True,
"is_filter": True,
Expand Down Expand Up @@ -958,7 +958,7 @@
},
"fieldsets": ["basics", "categories"],
"metrics": {"count": {"description": "Total count", "name": "count"}},
"search_fields": ["full_data", "title_only", "title_abstract_only"],
"search_fields": ["title_abstract_only", "title_only", "full_data"],
},
"funder_groups": {
"fields": {
Expand Down Expand Up @@ -1005,6 +1005,15 @@
"long_description": None,
"type": "string",
},
"active_status": {
"description": None,
"is_entity": False,
"is_facet": True,
"is_filter": True,
"is_multivalue": False,
"long_description": None,
"type": "string",
},
"active_year": {
"description": "List of active years for a grant.",
"is_entity": False,
Expand Down Expand Up @@ -1428,6 +1437,15 @@
"long_description": None,
"type": "states",
},
"research_org_types": {
"description": "Type of organisation to which investigators are affiliated. This field only contains information for organisations with GRID IDs.",
"is_entity": False,
"is_facet": True,
"is_filter": True,
"is_multivalue": False,
"long_description": None,
"type": "string",
},
"research_orgs": {
"description": "GRID organisations receiving the grant (note: identifiers are automatically extracted from the source text and can be missing in some cases).",
"is_entity": True,
Expand Down Expand Up @@ -1493,11 +1511,11 @@
},
"search_fields": [
"concepts",
"title_only",
"raw_affiliations",
"full_data",
"title_only",
"investigators",
"title_abstract_only",
"raw_affiliations",
],
},
"organizations": {
Expand Down Expand Up @@ -2207,7 +2225,7 @@
"is_entity": False,
"is_facet": False,
"is_filter": True,
"is_multivalue": False,
"is_multivalue": True,
"long_description": None,
"type": "json",
},
Expand Down Expand Up @@ -2344,8 +2362,8 @@
"inventors",
"title_only",
"assignees",
"full_data",
"title_abstract_only",
"full_data",
],
},
"policy_documents": {
Expand Down Expand Up @@ -2551,7 +2569,7 @@
},
"fieldsets": ["basics", "categories"],
"metrics": {"count": {"description": "Total count", "name": "count"}},
"search_fields": ["full_data", "title_only"],
"search_fields": ["title_only", "full_data"],
},
"publications": {
"fields": {
Expand Down Expand Up @@ -2816,6 +2834,15 @@
"long_description": None,
"type": "string",
},
"document_type": {
"description": "Document type prediction based on the content and metadata of a publication.",
"is_entity": False,
"is_facet": True,
"is_filter": True,
"is_multivalue": False,
"long_description": None,
"type": "string",
},
"doi": {
"description": "Digital object identifier.",
"is_entity": False,
Expand Down Expand Up @@ -3095,6 +3122,15 @@
"long_description": None,
"type": "string",
},
"research_org_types": {
"description": "Types of organisation associated with the publication. This field only contains information for organisations with GRID IDs.",
"is_entity": False,
"is_facet": True,
"is_filter": True,
"is_multivalue": True,
"long_description": None,
"type": "string",
},
"research_orgs": {
"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``).",
"is_entity": True,
Expand Down Expand Up @@ -3242,14 +3278,14 @@
},
"search_fields": [
"acknowledgements",
"authors",
"concepts",
"full_data_exact",
"full_data",
"terms",
"title_abstract_only",
"raw_affiliations",
"authors",
"title_only",
"full_data",
],
},
"reports": {
Expand Down Expand Up @@ -3617,7 +3653,7 @@
},
"fieldsets": ["basics", "categories"],
"metrics": {"count": {"description": "Total count", "name": "count"}},
"search_fields": ["full_data", "concepts", "title_abstract_only"],
"search_fields": ["concepts", "title_abstract_only", "full_data"],
},
"research_org_groups": {
"fields": {
Expand Down
13 changes: 6 additions & 7 deletions dimcli/repl/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ def __init__(self, filename):
# print("HISTORY: ", filename)
super(SelectiveFileHistory, self).__init__(filename)

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

5 changes: 3 additions & 2 deletions dimcli/repl/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
>>> .export_as_html: save results from last query as HTML file.
>>> .export_as_bar_chart: save results from last query as Plotly bar chart.
>>> .export_as_jupyter: save results from last query as Jupyter notebook.
>>> .export_as_gsheets: save results from last query as Google Sheets (requires gpread credentials).
>>> .export_as_gsheets: save results from last query as Google Sheets (requires gspread credentials).
>>> .show [optional: N]: print N results from last query, trying to build URLs for objects. Default N=10.
>>> .json_compact: print results of last query as single-line JSON.
>>> .json_full: print results of last query as formatted JSON.
Expand Down Expand Up @@ -303,7 +303,8 @@ def run(instance="live"):
click.secho(f"Using endpoint: {CLIENT._url} - DSL version: {_info}", dim=True)

# history
session = PromptSession(history=SelectiveFileHistory(USER_HISTORY_FILE))
session = PromptSession(history=SelectiveFileHistory(USER_HISTORY_FILE)) ### December 30, 2024
# session = PromptSession()

databuffer = DslResultsBuffer()

Expand Down

0 comments on commit 9280a27

Please sign in to comment.