SlideShare a Scribd company logo
Automation of
Electronic Medical Record(EMR) Tasks
using AutoHotkey in MS Windows
2023-05-11
Seoul National University Hospital
Department of Family Medicine
Min-Hyung Kim
Automation of EMR tasks using AutoHotkey
CONTENTS
• Motivation
• User Interface (UI) & User Experience (UX)
• 3 click rule & user navigation model
• Workflow process optimization
• Using Google Sheet in the workflow @ SNUH FM?
• AutoHotkey
• Window Spy (AutoHotkey Script itself!)
• Move to (x-axis, y-axis) & Click
• Send Ctrl+c, Ctrl+v
• Send Unicode Left Arrow ← (U+2190)
• Run Notepad.exe
• Define a hotkey @ AutoHotkey
• Define a function @ AutoHotkey
• Regular Expression @ AutoHotkey
• (Review) Tutorials for Regular Expression (정규표현식)
User Interface (UI) & User Experience (UX)
3 click rule & user navigation model
Workflow process optimization
Gittler, Halawa et al. (2019)
Using Google Sheet in the workflow @ SNUH FM?
Ideal
1. One-click, DONE!
Reality
1. Open Google Sheet
2. Copy (Ctrl+c) texts from EMR
3. Paste (Ctrl+v) texts into "Input Table"
4. Run calculation in Google Sheet
5. Move to "Output Table"
6. Copy (Ctrl+c) from "Output Table"
7. Paste (Ctrl+v) texts into EMR
Workforce?
Ideal Reality
AutoHotkey
20230511 Automation of EMR Tasks using AutoHotkey in MS Windows_MKv1.1.pdf
Window Spy (AutoHotkey Script itself!)
AutoHotkey
Move to (x-axis, y-axis) & Click
20230511 Automation of EMR Tasks using AutoHotkey in MS Windows_MKv1.1.pdf
20230511 Automation of EMR Tasks using AutoHotkey in MS Windows_MKv1.1.pdf
20230511 Automation of EMR Tasks using AutoHotkey in MS Windows_MKv1.1.pdf
mouseclick, left, %x%, %y%
!d:: ; Hotkey Alt+d
mouseclick, left, 930, 65, 1, 0
Sleep 800
mouseclick, left, 1010, 400, 1, 0
Sleep 800
mouseclick, left, 960, 920, 1, 0
Sleep 800
mouseclick, left, 970, 570, 1, 0
Sleep 800
mouseclick, left, 5, 257, 1, 0
Sleep 1000
mouseclick, left, 1630, 140, 1, 0
return
https://github.com/mkim0710/autohotkey/blob/main/BESTCare%202.0%20AutoClick%20Alt%2Bd%20clean%20(SNUBH)%20230107.ahk
Send Ctrl+c
Send Ctrl+v
Send ^c
Send ^v
Run Notepad.exe
Send Unicode Left Arrow ← (U+2190)
Send chr("0x2192")
Send " " . chr("0x2192") . " "
Define a hotkey @ AutoHotkey
!d:: ; Hotkey Alt+d
mouseclick, left, 930, 65, 1, 0
Sleep 800
mouseclick, left, 1010, 400, 1, 0
Sleep 800
mouseclick, left, 960, 920, 1, 0
Sleep 800
mouseclick, left, 970, 570, 1, 0
Sleep 800
mouseclick, left, 5, 257, 1, 0
Sleep 1000
mouseclick, left, 1630, 140, 1, 0
return
Define a function @ AutoHotkey
function_LeftArrowUnicode(InputText)
{
Return regexreplace(InputText, "<-",
chr("0x2190") )
}
EMR lab data @ SNUH EMR
Input
T4(free)(진검시행) 0.90 1.03
TSH(진검시행) 3.41 3.84
Calcium 9.2 8.9
Phosphorus 3.5 2.9
Glucose 95 102
Uric acid 3.3 3.0
Chol. 171 198
T. Protein 7.2 7.2
Albumin 4.5 4.4
T. Bil. 1.0 1.0
Alk. phos. 46 49
AST(GOT) 24 33
ALT(GPT) 29 47
GGT 32 37
BUN 10 13
Creatinine 0.77 0.73
eGFR(MDRD) 104.9 111.6
eGFR(CKD EPI Cr) 102.2 104.4
TG 270 179
HDL Chol. 36 44
LDL Chol. 87 113
LDL Chol.(계산식) 81 118
hs-CRP 0.03 0.06
WBC 4.71 5.27
Hb 15.3 16.2
Hct 45.5 47.0
MCV 95.0 95.7
Platelet 164 157
ESR 2 5
ANC 2421 2466
Hb A1c 5.2 5.3
Regular Expression @ AutoHotkey
functionEMR_TSV_AddLeftArrowUnicode(EMR_TSV)
{
Return regexreplace(EMR_TSV, "(.*)t([0-9]+(?:.[0-
9]*)?).*t([0-9]+(?:.[0-9]*)?).*", "$1`t`t$2`t" " "
chr("0x" . "2190") " " "$3") . "`r`n"
}
^#!Numpad4:: ; Ctrl+Win+Alt+Numpad4 ; Add
←(U+2190) between the numbers
Send ^c
Sleep 100
ClipWait 2 ; Waits until the
clipboard contains data, up to 2s
ClipBoard2Text = %ClipBoard% ; Store
%ClipBoard% to ClipBoard2Text - Automatically converted
to text without any format?!
Sleep 100
ClipWait 2 ; Waits until the
clipboard contains data, up to 2s
functionCopy2Clipboard2Txt(functionEMR_TSV_AddLeftArr
owUnicode(ClipBoard2Text))
VarSetCapacity(ClipBoard2Text, 0) ; Free memory
Return
https://github.com/mkim0710/autohotkey/blob/main/Ctrl%2BWin%2BAlt%2Bc%2C%20Ctrl%2BWin%2Bl%20(LeftArrow)%20SNUBH%20230118.ahk
EMR lab data @ SNUH EMR
Input
T4(free)(진검시행) 0.90 1.03
TSH(진검시행) 3.41 3.84
Calcium 9.2 8.9
Phosphorus 3.5 2.9
Glucose 95 102
Uric acid 3.3 3.0
Chol. 171 198
T. Protein 7.2 7.2
Albumin 4.5 4.4
T. Bil. 1.0 1.0
Alk. phos. 46 49
AST(GOT) 24 33
ALT(GPT) 29 47
GGT 32 37
BUN 10 13
Creatinine 0.77 0.73
eGFR(MDRD) 104.9 111.6
eGFR(CKD EPI Cr) 102.2 104.4
TG 270 179
HDL Chol. 36 44
LDL Chol. 87 113
LDL Chol.(계산식) 81 118
hs-CRP 0.03 0.06
WBC 4.71 5.27
Hb 15.3 16.2
Hct 45.5 47.0
MCV 95.0 95.7
Platelet 164 157
ESR 2 5
ANC 2421 2466
Hb A1c 5.2 5.3
Output
T4(free)(진검시행) 0.90 ← 1.03
TSH(진검시행) 3.41 ← 3.84
Calcium 9.2 ← 8.9
Phosphorus 3.5 ← 2.9
Glucose 95 ← 102
Uric acid 3.3 ← 3.0
Chol. 171 ← 198
T. Protein 7.2 ← 7.2
Albumin 4.5 ← 4.4
T. Bil. 1.0 ← 1.0
Alk. phos. 46 ← 49
AST(GOT) 24 ← 33
ALT(GPT) 29 ← 47
GGT 32 ← 37
BUN 10 ← 13
Creatinine 0.77 ← 0.73
eGFR(MDRD) 104.9 ← 111.6
eGFR(CKD EPI Cr) 102.2 ← 104.4
TG 270 ← 179
HDL Chol. 36 ← 44
LDL Chol. 87 ← 113
LDL Chol.(계산식) 81 ← 118
hs-CRP 0.03 ← 0.06
WBC 4.71 ← 5.27
Hb 15.3 ← 16.2
Hct 45.5 ← 47.0
MCV 95.0 ← 95.7
Platelet 164 ← 157
ESR 2 ← 5
ANC 2421 ← 2466
Hb A1c 5.2 ← 5.3
Regular Expression @ AutoHotkey
functionFilterLines(TextInput, RegEx2Filter)
{
TextOutput := regexreplace(TextInput, "(.*" . RegEx2Filter .
".*)|(.)", "$1")
TextOutput := TextOutput . "`r`n"
TextOutput := regexreplace(TextOutput, "(r?n)+", "`r`n")
TextOutput := regexreplace(TextOutput, "^(r?n)+", "")
return TextOutput
}
functionTSV_ExtractColumn3(Input_TSV)
{
TextOutput := regexreplace(Input_TSV,
"([^nrt]*)t([^nrt]*)(?:t([^nrt]*))?", "$3") . "`r`n"
Return TextOutput
}
functionTSV_ExtractColumn4(Input_TSV)
{
TextOutput := regexreplace(Input_TSV,
"([^nrt]*)t([^nrt]*)t([^nrt]*)(?:t([^nrt]*))?",
"$4") . "`r`n"
Return TextOutput
}
https://github.com/mkim0710/autohotkey/blob/main/Ctrl%2BWin%2BAlt%2Bc%2C%20Ctrl%2BWin%2Bl%20(LeftArrow)%20SNUBH%20230118.ahk
Regular Expression @ AutoHotkey
functionProcessText_EMR_TSV4_lipid(Input_TSV)
{
TextOutput3 := ""
TextOutput4 := ""
SimpleArray01 := ["`tChol.`t", "TG", "HDL", "LDL Chol.`t"]
for index, value in SimpleArray01
{
var4search := value
TextOutput3 := TextOutput3 .
functionTSV_ExtractColumn3(functionFilterLines(Input_TSV, var4search)) . "/"
TextOutput3 := functionRemoveCarriageReturn(TextOutput3)
TextOutput4 := TextOutput4 .
functionTSV_ExtractColumn4(functionFilterLines(Input_TSV, var4search)) . "/"
TextOutput4 := functionRemoveCarriageReturn(TextOutput4)
}
TextOutput3 := regexreplace(TextOutput3, "/$", "")
TextOutput4 := regexreplace(TextOutput4, "/$", "")
TextOutput := TextOutput3 . " " . chr("0x" . "2190") . " " . TextOutput4
Return TextOutput
}
^#l:: ; Ctrl+Win+l
Send ^c
Sleep 100
ClipWait 2
ClipBoard2Text = %ClipBoard%
Sleep 100
ClipWait 2
functionCopy2Clipboard2Txt(functionProcessText_lab(ClipBoard2Text))
ClipWait 2
VarSetCapacity(ClipBoard2Text, 0) ; Free memory
Return
https://github.com/mkim0710/autohotkey/blob/main/Ctrl%2BWin%2BAlt%2Bc%2C%20Ctrl%2BWin%2Bl%20(LeftArrow)%20SNUBH%20230118.ahk
EMR lab data @ SNUH EMR
Input
T4(free)(진검시행) 0.90 1.03
TSH(진검시행) 3.41 3.84
Calcium 9.2 8.9
Phosphorus 3.5 2.9
Glucose 95 102
Uric acid 3.3 3.0
Chol. 171 198
T. Protein 7.2 7.2
Albumin 4.5 4.4
T. Bil. 1.0 1.0
Alk. phos. 46 49
AST(GOT) 24 33
ALT(GPT) 29 47
GGT 32 37
BUN 10 13
Creatinine 0.77 0.73
eGFR(MDRD) 104.9 111.6
eGFR(CKD EPI Cr) 102.2 104.4
TG 270 179
HDL Chol. 36 44
LDL Chol. 87 113
LDL Chol.(계산식) 81 118
hs-CRP 0.03 0.06
WBC 4.71 5.27
Hb 15.3 16.2
Hct 45.5 47.0
MCV 95.0 95.7
Platelet 164 157
ESR 2 5
ANC 2421 2466
Hb A1c 5.2 5.3
Output
TChol/TG/HDL/LDL : 171/270/36/87 ← 198/179/44/113
Review
Tutorials for Regular Expression
(정규표현식)
Regular Expressions
@ Google Sheets
https://support.google.com/a/answer/1371415?hl=en
Input Regular Expression Output
1 Abc1234 .?(){} [A-Za-z] A
b
c
2 Abc1234 .?(){} [A-Za-z]{2} Ab
3 Abc1234 .?(){} [0-9]{2} 12
34
4 Abc1234 .?(){} [0-9]+ 1234
5 Abc1234 .?(){} .{6} Abc123
4 .?(
6 Abc1234 .?(){} . .
7 Abc1234 .?(){} [A-Za-z][0-9]|[0-9]{2} c1
23
8 Abc1234 .?(){} [A-Za-z]?[0-9]{2} c12
34
9 Abc1234 .?(){} [^0-9]* Abc
.?(){}
Regular Expressions
@ Google Sheets
Input Regular Expression Output
1 2022-06-03 [0-9]+ 2022
06
03
2 2022-06-03 -[0-9]{2} -06
-03
3 2022-06-03 [0-9]{4}-[0-9]{2}-
[0-9]{2}
2022-06-03
4 175
67.5
[0-9]+ 175
67
5
5 175
67.5
[0-9]+.[0-9]* 67.5
6 175
67.5
[0-9]+.?[0-9]* 175
67.5
https://support.google.com/a/answer/1371415?hl=en
tbl_input @ Google Sheets
Example input table @ SNUHFM HPDP
A B C D E
호흡기계 단순 흉부 촬영 (Chest X-Ray) Chest X-Ray 2022-06-03No significant interval change
since last study.
신체 측정 복부 지방 CT (Abdominal FAT CT) Abdominal FAT CT 2022-06-03Fat amount ratio
= Visceral fat/Subcutaneous fat
= 7051.11/7723.56
= 0.91
근골격계 골밀도 검사 (Dexa Bone Densitometry) Bone Densitometry <T - score>
Spine L1 - L4 : - 0.6
Femur neck : - 2.2
Femur total : - 2.6
Osteoporosis
https://tinyurl.com/SNUHFMRegEx
2022-06-03Fat amount ratio
= Visceral fat/Subcutaneous fat
= 7051.11/7723.56
= 0.91
=regexextract(
query(tbl_input!$A:$E, "select E where C
contains 'Abdominal FAT CT'")
, "[0-9]{4}-[0-9]{2}-[0-9]{2}" )
2022-06-03
=query(tbl_input!$A:$E, "select E where C contains
'Abdominal FAT CT'")
Regular Expression @ Google Sheets
Extract dates
[0-9]{4}-[0-9]{2}-[0-9]{2}
2022-06-03Fat amount ratio
= Visceral fat/Subcutaneous fat
= 7051.11/7723.56
= 0.91
=regexreplace(
regexextract(
query(tbl_input!$A:$E, "select E where C
contains 'Abdominal FAT CT'")
, "[0-9]{4}-[0-9]{2}-[0-9]{2}" )
,"-" ,"." )
2022.06.08
=query(tbl_input!$A:$E, "select E where C contains
'Abdominal FAT CT'")
Regular Expression @ Google Sheets
Extract dates
[0-9]{4}-[0-9]{2}-[0-9]{2}
2022-06-03Fat amount ratio
= Visceral fat/Subcutaneous fat
= 7051.11/7723.56
= 0.91
=regexextract(
query(tbl_input!$A:$E, "select E where C
contains 'Abdominal FAT CT'")
, "= *[0-9]+.?[0-9]*/" )
= 7051.11/
=query(tbl_input!$A:$E, "select E where C contains
'Abdominal FAT CT'")
Regular Expression @ Google Sheets
Extract visceral adipose tissue (VAT)
= *[0-9]+.?[0-9]*/
2022-06-03Fat amount ratio
= Visceral fat/Subcutaneous fat
= 7051.11/7723.56
= 0.91
=regexreplace(
regexreplace(
regexextract(
query(tbl_input!$A:$E, "select E where
C contains 'Abdominal FAT CT'")
, "= *[0-9]+.?[0-9]*/" )
,"= *" ,"" )
,"/" ,"" )
7051.11
=query(tbl_input!$A:$E, "select E where C contains
'Abdominal FAT CT'")
Regular Expression @ Google Sheets
Extract visceral adipose tissue (VAT)
= *[0-9]+.?[0-9]*/
2022-06-03Fat amount ratio
= Visceral fat/Subcutaneous fat
= 7051.11/7723.56
= 0.91
=round(value(
regexreplace(
regexreplace(
regexextract(
query(tbl_input!$A:$E, "select E where
C contains 'Abdominal FAT CT'")
, "= *[0-9]+.?[0-9]*/" )
,"= *" ,"" )
,"/" ,"" )
)) / 100 &" cm²"
70.51 cm²
=query(tbl_input!$A:$E, "select E where C contains
'Abdominal FAT CT'")
Regular Expression @ Google Sheets
Extract visceral adipose tissue (VAT)
= *[0-9]+.?[0-9]*/
<T - score>
Spine L1 - L4 : - 0.6
Femur neck : - 2.2
Femur total : - 2.6
Osteoporosis
=regexextract(query(tbl_input!$A:$E, "select E
where C contains 'Bone
Densitometry'"),"[Oo]steop[a-z]+")
Osteoporosis
=query(tbl_input!$A:$E, "select E where C contains
'Bone Densitometry'")
Regular Expression @ Google Sheets
Extract Dual Energy X-ray Absorptiometry (DEXA) results
[Oo]steop[a-z]+
<T - score>
Spine L1 - L4 : - 0.6
Femur neck : - 2.2
Femur total : - 2.6
Osteoporosis
=regexextract(query(tbl_input!$A:$E, "select E where C
contains 'Bone Densitometry'"),"[Oo]steop[a-z]+")
&"("&regexextract(query(tbl_input!$A:$E, "select E where C
contains 'Bone Densitometry'"),"[Ll][1-4] *- *[Ll][1-4]
*: *- [0-9]+.?[0-9]*")
&", "&regexextract(query(tbl_input!$A:$E, "select E where
C contains 'Bone Densitometry'"),"[Ff]emur [Nn]eck *: *-
[0-9]+.?[0-9]*")
&", "&regexextract(query(tbl_input!$A:$E, "select E where
C contains 'Bone Densitometry'"),"[Ff]emur [Tt]otal *:
*- [0-9]+.?[0-9]*")&")"
Osteoporosis(L1 - L4 : - 0.6, Femur neck :
- 2.2, Femur total : - 2.6)
=query(tbl_input!$A:$E, "select E where C contains
'Bone Densitometry'")
Regular Expression @ Google Sheets
Extract Dual Energy X-ray Absorptiometry (DEXA) results
[Oo]steop[a-z]+

More Related Content

PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
PPTX
20221001 KAFM 의학 형의상학(Medical Ontology) v5 -clean.pptx
PDF
MH prediction modeling and validation in r (2) classification 190709
PDF
MH prediction modeling and validation in r (1) regression 190709
PDF
MH Prediction Modeling and Validation -clean
PDF
r for data science 2. grammar of graphics (ggplot2) clean -ref
PDF
r for data science 4. exploratory data analysis clean -rev -ref
PDF
CDM SynPuf OMOP CDM library(rodbc) library(ggplot2) library(jsonlite) 180403
2024 Trend Updates: What Really Works In SEO & Content Marketing
20221001 KAFM 의학 형의상학(Medical Ontology) v5 -clean.pptx
MH prediction modeling and validation in r (2) classification 190709
MH prediction modeling and validation in r (1) regression 190709
MH Prediction Modeling and Validation -clean
r for data science 2. grammar of graphics (ggplot2) clean -ref
r for data science 4. exploratory data analysis clean -rev -ref
CDM SynPuf OMOP CDM library(rodbc) library(ggplot2) library(jsonlite) 180403

Recently uploaded (20)

PPTX
Pulmonary Circulation PPT final for easy
PDF
Dermatology diseases Index August 2025.pdf
PDF
Dr. Jasvant Modi - Passionate About Philanthropy
PPTX
Bronchial_Asthma_in_acute_exacerbation_.pptx
PPTX
Nursing Care Aspects for High Risk newborn.pptx
PPT
KULIAH UG WANITA Prof Endang 121110 (1).ppt
PPTX
Immunity....(shweta).................pptx
PPTX
Rheumatic heart diseases with Type 2 Diabetes Mellitus
PPTX
BLS, BCLS Module-A life saving procedure
PPTX
NUTRITIONAL PROBLEMS, CHANGES NEEDED TO PREVENT MALNUTRITION
PDF
2E-Learning-Together...PICS-PCISF con.pdf
PDF
DAY-6. Summer class. Ppt. Cultural Nursing
PPTX
Basics of pharmacology (Pharmacology I).pptx
PDF
Megan Miller Colona Illinois - Passionate About CrossFit
PPTX
CBT FOR OCD TREATMENT WITHOUT MEDICATION
PPTX
ABG advance Arterial Blood Gases Analysis
PPT
Parental-Carer-mental-illness-and-Potential-impact-on-Dependant-Children.ppt
PDF
MINERAL & VITAMIN CHARTS fggfdtujhfd.pdf
PPTX
Vaginal Bleeding and Uterine Fibroids p
PPTX
Current Treatment Of Heart Failure By Dr Masood Ahmed
Pulmonary Circulation PPT final for easy
Dermatology diseases Index August 2025.pdf
Dr. Jasvant Modi - Passionate About Philanthropy
Bronchial_Asthma_in_acute_exacerbation_.pptx
Nursing Care Aspects for High Risk newborn.pptx
KULIAH UG WANITA Prof Endang 121110 (1).ppt
Immunity....(shweta).................pptx
Rheumatic heart diseases with Type 2 Diabetes Mellitus
BLS, BCLS Module-A life saving procedure
NUTRITIONAL PROBLEMS, CHANGES NEEDED TO PREVENT MALNUTRITION
2E-Learning-Together...PICS-PCISF con.pdf
DAY-6. Summer class. Ppt. Cultural Nursing
Basics of pharmacology (Pharmacology I).pptx
Megan Miller Colona Illinois - Passionate About CrossFit
CBT FOR OCD TREATMENT WITHOUT MEDICATION
ABG advance Arterial Blood Gases Analysis
Parental-Carer-mental-illness-and-Potential-impact-on-Dependant-Children.ppt
MINERAL & VITAMIN CHARTS fggfdtujhfd.pdf
Vaginal Bleeding and Uterine Fibroids p
Current Treatment Of Heart Failure By Dr Masood Ahmed
Ad
Ad

20230511 Automation of EMR Tasks using AutoHotkey in MS Windows_MKv1.1.pdf

  • 1. Automation of Electronic Medical Record(EMR) Tasks using AutoHotkey in MS Windows 2023-05-11 Seoul National University Hospital Department of Family Medicine Min-Hyung Kim
  • 2. Automation of EMR tasks using AutoHotkey CONTENTS • Motivation • User Interface (UI) & User Experience (UX) • 3 click rule & user navigation model • Workflow process optimization • Using Google Sheet in the workflow @ SNUH FM? • AutoHotkey • Window Spy (AutoHotkey Script itself!) • Move to (x-axis, y-axis) & Click • Send Ctrl+c, Ctrl+v • Send Unicode Left Arrow ← (U+2190) • Run Notepad.exe • Define a hotkey @ AutoHotkey • Define a function @ AutoHotkey • Regular Expression @ AutoHotkey • (Review) Tutorials for Regular Expression (정규표현식)
  • 3. User Interface (UI) & User Experience (UX)
  • 4. 3 click rule & user navigation model
  • 6. Using Google Sheet in the workflow @ SNUH FM? Ideal 1. One-click, DONE! Reality 1. Open Google Sheet 2. Copy (Ctrl+c) texts from EMR 3. Paste (Ctrl+v) texts into "Input Table" 4. Run calculation in Google Sheet 5. Move to "Output Table" 6. Copy (Ctrl+c) from "Output Table" 7. Paste (Ctrl+v) texts into EMR
  • 10. Window Spy (AutoHotkey Script itself!)
  • 11. AutoHotkey Move to (x-axis, y-axis) & Click
  • 15. mouseclick, left, %x%, %y% !d:: ; Hotkey Alt+d mouseclick, left, 930, 65, 1, 0 Sleep 800 mouseclick, left, 1010, 400, 1, 0 Sleep 800 mouseclick, left, 960, 920, 1, 0 Sleep 800 mouseclick, left, 970, 570, 1, 0 Sleep 800 mouseclick, left, 5, 257, 1, 0 Sleep 1000 mouseclick, left, 1630, 140, 1, 0 return https://github.com/mkim0710/autohotkey/blob/main/BESTCare%202.0%20AutoClick%20Alt%2Bd%20clean%20(SNUBH)%20230107.ahk
  • 18. Send Unicode Left Arrow ← (U+2190) Send chr("0x2192") Send " " . chr("0x2192") . " "
  • 19. Define a hotkey @ AutoHotkey !d:: ; Hotkey Alt+d mouseclick, left, 930, 65, 1, 0 Sleep 800 mouseclick, left, 1010, 400, 1, 0 Sleep 800 mouseclick, left, 960, 920, 1, 0 Sleep 800 mouseclick, left, 970, 570, 1, 0 Sleep 800 mouseclick, left, 5, 257, 1, 0 Sleep 1000 mouseclick, left, 1630, 140, 1, 0 return
  • 20. Define a function @ AutoHotkey function_LeftArrowUnicode(InputText) { Return regexreplace(InputText, "<-", chr("0x2190") ) }
  • 21. EMR lab data @ SNUH EMR Input T4(free)(진검시행) 0.90 1.03 TSH(진검시행) 3.41 3.84 Calcium 9.2 8.9 Phosphorus 3.5 2.9 Glucose 95 102 Uric acid 3.3 3.0 Chol. 171 198 T. Protein 7.2 7.2 Albumin 4.5 4.4 T. Bil. 1.0 1.0 Alk. phos. 46 49 AST(GOT) 24 33 ALT(GPT) 29 47 GGT 32 37 BUN 10 13 Creatinine 0.77 0.73 eGFR(MDRD) 104.9 111.6 eGFR(CKD EPI Cr) 102.2 104.4 TG 270 179 HDL Chol. 36 44 LDL Chol. 87 113 LDL Chol.(계산식) 81 118 hs-CRP 0.03 0.06 WBC 4.71 5.27 Hb 15.3 16.2 Hct 45.5 47.0 MCV 95.0 95.7 Platelet 164 157 ESR 2 5 ANC 2421 2466 Hb A1c 5.2 5.3
  • 22. Regular Expression @ AutoHotkey functionEMR_TSV_AddLeftArrowUnicode(EMR_TSV) { Return regexreplace(EMR_TSV, "(.*)t([0-9]+(?:.[0- 9]*)?).*t([0-9]+(?:.[0-9]*)?).*", "$1`t`t$2`t" " " chr("0x" . "2190") " " "$3") . "`r`n" } ^#!Numpad4:: ; Ctrl+Win+Alt+Numpad4 ; Add ←(U+2190) between the numbers Send ^c Sleep 100 ClipWait 2 ; Waits until the clipboard contains data, up to 2s ClipBoard2Text = %ClipBoard% ; Store %ClipBoard% to ClipBoard2Text - Automatically converted to text without any format?! Sleep 100 ClipWait 2 ; Waits until the clipboard contains data, up to 2s functionCopy2Clipboard2Txt(functionEMR_TSV_AddLeftArr owUnicode(ClipBoard2Text)) VarSetCapacity(ClipBoard2Text, 0) ; Free memory Return https://github.com/mkim0710/autohotkey/blob/main/Ctrl%2BWin%2BAlt%2Bc%2C%20Ctrl%2BWin%2Bl%20(LeftArrow)%20SNUBH%20230118.ahk
  • 23. EMR lab data @ SNUH EMR Input T4(free)(진검시행) 0.90 1.03 TSH(진검시행) 3.41 3.84 Calcium 9.2 8.9 Phosphorus 3.5 2.9 Glucose 95 102 Uric acid 3.3 3.0 Chol. 171 198 T. Protein 7.2 7.2 Albumin 4.5 4.4 T. Bil. 1.0 1.0 Alk. phos. 46 49 AST(GOT) 24 33 ALT(GPT) 29 47 GGT 32 37 BUN 10 13 Creatinine 0.77 0.73 eGFR(MDRD) 104.9 111.6 eGFR(CKD EPI Cr) 102.2 104.4 TG 270 179 HDL Chol. 36 44 LDL Chol. 87 113 LDL Chol.(계산식) 81 118 hs-CRP 0.03 0.06 WBC 4.71 5.27 Hb 15.3 16.2 Hct 45.5 47.0 MCV 95.0 95.7 Platelet 164 157 ESR 2 5 ANC 2421 2466 Hb A1c 5.2 5.3 Output T4(free)(진검시행) 0.90 ← 1.03 TSH(진검시행) 3.41 ← 3.84 Calcium 9.2 ← 8.9 Phosphorus 3.5 ← 2.9 Glucose 95 ← 102 Uric acid 3.3 ← 3.0 Chol. 171 ← 198 T. Protein 7.2 ← 7.2 Albumin 4.5 ← 4.4 T. Bil. 1.0 ← 1.0 Alk. phos. 46 ← 49 AST(GOT) 24 ← 33 ALT(GPT) 29 ← 47 GGT 32 ← 37 BUN 10 ← 13 Creatinine 0.77 ← 0.73 eGFR(MDRD) 104.9 ← 111.6 eGFR(CKD EPI Cr) 102.2 ← 104.4 TG 270 ← 179 HDL Chol. 36 ← 44 LDL Chol. 87 ← 113 LDL Chol.(계산식) 81 ← 118 hs-CRP 0.03 ← 0.06 WBC 4.71 ← 5.27 Hb 15.3 ← 16.2 Hct 45.5 ← 47.0 MCV 95.0 ← 95.7 Platelet 164 ← 157 ESR 2 ← 5 ANC 2421 ← 2466 Hb A1c 5.2 ← 5.3
  • 24. Regular Expression @ AutoHotkey functionFilterLines(TextInput, RegEx2Filter) { TextOutput := regexreplace(TextInput, "(.*" . RegEx2Filter . ".*)|(.)", "$1") TextOutput := TextOutput . "`r`n" TextOutput := regexreplace(TextOutput, "(r?n)+", "`r`n") TextOutput := regexreplace(TextOutput, "^(r?n)+", "") return TextOutput } functionTSV_ExtractColumn3(Input_TSV) { TextOutput := regexreplace(Input_TSV, "([^nrt]*)t([^nrt]*)(?:t([^nrt]*))?", "$3") . "`r`n" Return TextOutput } functionTSV_ExtractColumn4(Input_TSV) { TextOutput := regexreplace(Input_TSV, "([^nrt]*)t([^nrt]*)t([^nrt]*)(?:t([^nrt]*))?", "$4") . "`r`n" Return TextOutput } https://github.com/mkim0710/autohotkey/blob/main/Ctrl%2BWin%2BAlt%2Bc%2C%20Ctrl%2BWin%2Bl%20(LeftArrow)%20SNUBH%20230118.ahk
  • 25. Regular Expression @ AutoHotkey functionProcessText_EMR_TSV4_lipid(Input_TSV) { TextOutput3 := "" TextOutput4 := "" SimpleArray01 := ["`tChol.`t", "TG", "HDL", "LDL Chol.`t"] for index, value in SimpleArray01 { var4search := value TextOutput3 := TextOutput3 . functionTSV_ExtractColumn3(functionFilterLines(Input_TSV, var4search)) . "/" TextOutput3 := functionRemoveCarriageReturn(TextOutput3) TextOutput4 := TextOutput4 . functionTSV_ExtractColumn4(functionFilterLines(Input_TSV, var4search)) . "/" TextOutput4 := functionRemoveCarriageReturn(TextOutput4) } TextOutput3 := regexreplace(TextOutput3, "/$", "") TextOutput4 := regexreplace(TextOutput4, "/$", "") TextOutput := TextOutput3 . " " . chr("0x" . "2190") . " " . TextOutput4 Return TextOutput } ^#l:: ; Ctrl+Win+l Send ^c Sleep 100 ClipWait 2 ClipBoard2Text = %ClipBoard% Sleep 100 ClipWait 2 functionCopy2Clipboard2Txt(functionProcessText_lab(ClipBoard2Text)) ClipWait 2 VarSetCapacity(ClipBoard2Text, 0) ; Free memory Return https://github.com/mkim0710/autohotkey/blob/main/Ctrl%2BWin%2BAlt%2Bc%2C%20Ctrl%2BWin%2Bl%20(LeftArrow)%20SNUBH%20230118.ahk
  • 26. EMR lab data @ SNUH EMR Input T4(free)(진검시행) 0.90 1.03 TSH(진검시행) 3.41 3.84 Calcium 9.2 8.9 Phosphorus 3.5 2.9 Glucose 95 102 Uric acid 3.3 3.0 Chol. 171 198 T. Protein 7.2 7.2 Albumin 4.5 4.4 T. Bil. 1.0 1.0 Alk. phos. 46 49 AST(GOT) 24 33 ALT(GPT) 29 47 GGT 32 37 BUN 10 13 Creatinine 0.77 0.73 eGFR(MDRD) 104.9 111.6 eGFR(CKD EPI Cr) 102.2 104.4 TG 270 179 HDL Chol. 36 44 LDL Chol. 87 113 LDL Chol.(계산식) 81 118 hs-CRP 0.03 0.06 WBC 4.71 5.27 Hb 15.3 16.2 Hct 45.5 47.0 MCV 95.0 95.7 Platelet 164 157 ESR 2 5 ANC 2421 2466 Hb A1c 5.2 5.3 Output TChol/TG/HDL/LDL : 171/270/36/87 ← 198/179/44/113
  • 27. Review Tutorials for Regular Expression (정규표현식)
  • 28. Regular Expressions @ Google Sheets https://support.google.com/a/answer/1371415?hl=en Input Regular Expression Output 1 Abc1234 .?(){} [A-Za-z] A b c 2 Abc1234 .?(){} [A-Za-z]{2} Ab 3 Abc1234 .?(){} [0-9]{2} 12 34 4 Abc1234 .?(){} [0-9]+ 1234 5 Abc1234 .?(){} .{6} Abc123 4 .?( 6 Abc1234 .?(){} . . 7 Abc1234 .?(){} [A-Za-z][0-9]|[0-9]{2} c1 23 8 Abc1234 .?(){} [A-Za-z]?[0-9]{2} c12 34 9 Abc1234 .?(){} [^0-9]* Abc .?(){}
  • 29. Regular Expressions @ Google Sheets Input Regular Expression Output 1 2022-06-03 [0-9]+ 2022 06 03 2 2022-06-03 -[0-9]{2} -06 -03 3 2022-06-03 [0-9]{4}-[0-9]{2}- [0-9]{2} 2022-06-03 4 175 67.5 [0-9]+ 175 67 5 5 175 67.5 [0-9]+.[0-9]* 67.5 6 175 67.5 [0-9]+.?[0-9]* 175 67.5 https://support.google.com/a/answer/1371415?hl=en
  • 30. tbl_input @ Google Sheets Example input table @ SNUHFM HPDP A B C D E 호흡기계 단순 흉부 촬영 (Chest X-Ray) Chest X-Ray 2022-06-03No significant interval change since last study. 신체 측정 복부 지방 CT (Abdominal FAT CT) Abdominal FAT CT 2022-06-03Fat amount ratio = Visceral fat/Subcutaneous fat = 7051.11/7723.56 = 0.91 근골격계 골밀도 검사 (Dexa Bone Densitometry) Bone Densitometry <T - score> Spine L1 - L4 : - 0.6 Femur neck : - 2.2 Femur total : - 2.6 Osteoporosis https://tinyurl.com/SNUHFMRegEx
  • 31. 2022-06-03Fat amount ratio = Visceral fat/Subcutaneous fat = 7051.11/7723.56 = 0.91 =regexextract( query(tbl_input!$A:$E, "select E where C contains 'Abdominal FAT CT'") , "[0-9]{4}-[0-9]{2}-[0-9]{2}" ) 2022-06-03 =query(tbl_input!$A:$E, "select E where C contains 'Abdominal FAT CT'") Regular Expression @ Google Sheets Extract dates [0-9]{4}-[0-9]{2}-[0-9]{2}
  • 32. 2022-06-03Fat amount ratio = Visceral fat/Subcutaneous fat = 7051.11/7723.56 = 0.91 =regexreplace( regexextract( query(tbl_input!$A:$E, "select E where C contains 'Abdominal FAT CT'") , "[0-9]{4}-[0-9]{2}-[0-9]{2}" ) ,"-" ,"." ) 2022.06.08 =query(tbl_input!$A:$E, "select E where C contains 'Abdominal FAT CT'") Regular Expression @ Google Sheets Extract dates [0-9]{4}-[0-9]{2}-[0-9]{2}
  • 33. 2022-06-03Fat amount ratio = Visceral fat/Subcutaneous fat = 7051.11/7723.56 = 0.91 =regexextract( query(tbl_input!$A:$E, "select E where C contains 'Abdominal FAT CT'") , "= *[0-9]+.?[0-9]*/" ) = 7051.11/ =query(tbl_input!$A:$E, "select E where C contains 'Abdominal FAT CT'") Regular Expression @ Google Sheets Extract visceral adipose tissue (VAT) = *[0-9]+.?[0-9]*/
  • 34. 2022-06-03Fat amount ratio = Visceral fat/Subcutaneous fat = 7051.11/7723.56 = 0.91 =regexreplace( regexreplace( regexextract( query(tbl_input!$A:$E, "select E where C contains 'Abdominal FAT CT'") , "= *[0-9]+.?[0-9]*/" ) ,"= *" ,"" ) ,"/" ,"" ) 7051.11 =query(tbl_input!$A:$E, "select E where C contains 'Abdominal FAT CT'") Regular Expression @ Google Sheets Extract visceral adipose tissue (VAT) = *[0-9]+.?[0-9]*/
  • 35. 2022-06-03Fat amount ratio = Visceral fat/Subcutaneous fat = 7051.11/7723.56 = 0.91 =round(value( regexreplace( regexreplace( regexextract( query(tbl_input!$A:$E, "select E where C contains 'Abdominal FAT CT'") , "= *[0-9]+.?[0-9]*/" ) ,"= *" ,"" ) ,"/" ,"" ) )) / 100 &" cm²" 70.51 cm² =query(tbl_input!$A:$E, "select E where C contains 'Abdominal FAT CT'") Regular Expression @ Google Sheets Extract visceral adipose tissue (VAT) = *[0-9]+.?[0-9]*/
  • 36. <T - score> Spine L1 - L4 : - 0.6 Femur neck : - 2.2 Femur total : - 2.6 Osteoporosis =regexextract(query(tbl_input!$A:$E, "select E where C contains 'Bone Densitometry'"),"[Oo]steop[a-z]+") Osteoporosis =query(tbl_input!$A:$E, "select E where C contains 'Bone Densitometry'") Regular Expression @ Google Sheets Extract Dual Energy X-ray Absorptiometry (DEXA) results [Oo]steop[a-z]+
  • 37. <T - score> Spine L1 - L4 : - 0.6 Femur neck : - 2.2 Femur total : - 2.6 Osteoporosis =regexextract(query(tbl_input!$A:$E, "select E where C contains 'Bone Densitometry'"),"[Oo]steop[a-z]+") &"("&regexextract(query(tbl_input!$A:$E, "select E where C contains 'Bone Densitometry'"),"[Ll][1-4] *- *[Ll][1-4] *: *- [0-9]+.?[0-9]*") &", "&regexextract(query(tbl_input!$A:$E, "select E where C contains 'Bone Densitometry'"),"[Ff]emur [Nn]eck *: *- [0-9]+.?[0-9]*") &", "&regexextract(query(tbl_input!$A:$E, "select E where C contains 'Bone Densitometry'"),"[Ff]emur [Tt]otal *: *- [0-9]+.?[0-9]*")&")" Osteoporosis(L1 - L4 : - 0.6, Femur neck : - 2.2, Femur total : - 2.6) =query(tbl_input!$A:$E, "select E where C contains 'Bone Densitometry'") Regular Expression @ Google Sheets Extract Dual Energy X-ray Absorptiometry (DEXA) results [Oo]steop[a-z]+