14.7. New task walkthrough: CORE-10 example¶
(2018-09-28.)
14.7.1. Basics¶
Starting point: checked out and happily compiling.
Understand the task.
Start with the
.rst
file.Re the CORE-10: copyright now allows electronic reproduction: http://www.coreims.co.uk/copyright.pdf.
14.7.2. Client¶
create class in
tasks/
.find a similar task, or failing that something simple!
copy/paste/edit header
at some point should run
qmake
, as it’s a new Q_OBJECT.copy/paste/edit
.cpp
file, then start to thinkchoose tablename
in constructor: is it anonymous? Does it have a clinician? Does it have a respondent?
for very simple tasks like this, can often just use a N_QUESTIONS format, with questions numbered 1 to N_QUESTIONS, and fieldname named
q1
toq<whatever>
.diversion: update the task factory, meaning update
inittasks.cpp
to initialize the task (create the table(s), etc.) during app startup.back to main task
work through calculations
build
editor()
add it to one or more menus; see
menu/
set the minimum server version; do this for the task, not the whole CamCOPS client; this means creating a task function
minimumServerVersion()
bump the client version in
camcopsversion.cpp
and
changelog.rst
and all the other things it says incamcopsversion.cpp
14.7.3. XML¶
at some point, will want an
xstring
; create the.xml
file. Since this task is freely available, put it inserver/camcops_server/extra_strings
.
14.7.4. Docs¶
update docs all-tasks list,
docs/source/tasks/_tasks_all.rst
update docs category task list,
docs/source/tasks/_tasks_by_category.rst
special for CORE-10: remove from “prohibited/missing” list, ,
docs/source/tasks/_tasks_missing.rst
from the
docs/
directory, re-runcreate_all_autodocs.py --make --destroy_first
check the docs build: from the
docs/
directory, runrebuild_docs.py
ormake html
you may need to add new autogenerated files in
docs/source/autodoc/
to the Git repository
14.7.5. Server¶
create Python file:
camcops_server/tasks/core10.py
work through, mirroring calculations on client
check with PyCharm
create database revision using
server/tools/create_database_migration.py
; this will create a new file inserver/camcops_server/alembic/versions
. Review this manually!note that the revision doesn’t contain the new task! So delete it, then…
edit
tasks/__init__.py
to load the taskcreate database migration (again…)
manually review the database migration for sanity
migration file will need adding to Git repository manually
upgrade the test database with
camcops upgrade_db ...
launch server
14.7.6. Final¶
Test
Commit!
When pushed to Github, the live docs will auto-update.