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

add evaluation data page #103

Merged
merged 14 commits into from
Jul 6, 2019
Merged

add evaluation data page #103

merged 14 commits into from
Jul 6, 2019

Conversation

yuki-mt
Copy link
Member

@yuki-mt yuki-mt commented May 21, 2019

What is this PR for?

manage evaluation data from dashboard frontend pages

This PR includes

  • backend (implementation: 426c176, test: 667cc35 )
    • add description to Evaluation model
    • add API to download evaluation data file
    • add API to get all evaluations
  • frontend ( a5223ec )
    • add link to evaluation page in SideMenu
    • show all evaluations as table
    • download button to each evaluation row
    • upload button for evaluation file
    • delete evaluations with checkbox and button

What type of PR is it?

Feature

What is the issue?

N/A

How should this be tested?

python -m unittest test/apis/test_api_evaluation.py

I will add pages for EvaluationResult and EvaluationResult list in the next PRs

@yuki-mt yuki-mt requested a review from keigohtr May 21, 2019 06:30
@yuki-mt yuki-mt self-assigned this May 21, 2019
@codecov-io
Copy link

codecov-io commented May 21, 2019

Codecov Report

Merging #103 into master will decrease coverage by 0.48%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
- Coverage   83.73%   83.25%   -0.49%     
==========================================
  Files          43       43              
  Lines        2281     2311      +30     
==========================================
+ Hits         1910     1924      +14     
- Misses        371      387      +16
Impacted Files Coverage Δ
rekcurd_dashboard/models/evaluation.py 94.11% <100%> (+0.36%) ⬆️
rekcurd_dashboard/apis/api_evaluation.py 41.02% <48.57%> (+0.86%) ⬆️

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 4508c69...2dc4bd7. Read the comment docs.

test/apis/test_api_evaluation.py Show resolved Hide resolved
return {"status": True, "evaluation_id": evaluation_model.evaluation_id}
raise RekcurdDashboardException(
'the file already exists. ID: {}, Description: {}'.format(
evaluation_model.evaluation_id, evaluation_model.description))
Copy link
Member Author

Choose a reason for hiding this comment

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

I changed return 400 instead of 200 in this case
because it is weird to display as Success but nothing is added to the list page when uploading same content file.

Copy link
Member Author

@yuki-mt yuki-mt May 21, 2019

Choose a reason for hiding this comment

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

I just noticed that in this way, there is no way to know evaluation_id of existing file contents as JSON response.
So I will add duplicated_ok flag to request

Copy link
Member Author

Choose a reason for hiding this comment

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

I did it: a631eca

@yuki-mt yuki-mt force-pushed the feature/evaluation-data-frontend branch from 82b97c5 to a5223ec Compare May 21, 2019 07:01
@yuki-mt
Copy link
Member Author

yuki-mt commented May 21, 2019

related issues: #104 #23

Copy link
Member

@keigohtr keigohtr left a comment

Choose a reason for hiding this comment

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

@yuki-mt Thank you for your great work.
Could you fix these comments I made?

upload_parser.add_argument('file', location='files', type=FileStorage, required=True)
upload_parser.add_argument('filepath', location='files', type=FileStorage, required=True)
upload_parser.add_argument('description', location='form', type=str, required=True)
upload_parser.add_argument('duplicated_ok', location='form', type=bool, required=False, default=False)
Copy link
Member

Choose a reason for hiding this comment

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

Don't you use duplicated_ok argument from frontend?

Copy link
Member Author

Choose a reason for hiding this comment

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

@keigohtr
In Frontend, I think the error message is informational enough for duplicated data, so I did not use it

Copy link
Member

Choose a reason for hiding this comment

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

How do we use duplicated_ok argument?

test/apis/test_api_evaluation.py Show resolved Hide resolved
rekcurd_dashboard/apis/api_evaluation.py Show resolved Hide resolved
@@ -109,6 +151,29 @@ def delete(self, project_id: int, application_id: str, evaluation_id: int):
return {"status": True, "message": "Success."}


@evaluation_api_namespace.route('/projects/<int:project_id>/applications/<application_id>/evaluations/<int:evaluation_id>/download')
class ApiEvaluationIdDownload(Resource):
def get(self, project_id: int, application_id: str, evaluation_id: int):
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a serializer for this endpoint?
It helps user what is the output when we use swagger-ui.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added in 3fa6c37

Copy link
Member

Choose a reason for hiding this comment

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

I am sorry.
I want you to add @evaluation_api_namespace.marshal_with statement to know the response contents.

Copy link
Member Author

@yuki-mt yuki-mt left a comment

Choose a reason for hiding this comment

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

I fixed some and made some comments.

upload_parser.add_argument('file', location='files', type=FileStorage, required=True)
upload_parser.add_argument('filepath', location='files', type=FileStorage, required=True)
upload_parser.add_argument('description', location='form', type=str, required=True)
upload_parser.add_argument('duplicated_ok', location='form', type=bool, required=False, default=False)
Copy link
Member Author

Choose a reason for hiding this comment

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

@keigohtr
In Frontend, I think the error message is informational enough for duplicated data, so I did not use it

rekcurd_dashboard/apis/api_evaluation.py Show resolved Hide resolved
@@ -109,6 +151,29 @@ def delete(self, project_id: int, application_id: str, evaluation_id: int):
return {"status": True, "message": "Success."}


@evaluation_api_namespace.route('/projects/<int:project_id>/applications/<application_id>/evaluations/<int:evaluation_id>/download')
class ApiEvaluationIdDownload(Resource):
def get(self, project_id: int, application_id: str, evaluation_id: int):
Copy link
Member Author

Choose a reason for hiding this comment

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

I added in 3fa6c37

@yuki-mt yuki-mt force-pushed the feature/evaluation-data-frontend branch from 5cd1bac to 2dc4bd7 Compare June 30, 2019 07:29
Copy link
Member

@keigohtr keigohtr left a comment

Choose a reason for hiding this comment

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

@yuki-mt Thank you for fixing!
There is only 1 left we need to fix. Could you check my comment?

class ApiEvaluationIdDownload(Resource):
@evaluation_api_namespace.response(200, description='return evaluation text file.')
@evaluation_api_namespace.produces(['text/plain'])
def get(self, project_id: int, application_id: str, evaluation_id: int):
Copy link
Member

Choose a reason for hiding this comment

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

Could you add @evaluation_api_namespace.marshal_with here?

Copy link
Member Author

Choose a reason for hiding this comment

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

This API returns text file, not JSON, so probably there is no way to add marshal_with

(At least, I could not find it..)

Copy link
Member

Choose a reason for hiding this comment

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

I see.
(I also could not find the way...)

rekcurd_dashboard/apis/api_evaluation.py Show resolved Hide resolved
Copy link
Member

@keigohtr keigohtr left a comment

Choose a reason for hiding this comment

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

LGTM
Great work with you!

@yuki-mt yuki-mt merged commit 616bada into master Jul 6, 2019
@yuki-mt yuki-mt deleted the feature/evaluation-data-frontend branch July 6, 2019 10:58
@yuki-mt yuki-mt mentioned this pull request Jul 7, 2019
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