-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it: a631eca
82b97c5
to
a5223ec
Compare
There was a problem hiding this 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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
@@ -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): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added in 3fa6c37
There was a problem hiding this comment.
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.
There was a problem hiding this 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) |
There was a problem hiding this comment.
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
@@ -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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added in 3fa6c37
5cd1bac
to
2dc4bd7
Compare
There was a problem hiding this 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): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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..)
There was a problem hiding this comment.
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...)
There was a problem hiding this 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!
What is this PR for?
manage evaluation data from dashboard frontend pages
This PR includes
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