Skip to content

Commit

Permalink
v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdamusic committed Dec 12, 2023
1 parent 6f972ea commit a12fbd0
Show file tree
Hide file tree
Showing 10 changed files with 260 additions and 197 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v 1.2

* Added DSL grammar for DSL V2.8
* 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 Down
4 changes: 2 additions & 2 deletions dimcli/VERSION.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# !/usr/bin/env python
# -*- coding: UTF-8 -*-

__version__ = "1.1" # LATEST? => https://pypi.org/project/dimcli/
__copyright__ = "CopyRight (C) 2018-2023 by Digital Science"
__version__ = "1.2" # LATEST? => https://pypi.org/project/dimcli/
__copyright__ = "CopyRight (C) 2018-2024 by Digital Science"
__license__ = "MIT"
__author__ = "Michele Pasin"
__author_email__ = "michele dot pasin at digital dash science dot com"
Expand Down
111 changes: 33 additions & 78 deletions dimcli/core/dsl_grammar_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,6 @@
"long_description": None,
"type": "categories",
},
"category_for_2008": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
"is_facet": True,
"is_filter": True,
"is_multivalue": True,
"long_description": None,
"type": "categories",
},
"category_for_2020": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
Expand Down Expand Up @@ -587,10 +578,10 @@
"metrics": {"count": {"description": "Total count", "name": "count"}},
"search_fields": [
"title_only",
"title_abstract_only",
"investigators",
"raw_affiliations",
"full_data",
"investigators",
"title_abstract_only",
],
},
"datasets": {
Expand Down Expand Up @@ -649,15 +640,6 @@
"long_description": None,
"type": "categories",
},
"category_for_2008": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
"is_facet": True,
"is_filter": True,
"is_multivalue": True,
"long_description": None,
"type": "categories",
},
"category_for_2020": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
Expand Down Expand Up @@ -976,7 +958,7 @@
},
"fieldsets": ["basics", "categories"],
"metrics": {"count": {"description": "Total count", "name": "count"}},
"search_fields": ["title_only", "title_abstract_only", "full_data"],
"search_fields": ["full_data", "title_only", "title_abstract_only"],
},
"funder_groups": {
"fields": {
Expand Down Expand Up @@ -1050,15 +1032,6 @@
"long_description": None,
"type": "categories",
},
"category_for_2008": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
"is_facet": True,
"is_filter": True,
"is_multivalue": True,
"long_description": None,
"type": "categories",
},
"category_for_2020": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
Expand Down Expand Up @@ -1519,12 +1492,12 @@
},
},
"search_fields": [
"title_only",
"title_abstract_only",
"concepts",
"investigators",
"title_only",
"raw_affiliations",
"full_data",
"investigators",
"title_abstract_only",
],
},
"organizations": {
Expand Down Expand Up @@ -1950,15 +1923,6 @@
"long_description": None,
"type": "categories",
},
"category_for_2008": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
"is_facet": True,
"is_filter": True,
"is_multivalue": True,
"long_description": None,
"type": "categories",
},
"category_for_2020": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
Expand Down Expand Up @@ -2220,6 +2184,15 @@
"long_description": None,
"type": "string",
},
"kind": {
"description": "Kind code of applications, from DOCDB.",
"is_entity": False,
"is_facet": True,
"is_filter": True,
"is_multivalue": False,
"long_description": None,
"type": "string",
},
"legal_status": {
"description": "The legal status of the patent, e.g. 'Granted', 'Active', 'Abandoned' etc..",
"is_entity": False,
Expand Down Expand Up @@ -2368,11 +2341,11 @@
"fieldsets": ["basics", "extras", "categories"],
"metrics": {"count": {"description": "Total count", "name": "count"}},
"search_fields": [
"inventors",
"title_only",
"title_abstract_only",
"assignees",
"inventors",
"full_data",
"title_abstract_only",
],
},
"policy_documents": {
Expand All @@ -2395,15 +2368,6 @@
"long_description": None,
"type": "categories",
},
"category_for_2008": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
"is_facet": True,
"is_filter": True,
"is_multivalue": True,
"long_description": None,
"type": "categories",
},
"category_for_2020": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
Expand Down Expand Up @@ -2587,7 +2551,7 @@
},
"fieldsets": ["basics", "categories"],
"metrics": {"count": {"description": "Total count", "name": "count"}},
"search_fields": ["title_only", "full_data"],
"search_fields": ["full_data", "title_only"],
},
"publications": {
"fields": {
Expand Down Expand Up @@ -2699,15 +2663,6 @@
"long_description": None,
"type": "categories",
},
"category_for_2008": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
"is_facet": True,
"is_filter": True,
"is_multivalue": True,
"long_description": None,
"type": "categories",
},
"category_for_2020": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
Expand Down Expand Up @@ -3286,15 +3241,15 @@
},
},
"search_fields": [
"acknowledgements",
"authors",
"concepts",
"full_data_exact",
"full_data",
"terms",
"title_abstract_only",
"authors",
"title_only",
"concepts",
"raw_affiliations",
"full_data",
"acknowledgements",
"title_only",
],
},
"reports": {
Expand Down Expand Up @@ -3335,15 +3290,6 @@
"long_description": None,
"type": "categories",
},
"category_for_2008": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
"is_facet": True,
"is_filter": True,
"is_multivalue": True,
"long_description": None,
"type": "categories",
},
"category_for_2020": {
"description": "`ANZSRC Fields of Research classification <https://dimensions.freshdesk.com/support/solutions/articles/23000018820-what-are-fields-of-research-and-other-classification-systems-and-how-are-they-created->`_",
"is_entity": True,
Expand Down Expand Up @@ -3671,7 +3617,7 @@
},
"fieldsets": ["basics", "categories"],
"metrics": {"count": {"description": "Total count", "name": "count"}},
"search_fields": ["title_abstract_only", "full_data"],
"search_fields": ["full_data", "concepts", "title_abstract_only"],
},
"research_org_groups": {
"fields": {
Expand Down Expand Up @@ -3905,6 +3851,15 @@
"long_description": None,
"type": "string",
},
"journal_lists": {
"description": "Independent grouping of journals outside of Dimensions, e.g. 'ERA 2015' or 'Norwegian register level 1'.",
"is_entity": False,
"is_facet": True,
"is_filter": True,
"is_multivalue": True,
"long_description": None,
"type": "string",
},
"linkout": {
"description": "The source web URL, if known.",
"is_entity": False,
Expand Down
22 changes: 21 additions & 1 deletion dimcli/tests/test_dataframes.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,28 @@ def test_004(self):
click.secho("Completed test succesfully", fg="green")

def test_005(self):
click.secho("\nTEST 005: UTILS: explode_nested_repeated_field", bg="green")

# ----
res = dslquery("""search publications for "malaria" return publications[basics] limit 1000""")
click.secho("Query results for standard query: ", fg="magenta")
print(" ==> res['stats']: ", res['stats'])
print(" ==> len(res['publications']): ", len(res['publications']))
click.secho("Now exploding authors column..", fg="magenta")
df = res.as_dataframe()
print(""" ==> explode_nested_repeated_field(df, "authors") """)
df2 = explode_nested_repeated_field(df, "authors")
print("New columns: ", df2.columns)
click.secho("Now exploding inner affiliations column..", fg="magenta")
print(""" ==> explode_nested_repeated_field(df2, "authors_affiliations") """)
df3 = explode_nested_repeated_field(df2, "authors_affiliations")
print("New columns: ", df3.columns)
# ----
click.secho("Completed test succesfully", fg="green")

def test_006(self):
# ----
click.secho("\nTEST 005: Concepts extraction.", bg="green")
click.secho("\nTEST 006: Concepts extraction.", bg="green")
# ----
click.secho("Testing as_dataframe_concepts on Publications data: ", fg="magenta")
res= dslquery("""search publications for "graphene" where year=2019 return publications[id+concepts+year+title+doi+journal] limit 1000""")
Expand Down
Loading

0 comments on commit a12fbd0

Please sign in to comment.