Skip to content

Conversation

@momo3404
Copy link
Collaborator

@momo3404 momo3404 commented Dec 19, 2025

Changes proposed in this PR:

  • Add the complete flag to the V2 API to enable accessing all questions and answers belonging to a plan in the API response.
  • Per the V2 API Documentation: "The idea is to have a flag which defaults to false and thereby is compliant with the RDA metadata standard, but can be passed in with a value of true to include the questions and answers of the plan."
  • The flag is optional and works with the api/v2/plans and api/v2/plans/[plan_id] endpoints. For example: api/v2/plans/12345?complete=true.
  • The schema the flag returns is as follows:
  •       "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>"
              },
            ]
    
  • Questions with no answers are not included in the response.

- This optional parameter is added to the plans endpoints in the V2 API
- This function fetches all questions and answers belonging to a plan.
@github-actions
Copy link

</tr>
1 Error
🚫

Please include a CHANGELOG entry.

You can find it at [CHANGELOG.md](https://github.com/DMPRoadmap/roadmap/blob/main/CHANGELOG.md).

Generated by 🚫 Danger

Comment on lines 60 to 76
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
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

@momo3404 momo3404 Jan 6, 2026

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
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