Skip to content

Fix #3149 #3152

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

Merged
merged 11 commits into from
Oct 15, 2021
Merged

Fix #3149 #3152

merged 11 commits into from
Oct 15, 2021

Conversation

wasade
Copy link
Contributor

@wasade wasade commented Oct 6, 2021

...route load through Qiita's template loading mechanisms

antgonza and others added 2 commits September 10, 2021 13:20
...route load through Qiita's template loading mechanisms
Copy link
Member

@antgonza antgonza left a comment

Choose a reason for hiding this comment

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

Looks good but I think that

json_decode(self.request.body)

buffer.seek(0)

# validate on load
data = qiita_db.metadata_template.util.load_template_to_dataframe(rawdata)
Copy link
Member

Choose a reason for hiding this comment

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

I should have been clearer, sorry. This needs to be imported, add at the top:
from qiita_db.metadata_template.util import load_template_to_dataframe

data = pd.DataFrame.from_dict(json_decode(self.request.body),
orient='index')
# convert from json into a format that qiita can validate
rawdata = pd.DataFrame.from_dict(json_decode(self.request.body),
Copy link
Member

Choose a reason for hiding this comment

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

I think the load_template_to_dataframe accepts string so perhaps worth not converting to dataframe and then back and just do:
data = load_template_to_dataframe(json_decode(self.request.body)) but I'm not sure if json_decode returns a string or a byte.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code looks like it opens a filehandle, so I don't think a regular string would work. The spec for the REST endpoint as well is not a str representation of a TSV, but a JSON representation derived from DataFrame.to_json. I may be missing something, but I think this transform is necessary

@antgonza antgonza changed the base branch from master to dev October 14, 2021 14:13
@coveralls
Copy link

coveralls commented Oct 15, 2021

Coverage Status

coverage: 91.136% (+0.02%) from 91.119%
when pulling 20ba195 on issue-3149
into c9bb469 on dev.

@wasade wasade merged commit 38bccfc into dev Oct 15, 2021
@antgonza antgonza deleted the issue-3149 branch March 1, 2022 14:46
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.

3 participants