Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New TableDoc class providing a table interface for data documentation #273

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

jesper-friis
Copy link
Contributor

Description

Added the TableDoc class providing a table interface for data documentation.

This PR builds on top of PR #272. Merge that one first.

Type of change

  • Bug fix and code cleanup
  • New feature
  • Documentation update
  • Testing

Checklist for the reviewer

This checklist should be used as a help for the reviewer.

  • Is the change limited to one issue?
  • Does this PR close the issue?
  • Is the code easy to read and understand?
  • Do all new feature have an accompanying new test?
  • Has the documentation been updated as necessary?
  • Is the code properly tested?

  - Allow to add other types of entries to the triplestore that are not
    datasets. Ex: samples, models, instruments, people, projects...
  - Renamed list_data_iris() to search_iris(). It can now be use to search
    for all types of entries.
  - Renamed prepare() to as_jsonld() and made it part of the public API
Copy link

codecov bot commented Dec 15, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 78.46%. Comparing base (78ff528) to head (92b213d).

Files with missing lines Patch % Lines
tripper/dataset/dataset.py 80.64% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #273      +/-   ##
==========================================
+ Coverage   78.21%   78.46%   +0.25%     
==========================================
  Files          20       21       +1     
  Lines        2153     2206      +53     
==========================================
+ Hits         1684     1731      +47     
- Misses        469      475       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jesper-friis jesper-friis mentioned this pull request Dec 19, 2024
10 tasks
Copy link
Contributor

@torhaugl torhaugl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested some small documentation changes.

This PR adds a TableDoc class and addnested function with tests.
One issue is that we cannot add multiple of the same nested data (two distribution.downloadURL for instance). Can you add a warning for this in addnested?

Something like if d = {"a" : {"b" : 1}}, then a warning/error is issued

d = {"a" : {"b" : 1}}
addnested(d, "a.b", 2)
### WARNING/ERROR, a.b already exists.

@@ -104,7 +104,8 @@ max-public-methods = 25
max-locals = 20
disable = [
"fixme",
"too-many-positional-arguments",
"invalid-name",
#"too-many-positional-arguments",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#"too-many-positional-arguments",

@@ -0,0 +1,81 @@
"""Test the dataset module."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Test the dataset module."""
"""Test the TableDoc class."""

Comment on lines +35 to +37
# context={
# "ds": "http:/example.com/datasets#",
# },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# context={
# "ds": "http:/example.com/datasets#",
# },


def asdicts(self) -> "List[dict]":
"""Return the table as a list of dicts."""
kw = {"_context": self.context} if self.context else {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be @context?

Suggested change
kw = {"_context": self.context} if self.context else {}
kw = {"@context": self.context} if self.context else {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants