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

Using SciData.output irreversibly deletes json attributes #85

Open
jrhmanning opened this issue Nov 12, 2023 · 2 comments
Open

Using SciData.output irreversibly deletes json attributes #85

jrhmanning opened this issue Nov 12, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@jrhmanning
Copy link

If a Scidata object is modified after calling the SciData.output class property, a KeyError can be raised. This is due to output deleting either self.['@graph']['scidata']['methodology'], self.['@graph']['scidata']['system'], or self.['@graph']['scidata']['dataset'] if ['aspects'], ['facets'], or ['dataseries'] are empty.

I think this can be fixed by adding try/except blocks to each of the self.aspects(), self.facets(), and self.dataseries() class methods to catch these exceptions, but I'm unsure if that fix will break anything else.

@stuchalk stuchalk added this to the Release Version 0.4 milestone Nov 13, 2023
@stuchalk stuchalk added the bug Something isn't working label Nov 13, 2023
@stuchalk
Copy link
Collaborator

Thanks for issue report. I think you are correct that adding try/except will fix this issue, but should not affect anything else. I will take a look...but I'm not sure how quickly I can get too it...

@stuchalk
Copy link
Collaborator

OK, sorry this took so long but I have just committed an update to code that should fix this. I took a (hopefully) simpler approach and copied the content to another variable in the output function, so it works on that data instead of self.meta. See commit 1ff8547. Also, other updates to the code pushed today, so any feedback in general appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants