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

enh: implement metadata aggregator for asset summary #34

Merged
merged 18 commits into from
Jun 16, 2021

Conversation

satra
Copy link
Member

@satra satra commented Jun 16, 2021

This PR implements the computation of asset summary for a dandiset to this library.

  • slight changes to regexes required pattern updates (so new schema will be released)

addresses part 1 of dandi/dandi-archive#337

will file a PR on API to use this.

@codecov
Copy link

codecov bot commented Jun 16, 2021

Codecov Report

Merging #34 (9ab77b1) into master (075d8f7) will increase coverage by 1.09%.
The diff coverage is 96.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #34      +/-   ##
==========================================
+ Coverage   94.65%   95.75%   +1.09%     
==========================================
  Files          11       11              
  Lines         879      965      +86     
==========================================
+ Hits          832      924      +92     
+ Misses         47       41       -6     
Flag Coverage Δ
unittests 95.75% <96.87%> (+1.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dandischema/metadata.py 97.07% <95.58%> (-0.07%) ⬇️
dandischema/consts.py 100.00% <100.00%> (ø)
dandischema/models.py 93.73% <100.00%> (+2.04%) ⬆️
dandischema/tests/test_metadata.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 075d8f7...9ab77b1. Read the comment docs.

@satra satra requested a review from yarikoptic June 16, 2021 02:19
@satra satra added patch Increment the patch version when merged release Create a release when this pr is merged labels Jun 16, 2021
yarikoptic and others added 16 commits June 16, 2021 11:58
IMHO aggregate is not sufficiently descriptive of it purpose and behavior (mutates, instead of return aggregated value).

AFAIK this function is not (yet at least) to be used by external tools, so I made it protected.
Also added some type hints while at it
It is used only once, not generic (spreads logic about variableMeasured).

Placing that logic directly where used IMHO makes it easier to follow the code
That is AFAIK where all models are defined and IMHO they should not be in metadata,
which is supporting functionality for dealing with all those models/metadata
so we somehow do not match a directory or some funkily named non-nii
file
I do not quite like aggregate_assets_summary and would prefer to
start producing constructors such as AssetsSummary.from_metadata
and alike.  But I disliked toSummary more: name camel cased, mutating
provided stats.

Notable other difference - decided to return AssetsSummary itself,
and let outside code to do .json_dict() or any other desired serializer
Made them all private since we do not / want to expose them AFAIK since
otherwise would become a part of the interface etc
Detected by mypy and I think it would be a legit thing to do
to keep metadata module interface free of manipulating models.
Later we might RF to get AssetsSummary.from_assets and alike
Explicit better than implicit and IMHO semantically (since we are not saying
that it is ALLOWED_OLDER_INPUT_SCHEMAS) I think it would be more correct.

Did it in the code to avoid hardcoding duplicates
* upstream/master:
  Update dandischema/datacite.py
  Only attempt to remove contributorType if present
@yarikoptic
Copy link
Member

Let's proceed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged release Create a release when this pr is merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants