-
Notifications
You must be signed in to change notification settings - Fork 118
[DRAFT] Add question and answer flag to V2 API #3590
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
base: api_v2_dmponline
Are you sure you want to change the base?
Conversation
- This optional parameter is added to the plans endpoints in the V2 API
- This function fetches all questions and answers belonging to a plan.
Generated by 🚫 Danger |
| if @question_and_answer | ||
| json.questions_and_answers do | ||
| outputs.each do |output| | ||
| presenter = Api::V2::ResearchOutputPresenter.new(output: output) | ||
| q_and_a = presenter.send(:fetch_all_q_and_a, plan: plan) | ||
| next if q_and_a.blank? | ||
|
|
||
| json.set! output.id.to_s do | ||
| json.array! q_and_a do |item| | ||
| json.title item[:title] | ||
| json.question item[:question] | ||
| json.answer item[:answer] | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end |
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'm looking at the comment at the top of this file:
# Note the symbol of the dmproadmap json object
# nested in extensions which is the container for the json template object, etc.
# A JSON representation of a Data Management Plan in the
# RDA Common Standard format
With the exception of json.extension, I think all of the keys here map onto the RDA-DMP-Common-Standard structure. Maybe this additional data should also be placed inside of json.extension?
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.
We'll probably have to get Marcus to sign off on what the schema should look like in the end, but I agree additional data like this should be inside the extension category. I moved it there.
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.
Marcus signed off on putting it into extension, and he also said the flag should be titled complete and the JSON should have complete_plan, like this:
"complete_plan": [
{
"title": "Question 1",
"question": "<p>What considerations will you take into account with respect to ethical, legal, or commercial issues?</p>\r\n<p><br>Describe any applicable ethical, legal, or commercial considerations related to your project and data. This includes research involving Indigenous communities and knowledges, human subjects, legal and commercial considerations/agreements, partnerships or data with a high level of risk associated with it.</p>",
"answer": "<p>test</p>"
},
{
"title": "Question 2",
"question": "<p>What data will you collect or otherwise bring into your project under this plan?</p>\r\n<p><br>Describe the data that will be collected, generated, and/or acquired.</p>",
"answer": "<p>test</p>"
},
]
I added those changes to this PR.
- Moved 'fetch_all_q_and_a' from research_output_present to plan_presenter - Moved q_and_a json to be inside extensions
- This removes the plan id from the questions and answers json
Changes proposed in this PR:
completeflag to the V2 API to enable accessing all questions and answers belonging to a plan in the API response.api/v2/plansandapi/v2/plans/[plan_id]endpoints. For example:api/v2/plans/12345?complete=true.