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

Flattening sets out of data_exporter output #113

Merged
merged 3 commits into from
Jul 9, 2024
Merged

Conversation

ialarmedalien
Copy link
Collaborator

@ialarmedalien ialarmedalien commented Jul 8, 2024

Description of PR purpose/changes

  • This PR flattens the output of the data_exporter so that items in a set can be seen and their credit metadata can be looked up. Hurrah! (Yes, it would be better to pull data directly from the workspace instead of going through the setapi nonsense... a PR for that will be coming soon.)
  • Added some tests for data_exporter.py since there were none.

Jira Ticket / Issue

Related Jira ticket: https://kbase-jira.atlassian.net/browse/DATAUP-X

  • Added the Jira Ticket to the title of the PR (e.g. DATAUP-69 Adds a PR template)

Testing Instructions

  • Details for how to test the PR:
  • Tests pass locally and in GitHub Actions

Dev Checklist:

  • My code follows the guidelines at https://sites.google.com/lbl.gov/trussresources/home?authuser=0
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • (Python) I have run Ruff on changed Python code
  • If appropriate, I have recompiled the app and added the updated StaticNarrativeImpl.py, StaticNarrativeServer.py, and compile_report.json to this PR.

Updating Version and Release Notes (if applicable)

@ialarmedalien ialarmedalien requested a review from briehl July 8, 2024 20:41
@ialarmedalien ialarmedalien self-assigned this Jul 8, 2024
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.54%. Comparing base (925e208) to head (0305b35).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #113      +/-   ##
===========================================
+ Coverage    72.47%   72.54%   +0.07%     
===========================================
  Files           24       24              
  Lines         1544     1548       +4     
===========================================
+ Hits          1119     1123       +4     
  Misses         425      425              

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

test/test_data_exporter.py Fixed Show fixed Hide fixed
Copy link
Contributor

@briehl briehl left a comment

Choose a reason for hiding this comment

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

A couple minor points in the _index_obj function.

obj_type = obj[2].split("-")[0]
if obj_type in IGNORED_TYPES:
return
obj_upa = generate_upa(item[OBJ_INFO])
Copy link
Contributor

Choose a reason for hiding this comment

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

You already have obj defined as that above, might as well use it!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Doh!

def _index_obj(
item: dict[str, Any], type_info: dict[str, Any], indexed_data: dict[str, Any]
) -> None:
"""Index by object ID and save the type information."""
Copy link
Contributor

Choose a reason for hiding this comment

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

May want to note for posterity that this has the side effects of updating the input dicts.

Copy link
Contributor

@briehl briehl left a comment

Choose a reason for hiding this comment

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

LGTM

@ialarmedalien ialarmedalien merged commit d5800ef into develop Jul 9, 2024
12 checks passed
@ialarmedalien ialarmedalien deleted the flatten_data branch July 9, 2024 17:30
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