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

Merged
merged 15 commits into from
Jan 3, 2025

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 (f040624) to head (33600be).
Report is 1 commits behind head on master.

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.

pyproject.toml Outdated Show resolved Hide resolved
tests/dataset/test_tabledoc.py Outdated Show resolved Hide resolved
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#",
# },

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to keep this comment, since the intention is to uncomment it when we have a fully working implementation of the context keyword argument. Added a comment to clarify this

tripper/dataset/tabledoc.py Outdated Show resolved Hide resolved
jesper-friis and others added 2 commits December 30, 2024 12:23
Co-authored-by: Tor S. Haugland <torshaugland@gmail.com>
Co-authored-by: Tor S. Haugland <torshaugland@gmail.com>
@jesper-friis
Copy link
Contributor Author

jesper-friis commented Dec 30, 2024

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.

The result of the above is

{'a': {'b': [1, 2]}}

with the current implementation of addnested(). The purpose is to allow adding multiple of the same (nested) data. It is mentioned in the docstring for add( ), which addnested() refer to. Should it be better documented?

addnested() is more intended as a utility function rather than a main part of the public API.

This was referenced Dec 30, 2024
@jesper-friis jesper-friis merged commit c84bae1 into master Jan 3, 2025
21 checks passed
@jesper-friis jesper-friis deleted the tabledoc branch January 3, 2025 22:25
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