Для всех и для @sqz7, начавшего обсуждение Calculate a Score from a survey.
Задача: отправлять по электронной почте письмо с результатом «оценки лечения неразорвавшейся внутричерепной аневризмы» (примечание: фраза в кавычках переведена в Google Translate).
Статус: не решено
Что сделано:
- форма опроса,
- шаблонная страница, по которой создаются новые страницы с результатом.
Инструментарий:
- «Докувики» версии «Игорь»,
- плагин Bureaucracy (вер. 2023-05-16) для создания формы опроса (оценки),
- плагин Cell Background (вер. 2013-10-09) для окрашивания результирующих ячеек таблицы,
- плагин TableCalc (вер. 2020-08-27) для вычислений,
- плагин Table Width (вер. 2022-08-09) для задания ширины таблицы и её столбцов,
- плагин Wrap (вер. 2022-08-10) для выделения и скрытия части текст.
Замечание: скриншоты делались с кастомизированного стандарного стиля (шаблона) «Докувики».
Для решения нужно использовать script-режим плагина Bureaucracy, но так как в этом я ещё не силён, то сразу начал использовать mail-режим.
После тестирования mail-режим «отпал», потому что формулы TableCalc так и оставались формулами.
Перешёл к template-режим. Для экспорта страницы в pdf-формат предполагалось использовать плагин Dw2Pdf (вер. 2023-11-25). Выяснилось, что плагин не конвертировал (не отображал) вычисления TableCalc, поэтому воспользовался дополнением Print to PDF для браузера Firefox.
Исходная форма: источник
Форма Bureaucracy:
Вики-разметка страницы с формой:
====== UIATS ======
<form>
action template playground:uiats-table playground:uiats:@@title@@
hidden "title" "=u-%F_%H-%M-%S"
fieldset "1"
wiki "<wrap em>**P A T I E N T**</wrap>"
fieldset "1.1 - Age"
select "Please select the corresponding age" "|‹ 40 years|40-60 years|61-70 years|71-80 years|› 80 years"
fieldset "1.1 - Age - control" "Please select the corresponding age" ""
static "x"
fieldset "1.1 - Age - score: 4" "Please select the corresponding age" "‹ 40 years"
static "v"
hidden "ch_age4" "=v"
hidden "age4" "=4"
fieldset "1.1 - Age - score: 3" "Please select the corresponding age" "40-60 years"
static "v"
hidden "ch_age3" "=v"
hidden "age3" "=3"
fieldset "1.1 - Age - score: 2" "Please select the corresponding age" "61-70 years"
static "v"
hidden "ch_age2" "=v"
hidden "age2" "=2"
fieldset "1.1 - Age - score: 1" "Please select the corresponding age" "71-80 years"
static "v"
hidden "ch_age1" "=v"
hidden "age1" "=1"
fieldset "1.1 - Age - score: 0" "Please select the corresponding age" "› 80 years"
static "v"
hidden "ch_age0" "=v"
hidden "age0" "=0"
fieldset "1.2 - Risk factor incidence (multiple, please select all that apply)"
yesno "Previous SAH from a different aneurysm" "=<wrap hide>4</wrap>v"
yesno "Familial intracranial aneurysms or SAH" "=<wrap hide>3</wrap>v"
yesno "Japanese, Finnish, Inuit ethnicity" "=<wrap hide>2</wrap>v"
yesno "Current cigarette smoking" "=<wrap hide>3</wrap>v"
yesno "Hypertension (systolic BP › 140 mmHg)" "=<wrap hide>2</wrap>v"
yesno "Autosomal-polycystic kidney disease" "=<wrap hide>2</wrap>v"
yesno "Current drug abuse (cocain, amphetamine)" "=<wrap hide>2</wrap>v"
yesno "Current alcohol abuse" "=<wrap hide>1</wrap>v"
fieldset "1.3 - Clinical symptoms related to UAI (multiple, please select all that apply)"
yesno "Cranial nerve deficit" "=<wrap hide>4</wrap>v"
yesno "Clinical or radiological mass effect" "=<wrap hide>4</wrap>v"
yesno "Thromboembolic events from the aneurysm" "=<wrap hide>3</wrap>v"
yesno "Epilepsy" "=<wrap hide>1</wrap>v"
fieldset "1.4 - Other (multiple, please select all that apply)"
yesno "Reduced quality of life due to fear of rupture" "=<wrap hide>2</wrap>v"
yesno "Aneurysm multiplicity" "=<wrap hide>1</wrap>v"
fieldset "1.5 - Life expectancy due to chronic and/or malignant diseases (single, please select one option)"
select "(1.5) Please select:" "|‹ 5 years|5-10 years|› 10 years"
fieldset "1.5 - Life expectancy - control" "(1.5) Please select:" ""
static "x"
fieldset "1.5 - Life expectancy - score: 4" "(1.5) Please select:" "‹ 5 years"
static "v"
hidden "ch_lifeexp4" "=v"
hidden "lifeexp4" "=4"
fieldset "1.5 - Life expectancy - score: 3" "(1.5) Please select:" "5-10 years"
static "v"
hidden "ch_lifeexp3" "=v"
hidden "lifeexp3" "=3"
fieldset "1.5 - Life expectancy - score: 1" "(1.5) Please select:" "› 10 years"
static "v"
hidden "ch_lifeexp1" "=v"
hidden "lifeexp1" "=1"
fieldset "1.6 - Comorbid diseases (multiple, please select all that apply)"
yesno "Neurocognitive disorder" "=<wrap hide>3</wrap>v"
yesno "Coagulopathies, thrombophilic diseases" "=<wrap hide>2</wrap>v"
yesno "Psychiatric disorder" "=<wrap hide>2</wrap>v"
fieldset "2"
wiki "<wrap em>**A N E U R Y S M**</wrap>"
fieldset "2.1 - Maximum diameter of the Aneurysm"
select "(2.1) Please select:" "|≤ 3.9 mm|4.0-6.9 mm|7.0-12.9 mm|13.0-24.9 mm|≥ 25 mm"
fieldset "2.1 - Maximum diameter of the Aneurysm - control" "(2.1) Please select:" ""
static "x"
fieldset "2.1 - Maximum diameter of the Aneurysm - score: 0" "(2.1) Please select:" "≤ 3.9 mm"
static "v"
hidden "ch_maxdiam0" "=v"
hidden "maxdiam0" "=0"
fieldset "2.1 - Maximum diameter of the Aneurysm - score: 1" "(2.1) Please select:" "4.0-6.9 mm"
static "v"
hidden "ch_maxdiam1" "=v"
hidden "maxdiam1" "=1"
fieldset "2.1 - Maximum diameter of the Aneurysm - score: 2" "(2.1) Please select:" "7.0-12.9 mm"
static "v"
hidden "ch_maxdiam2" "=v"
hidden "maxdiam2" "=2"
fieldset "2.1 - Maximum diameter of the Aneurysm - score: 3" "(2.1) Please select:" "13.0-24.9 mm"
static "v"
hidden "ch_maxdiam3" "=v"
hidden "maxdiam3" "=3"
fieldset "2.1 - Maximum diameter of the Aneurysm - score: 4" "(2.1) Please select:" "≥ 25 mm"
static "v"
hidden "ch_maxdiam4" "=v"
hidden "maxdiam4" "=4"
fieldset "2.2 - Aneurysm Morphology"
yesno "Irregularity or lobulation" "=<wrap hide>3</wrap>v"
yesno "Size ration › 3 or aspect ration › 1.6" "=<wrap hide>1</wrap>v"
fieldset "2.3 - Location of the aneurysm"
select "(2.3) Please select:" "|BasA bifurcation|Vertrebral/basilar artery|AcomA or PcomA"
fieldset "2.3 - Location of the aneurysm - control" "(2.3) Please select:" ""
static "x"
fieldset "2.3 - Location of the aneurysm - score: 5" "(2.3) Please select:" "BasA bifurcation"
static "v"
hidden "ch_ln5" "=v"
hidden "ln5" "=5"
fieldset "2.3 - Location of the aneurysm - score: 4" "(2.3) Please select:" "Vertrebral/basilar artery"
static "v"
hidden "ch_ln4" "=v"
hidden "ln4" "=4"
fieldset "2.3 - Location of the aneurysm - score: 2" "(2.3) Please select:" "AcomA or PcomA"
static "v"
hidden "ch_ln2" "=v"
hidden "ln2" "=2"
fieldset "2.4 - Other (multiple, please select all that apply)"
yesno "Aneurysm growth on serial imaging" "=<wrap hide>4</wrap>v"
yesno "Aneurysm de novo formation on serial imaging" "=<wrap hide>3</wrap>v"
yesno "Contralateral stenoocclusive vessel disease" "=<wrap hide>1</wrap>v"
fieldset "3"
wiki "<wrap em>**T R E A T M E N T**</wrap>"
fieldset "3.1 - Age-related risk"
select "(3.1) Please select:" "|‹ 40 years|41-60 years|61-70 years|71-80 years|› 80 years"
fieldset "3.1 - Age-related risk - control" "(3.1) Please select:" ""
static "x"
fieldset "3.1 - Age-related risk - score: 0" "(3.1) Please select:" "‹ 40 years"
static "v"
hidden "ch_agerr0" "=v"
hidden "agerr0" "=0"
fieldset "3.1 - Age-related risk - score: 1" "(3.1) Please select:" "41-60 years"
static "v"
hidden "ch_agerr1" "=v"
hidden "agerr1" "=1"
fieldset "3.1 - Age-related risk - score: 3" "(3.1) Please select:" "61-70 years"
static "v"
hidden "ch_agerr3" "=v"
hidden "agerr3" "=3"
fieldset "3.1 - Age-related risk - score: 4" "(3.1) Please select:" "71-80 years"
static "v"
hidden "ch_agerr4" "=v"
hidden "agerr4" "=4"
fieldset "3.1 - Age-related risk - score: 5" "(3.1) Please select:" "› 80 years"
static "v"
hidden "ch_agerr5" "=v"
hidden "agerr5" "=5"
fieldset "3.2 - Aneurysm size-related risk"
select "(3.2) Please select:" "|‹ 6.0 mm|6.0-10.0 mm|10.1-20.0 mm|› 20 mm"
fieldset "3.2 - Aneurysm size-related risk - control" "(3.2) Please select:" ""
static "x"
fieldset "3.2 - Aneurysm size-related risk - score: 0" "(3.2) Please select:" "‹ 6.0 mm"
static "v"
hidden "ch_asrr0" "=v"
hidden "asrr0" "=0"
fieldset "3.2 - Aneurysm size-related risk - score: 1" "(3.2) Please select:" "6.0-10.0 mm"
static "v"
hidden "ch_asrr1" "=v"
hidden "asrr1" "=1"
fieldset "3.2 - Aneurysm size-related risk - score: 3" "(3.2) Please select:" "10.1-20.0 mm"
static "v"
hidden "ch_asrr3" "=v"
hidden "asrr3" "=3"
fieldset "3.2 - Aneurysm size-related risk - score: 5" "(3.2) Please select:" "› 20 mm"
static "v"
hidden "ch_asrr5" "=v"
hidden "asrr5" "=5"
fieldset "3.3 - Aneurysm complexity-related risk"
select "(3.3) Please select:" "|High|Low"
fieldset "3.3 - Aneurysm complexity-related risk - control" "(3.3) Please select:" ""
static "x"
fieldset "3.3 - Aneurysm complexity-related risk - score: 3" "(3.3) Please select:" "High"
static "v"
hidden "ch_acrr3" "=v"
hidden "acrr3" "=3"
fieldset "3.3 - Aneurysm complexity-related risk - score: 0" "(3.3) Please select:" "Low"
static "v"
hidden "ch_acrr0" "=v"
hidden "acrr0" "=0"
fieldset "4 - Submit data"
submit "Submit"
</form>
Выявленные недостатки: если «отправили» форму, а одно из полей с раскрывающимся списком не заполнено, обновляйте страницу (Ctrl+R
или кликом по ссылке в навигации) и приступайте к работе заново.
Движок форума в блоках кода неверно выводит эмоджи: для static
вместо x
и v
должны быть ❌ и ✅ соответственно; для hidden
и yesno
вместо v
должно быть ✔
Шаблонная страница:
Вики-разметка страницы:
~~NOCACHE~~
====== UIATS: @@title@@ ======
|<100% 60% 10% 15% 15%>|
| @darkgrey: **P A T I E N T** ||||
| **Age** (single) || | |
| @@Please select the corresponding age@@ | @@ch_age4|@@@@ch_age3|@@@@ch_age2|@@@@ch_age1|@@@@ch_age0|@@ | @#CCCCFF: **@@age4|@@@@age3|@@@@age2|@@@@age1|@@@@age0|@@** | |
^ ||||
| **Risk factor incidence** (multiple) || | |
| Previous SAH from a different aneurysm | @@Previous SAH from a different aneurysm|@@ | | |
| Familial intracranial aneurysms or SAH | @@Familial intracranial aneurysms or SAH|@@ | | |
| Japanese, Finnish, Inuit ethnicity | @@Japanese, Finnish, Inuit ethnicity|@@ | | |
| Current cigarette smoking | @@Current cigarette smoking|@@ | | |
| Hypertension (systolic BP › 140 mmHg)| @@Hypertension (systolic BP › 140 mmHg)|@@ | | |
| Autosomal-polycystic kidney disease | @@Autosomal-polycystic kidney disease|@@ | | |
| Current drug abuse (cocain, amphetamine)| @@Current drug abuse (cocain, amphetamine)|@@ | | |
| Current alcohol abuse | @@Current alcohol abuse|@@ | @#CCCCFF: ** ~~=sum(r5c1:r12c1)~~ ** | |
^ ||||
| **Clinical symptoms related to UAI** (multiple) || | |
| Cranial nerve deficit | @@Cranial nerve deficit|@@ | | |
| Clinical or radiological mass effect | @@Clinical or radiological mass effect|@@ | | |
| Thromboembolic events from the aneurysm | @@Thromboembolic events from the aneurysm|@@ | | |
| Epilepsy | @@Epilepsy|@@ | @#CCCCFF: ** ~~=sum(r15c1:r18c1)~~ ** | |
^ ||||
| **Other** (multiple) || | |
| Reduced quality of life due to fear of rupture | @@Reduced quality of life due to fear of rupture|@@ | | |
| Aneurysm multiplicity | @@Aneurysm multiplicity|@@ | @#CCCCFF: ** ~~=sum(r21c1,r22c1)~~ ** | |
^ ||||
| **Life expectancy due to chronic and/or malignant diseases** (single) || | |
| @@(1.5) Please select:@@ | @@ch_lifeexp4|@@@@ch_lifeexp3|@@@@ch_lifeexp1|@@ | | @#9999CC: **@@lifeexp4|@@@@lifeexp3|@@@@lifeexp1|@@** |
^ ||||
| **Comorbid diseases** (multiple) || | |
| Neurocognitive disorder | @@Neurocognitive disorder|@@ | | |
| Coagulopathies, thrombophilic diseases | @@Coagulopathies, thrombophilic diseases|@@ | | |
| Psychiatric disorder | @@Psychiatric disorder|@@ | | @#9999CC: ** ~~=sum(r28c1:r30c1)~~ ** |
^ ||||
| @darkgrey: **A N E U R Y S M** ||||
| **Maximum diameter** (single) || | |
| @@(2.1) Please select:@@ | @@ch_maxdiam0|@@@@ch_maxdiam1|@@@@ch_maxdiam2|@@@@ch_maxdiam3|@@@@ch_maxdiam4|@@ | @#CCCCFF: **@@maxdiam0|@@@@maxdiam1|@@@@maxdiam2|@@@@maxdiam3|@@@@maxdiam4|@@** | |
^ ||||
| **Morphology** (multiple) || | |
| Irregularity or lobulation | @@Irregularity or lobulation|@@ | | |
| Size ration › 3 or aspect ration › 1.6 | @@Size ration › 3 or aspect ration › 1.6|@@ | @#CCCCFF: ** ~~=sum(r37c1,r38c1)~~ ** | |
^ ||||
| **Location** (single) || | |
| @@(2.3) Please select:@@ | @@ch_ln5|@@@@ch_ln4|@@@@ch_ln2|@@ | @#CCCCFF: **@@ln5|@@@@ln4|@@@@ln2|@@** | |
^ ||||
| **Other** (multiple) || | |
| Aneurysm growth on serial imaging | @@Aneurysm growth on serial imaging|@@ | | |
| Aneurysm de novo formation on serial imaging | @@Aneurysm de novo formation on serial imaging|@@ | | |
| Contralateral stenoocclusive vessel disease | @@Contralateral stenoocclusive vessel disease|@@ | @#CCCCFF: ** ~~=sum(r44c1:r46c1)~~ ** | |
^ ||||
| @darkgrey: **T R E A T M E N T** ||||
| **Age-related risk** (single) || | |
| @@(3.1) Please select:@@ | @@ch_agerr0|@@@@ch_agerr1|@@@@ch_agerr3|@@@@ch_agerr4|@@@@ch_agerr5|@@ | | @#9999CC: **@@agerr0|@@@@agerr1|@@@@agerr3|@@@@agerr4|@@@@agerr5|@@** |
^ ||||
| **Aneurysm size-related risk** (single) || | |
| @@(3.2) Please select:@@ | @@ch_asrr0|@@@@ch_asrr1|@@@@ch_asrr3|@@@@ch_asrr5|@@ | | @#9999CC: **@@asrr0|@@@@asrr1|@@@@asrr3|@@@@asrr5|@@** |
^ ||||
| **Aneurysm complexity-related risk** (single) || | |
| @@(3.3) Please select:@@ | @@ch_acrr3|@@@@ch_acrr0|@@ | | @#9999CC: **@@acrr3|@@@@acrr0|@@** |
^ ||||
| **Intervention-related risk** | | | @#9999CC: **5** |
^ ||||
| **Favors UIA repair:** || @#CCCCFF: ** ~~=sum(r2c2,r12c2,r18c2,r22c2,r34c2,r38c2,r41c2,r46c2)~~ ** | |
| **Favors of UIA conservative management:** ||| @#9999CC: ** ~~=sum(r25c3,r30c3,r50c3,r53c3,r56c3,r58c3)~~ ** |
Использование макроса ~~NOCACHE~~
необходимо для более корректной работы TableCalc. Если предполагается, что его формулы ничего не вычислили, нужно перезагрузить страницу (F5
, для надёжности — Ctrl+R
).
Скриншот части pdf-страницы, выводимой dw2pdf Plugin:
Скриншот части pdf-страницы, выводимой дополнением Print to PDF для Firefox:
Вариант с использованием pot Plugin.