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

Search tool for the question bank #1302

Open
georgekinnear opened this issue Nov 8, 2024 · 2 comments
Open

Search tool for the question bank #1302

georgekinnear opened this issue Nov 8, 2024 · 2 comments

Comments

@georgekinnear
Copy link
Collaborator

I've recently been noticing a need to search through my questions, e.g. related to #849 I wanted to find all questions where I'd used simp:false in the question text, and this past week I wanted to find all my complex numbers questions where I'd used orderless(%i) since that now seems to prevent complex numbers from being handled as expected. And just today, I wanted to find all my questions that use the multiselqnalpha MCQ helper function.

I think it would be nice if there was some built-in facility to achieve this.

One possibility would be a small expansion on the existing dependency checker in the adminui pages, to allow a custom search string.

Another possibility would be to say "this is a Moodle question bank issue" - which may be true, although STACK questions have lots of special bits to them like PRTs, so I do wonder how a general Moodle search would handle STACK questions.

Yet another possiblity is that this can be achieved by exporting the questions, and searching the Moodle XML. That's certainly true, but it's a long-ish process to have to go through - particularly for a course with ~1000 STACK questions, where producing a Moodle XML export takes some time.

For reference, I have added to the docs a query that can be used in the Ad-hoc database queries plugin (if you have access to that), to achieve this sort of searching: https://github.com/maths/moodle-qtype_stack/blob/dev/doc/en/STACK_question_admin/Advanced_reporting.md#find-questions-with-a-given-string-in-the-question-variables (this example query just searches the question variables, but it would be nice to be able to search the question text or other parts of the question where you write code, too)

@LukeLongworth
Copy link
Contributor

We have a bespoke version of this at UC that has become rather essential to our workflow, but relies on one member of our team scraping all the data overnight, storing it, and compiling it into something usable. You can see it here. We use this extensively each summer as we check that things aren't breaking during our annual Moodle/STACK upgrade, and has proved invaluable.

I believe this process is what George is describing above, with the additional steps of downloading the html for the preview page and the question usage data alongside the XMLs. As we have >10000 questions between our maths and stats databases, it is a lengthy process.

A lot of our use cases are very UC-specific, and several of them will be redundant with the new (for us) dependency checker tool, but they include:

  • Filtering questions based on which courses they appear in, and which iterations of those courses
  • Filtering based on custom tags. Some are as simple as "contains String input type" and others are more complicated like "contains a jsxgraph block with input references, but does not include a dispatchEvent call".
  • Link to the bulk tester for that folder
  • Links to the editing and preview pages in three different versions of our moodle (production, development, upgrade)
  • A full tree structure that lets us expand or close entire folders at a time.
  • Filtering by specific Quiz. This is useful to see if a quiz contains any "problem" questions based on the tag. We have a browser extension that encodes the question IDs in a given quiz and lets me copy-paste these into this tree to do this in reverse.

The biggest problem we have is keeping the data up-to-date, and the ever-present worry that the central IT team will get unhappy with us leaving a machine scraping data from Moodle running overnight. Something that accesses the database directly and doesn't rely on the expertise of a specific person would be lovely.

If this sort of search tool ends up being supported, my biggest request would be to have some facility for complex queries. Notably, being able to filter by field (Question Variables, Question Text, Question Note, Feedback Variables, Node Feedback), and having basic AND, OR, NOT, IF style conditions would enable me to do much of what I'm already doing with minor changes/omissions. I could largely recreate my more complex example above with something like (contains "input-ref" OR contains "document.getElementById") AND NOT "dispatchEvent".

Definitely interested to watch any progress on this!

@marcusgreen
Copy link
Contributor

I am working on a qbank search plugin, but at first release it will only search the question text. It is early days with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants