qudb:问题数据库
项目描述
管理问题数据库并使用它来生成评估,例如作业、测验和考试。
qudb是面向教师的个人问题库。它允许您:
管理给定课程的问题集合,并从中收集各种评估。
跟踪您如何使用您的问题。查询您的数据库中的 问题、术语、评估或评估类型。
评估类型是指每学期最多重复一次的评估类型,例如quiz1、assignment2和final。它可以是标识评估类型的任意字符串。评估是给定术语中评估类型的 特定出现,因此由术语和 评估类型对来标识。
示例查询:
在哪些评估中使用了给定的问题?
哪些问题构成了给定的评估?
在给定术语中使用了哪些问题?
在所有学期的期末考试中使用了哪些问题?
使用模板通过其问题呈现评估文档。
区分论文问题(默认)和多项选择题。
在模板中使用任意附加变量,因此您可以通过引入(例如,附加课程名称变量)跨课程使用相同的模板。
入门
创建数据库:
qm init
默认情况下,此命令会创建一个./qu.db数据库文件。使用 -D(或--database)选项指定数据库文件位置。
向评估添加问题(评估由术语 和评估类型标识):
qm add --term 151 --assessment-type quiz1 questions/chapter1/whats-your-name.tex qm add --term 151 --assessment-type quiz1 questions/chapter1/mcq/choose-a-month.tex
使用-Q(或--questions-directory)选项指定查找问题文件的位置。您还可以指定问题的 分数( -p )、是否是附加问题 ( -b ) 以及它 在评估中的顺序( -o ) 如果您想将其插入到中间的某个位置。问题的积分、奖励和顺序字段是每个评估的,并且可以从一个评估更改为另一个评估。
生成评估:
qm render --term 151 --assessment-type quiz1 --pdflatex quiz-template.tex
--pdflatex选项(或-P)假定您的模板是 LaTeX 文件,需要pdflatex程序,并生成 PDF。没有它,你会得到一个渲染的模板。
--config选项(或-C)允许使用INI 样式的配置文件指定其他任意模板变量。
命令
尽管上面描述的init、add和render命令通常就足够了,但还有一些其他命令可以补充它们。此外,这三个命令有一些选项可以控制它们的操作。以下是所有支持的命令及其选项。
在里面
usage: qm init [-h] [-D DATABASE]
Create a new database file as specified by the -D option. Defaults to ./qu.db.
If the database exists, do nothing
optional arguments:
-h, --help show this help message and exit
-D DATABASE, --database DATABASE
SQLite database file path
列表
usage: qm list [-h] [-D DATABASE] [-Q QUESTIONS_DIRECTORY] [-t TERM]
[-y ASSESSMENT_TYPE] [-q QUESTION] [-m]
{terms,assessment-types,assessments,questions}
List existing entities: terms, assessment-types, assessments, or questions
positional arguments:
{terms,assessment-types,assessments,questions}
what to list
optional arguments:
-h, --help show this help message and exit
-D DATABASE, --database DATABASE
SQLite database file path
-Q QUESTIONS_DIRECTORY, --questions-directory QUESTIONS_DIRECTORY
where to look for questions. Question paths stored in
the database are relative to this path
-t TERM, --term TERM academic semester code, e.g. 142
-y ASSESSMENT_TYPE, --assessment-type ASSESSMENT_TYPE
examples: major1, assignment2, quiz3
-q QUESTION, --question QUESTION
include results related to this question only
-m, --mcq whether to retrieve MCQs or non-MCQs. cannot retrieve
both at once
添加
usage: qm add [-h] [-D DATABASE] [-Q QUESTIONS_DIRECTORY] -t TERM -y
ASSESSMENT_TYPE [-b] [-p POINTS] [-o ORDER] [-d DATE]
question
Add a question file to a given assessment, specified by a term and an
assessment-type (required options)
positional arguments:
question path to the question file
optional arguments:
-h, --help show this help message and exit
-D DATABASE, --database DATABASE
SQLite database file path
-Q QUESTIONS_DIRECTORY, --questions-directory QUESTIONS_DIRECTORY
where to look for questions. Question paths stored in
the database are relative to this path
-t TERM, --term TERM academic semester (3 digits)
-y ASSESSMENT_TYPE, --assessment-type ASSESSMENT_TYPE
examples: major1, assignment2, quiz3
-b, --bonus this is a bonus question
-p POINTS, --points POINTS
default points for question
-o ORDER, --order ORDER
the order of the question in this assessment; defaults
to last
-d DATE, --date DATE assessment date; format YYYY-MM-DD
更新
usage: qm update [-h] [-D DATABASE] [-Q QUESTIONS_DIRECTORY] -t TERM -y
ASSESSMENT_TYPE [-b] [-p POINTS] [-o ORDER] [-d DATE]
question
Update an existing assessment or question
positional arguments:
question path to the question file
optional arguments:
-h, --help show this help message and exit
-D DATABASE, --database DATABASE
SQLite database file path
-Q QUESTIONS_DIRECTORY, --questions-directory QUESTIONS_DIRECTORY
where to look for questions. Question paths stored in
the database are relative to this path
-t TERM, --term TERM academic semester (3 digits)
-y ASSESSMENT_TYPE, --assessment-type ASSESSMENT_TYPE
examples: major1, assignment2, quiz3
-b, --bonus this is a bonus question
-p POINTS, --points POINTS
default points for question
-o ORDER, --order ORDER
the order of the question in this assessment; defaults
to last
-d DATE, --date DATE assessment date; format YYYY-MM-DD
删除(或rm)
usage: qm remove [-h] [-D DATABASE] [-Q QUESTIONS_DIRECTORY] -t TERM -y
ASSESSMENT_TYPE
Remove a question from an assessment
optional arguments:
-h, --help show this help message and exit
-D DATABASE, --database DATABASE
SQLite database file path
-Q QUESTIONS_DIRECTORY, --questions-directory QUESTIONS_DIRECTORY
where to look for questions. Question paths stored in
the database are relative to this path
-t TERM, --term TERM academic semester (3 digits)
-y ASSESSMENT_TYPE, --assessment-type ASSESSMENT_TYPE
examples: major1, assignment2, quiz3
使成为
usage: qm render [-h] [-D DATABASE] [-Q QUESTIONS_DIRECTORY] -t TERM -y
ASSESSMENT_TYPE [-O OUTPUT_DIRECTORY] [-C CONFIG] [-P]
[-l MATERIAL]
template
Generate assessment documents using the specified template. Two documents are
generated: TERM-ASSESSMENT_TYPE.tex and TERM-ASSESSMENT_TYPE-solution.tex,
with the template variable "solution" set to False and True, respectively.
Templates are rendered using the Jinja2 template engine, with the following
delimiters: <% block %><% endblock %>, << variable >>, <# comment #>
positional arguments:
template path to the jinja2 template file
optional arguments:
-h, --help show this help message and exit
-D DATABASE, --database DATABASE
SQLite database file path
-Q QUESTIONS_DIRECTORY, --questions-directory QUESTIONS_DIRECTORY
where to look for questions. Question paths stored in
the database are relative to this path
-t TERM, --term TERM academic semester (3 digits)
-y ASSESSMENT_TYPE, --assessment-type ASSESSMENT_TYPE
examples: major1, assignment2, quiz3
-O OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY
the directory in which the rendered files will be
saved
-C CONFIG, --config CONFIG
ini-style configuration file defining additional
template variables. (Use section [templates])
-P, --pdflatex process rendered file with pdflatex (4 runs)
-l MATERIAL, --material MATERIAL
specify the material to which this assessment
pertains. Available to the template in the "material"
variable
出口
usage: qm export [-h] [-D DATABASE] [--overwrite] file
Export the database to a YAML file (does not include the contents of question
files)
positional arguments:
file YAML file to export to
optional arguments:
-h, --help show this help message and exit
-D DATABASE, --database DATABASE
SQLite database file path
--overwrite overwrite the file if it already exists
进口
usage: qm import [-h] [-D DATABASE] [-Q QUESTIONS_DIRECTORY] [-u] file
Import data from a YAML file into the database. To learn the YAML schema,
export a minimal database, or see the README.md file
positional arguments:
file YAML file to import
optional arguments:
-h, --help show this help message and exit
-D DATABASE, --database DATABASE
SQLite database file path
-Q QUESTIONS_DIRECTORY, --questions-directory QUESTIONS_DIRECTORY
where to look for questions. Question paths stored in
the database are relative to this path
-u, --update ignore existing, identical questions
有效 YAML 数据示例:
<s>'142'</s>: # term code
quiz1: # assessment type: creates an assessment in the parent term
- file: questions/chapter1/q1.tex # each item in the list is a question
- file: questions/chapter2/q5.tex # file: the file containing the question text
date: 2015-02-14 # a date in any question sets the assessment date
- bonus: true # set this question as a bonus question
file: questions/chapter2/arm-gcc.tex
points: 20 # how many points are assigned to this question in this assessment
quiz2: # another assessment in the same term
- date: 2015-03-07
file: questions/chapter3/q2.tex
- file: questions/chapter3/q3.tex
points: 20
<s>'151'</s>: # another term
quiz1: # this is a different assessment from the previous quiz1,
# because it belongs to a different term
- file: questions/chapter6/q3.tex
模板
模板使用Jinja2模板语言。render命令需要--term和 --assessment -type选项来指定评估。模板中提供了以下评估变量:
term:指定评估的期限。
title:评估标题,基于其类型。例如,quiz1 生成标题Quiz 1,major1生成标题 Major Exam 1。
date:评估日期,使用add和update命令的--date选项指定。
解决方案(布尔值):我们是否正在渲染解决方案。
qs:属于此评估的问题对象的有序列表。包括以下字段:
question.file:问题文件的路径。
点数:问题点。
奖金(布尔值):这是否是一个奖金问题。
mcqs:多项选择题对象的有序列表,否则类似于qs。
questions_relpath:从当前目录到问题的相对路径,由-Q / --questions-directory 选项指定。
通过将变量括在<< 和>>中,可以在模板中引用变量。例如,<<title >>呈现评估的 标题。
要在模板中使用一些基本逻辑,请使用模板语句,例如for循环或if条件,方法是将它们括在<%和 %>中。例如:
<% for q in qs %>
<% if q.bonus %>
\bonusquestion
<% else %>
\question
<% endif %>
<% if q.points %>[<< q.points >>]<% endif %>
\input{<< questions_relpath >>/<< q.question.file >>}
<% endfor %>
有关模板语言的信息,请参阅Jinja2 模板设计器文档。
假设
每门课程一个SQLite数据库文件。
问题和模板是文本文件。
多项选择题的路径中有一个/mcq/组件。
每个问题文件都包含问题的解决方案,以便在模板中轻松列出或省略它。
虽然不是必需的,但 qudb与 考试LaTeX 包配合得很好。例如,每个问题文件都可以将解决方案包装在一个解决方案环境中,然后模板可以根据解决方案模板变量 的值轻松包含或排除解决方案,如下所示:
<% if solution %>
\printanswers
<% endif %>
执照
BSD(2 条款)。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。