Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combining findrx and Levneshtein
#1
HI Gintaras,

Can i have some help please?

I have a list of people in 1 system, which I need to find in another system. However its likely there will be spelling mistakes in the latter system so i need to use the levenshtein to compare how close of a match they are and anything that is 80% match on first name and surname (based off the dob and postcode/zip code being correct too)

I've attached what I currently use however it is very scrappy and I know does not pick up "close" matches or even highlight them.

Function Patient_Comparison
Code:
Copy      Help
int matches matchesA matchesB loops loops1 scrollUp noPatLoop = 0 ;; Counting/loop variables.
int+ scrollUp
str patientDetails patientDetailsLog

ARRAY(int)+ iS ;; 'In String' array
iS.create(4)

DOB_Reformat_dd_MMM_yy

int w=win("3.23 - NDUC (OWL)" "*.Window.*")
Acc a.Find(w "COLUMNHEADER" "DOB" "class=*.Window.*[]wfName=gridControl1" 0x1005);err
a.Mouse(1);err
sub.HOME "Press HOME to continue"
int vk=wait(0 K H)


;Acc a1.Find(w "TEXT" "" "class=*.EDIT.*[]wfName=tDOB" 0x1004 5)
;a1.Mouse(1 400 43) ;; orders by Last Case Date
;wait 1
;
;Acc a2.Find(w "TEXT" "" "class=*.EDIT.*[]wfName=tDOB" 0x1004 5)
;a2.Mouse(1 400 43) ;; orders by Last Case Date

dOBReformat.findreplace(" " "" 8)
dOBReformat.findreplace("    " "" 8)

pcode.findreplace(" " "" 8)
pcode.findreplace("    " "" 8) ;; Removes tabs / spaces

;PC_Checkpoint
loops = 0
loops1 = 0
scrollUp = 0
int pxx2 pyy2 = 0

matches = 0
matchesA = 0
matchesB = 0 ;; Resetting loop/match variables.


Acc a3.Find(w "CLIENT" "Data Panel" "class=*.Window.*[]wfName=gridControl1" 0x1005)
int+ cc = a3.ChildCount


Acc a6.Find(w "TEXT" "" "class=*.EDIT.*[]wfName=tPhonePatient" 0x1004 5)
a6.Mouse(1 0 55)
key P(#12)
rep
,loops + 1
,key Cc ;; Copies pat details
,wait 0.02
,patientDetails.getclip()
,patientDetailsLog.getclip() ;; Stores pat details
,patientDetails.findreplace("    " "" 8)
,patientDetails.findreplace(" " "" 8) ;; Removing tabs/spaces
,iS[0] = find(patientDetails dOBReformat) ;; DOB match in copied details? Y/N
,iS[1] = find(patientDetails pcode) ;; postcode match in copied details? Y/N
,if (iS[0] != -1) ;; If DOB match found, selected is the required one.
,,matches + 1
,,matchesA + 1
,,scrollUp = loops ;; Storing list position.
,,if (matchesA >= 2) && (matches >= 2) ;; If (at least) two found, amalgamate.
,,,Patient_Amalgamation
,,,if (restart = "true")
,,,,ret
,,;else
,,,;goto Matched
,if (iS[1] != -1);; If postcode match found, selected is the required one.
,,matches + 1
,,matchesB + 1
,,scrollUp = loops ;; Storing list position.
,,if (matchesB >= 2) && (matches >= 2) ;; If (at least) two found, amalgamate.
,,,
,,,if (restart = "true")
,,,,ret
,,else
,,,goto Matched
,;Matched
,if (loops >= cc) ;; Checks that scroll bar has reached bottom of list.
,,goto End_of_Patient_List
,else ;; Otherwise...
,,key D
,,wait 0.02

;End_of_Patient_List
scrollUp = loops - scrollUp

if (matches = 2) && ((matchesB = 1) && (matchesA = 1));; If only one patient in list matched...
,if (scrollUp >= 1)
,,rep scrollUp ;; Scroll up to pat.
,,,key U
,,,wait 0.05
,key Y
,wait 1.5
,Lock__Check
,After_Patient_Editor ;; Once patient is finally identified & selected.
,str+ alreadyDone = "true"
,ret
if (matches = 0) or ((matches = 2) && (matchesA = 1) && (matchesB = 1)) or ((matches = 1) && (matchesA = 1) or (matchesB = 1)) ;; If no matches, repeat with xxx record details.
,Acc a4.Find(w "TEXT" "" "class=*.EDIT.*[]wfName=tForenamePatient" 0x1004)
,a4.SetValue(F"%{fnamel3}")
,Acc a8.Find(w "TEXT" "" "class=*.EDIT.*[]wfName=tDOB" 0x1004)
,a8.SetValue(dob)
,Acc a5.Find(w "TEXT" "" "class=*.EDIT.*[]wfName=tSurnamePatient" 0x1004)
,a5.SetValue(F"%{snamel3}")
,lef 569 202 w 1 ;;editable text
,Acc a7.Find(w "PUSHBUTTON" "&Search" "class=*.Window.*[]wfName=bSearch" 0x1005 5)
,a7.DoDefaultAction
,wait 3
,noPatLoop + 1
,if (noPatLoop = 2)
,,a4.SetValue(F"{fnamef3}%")
,,a5.SetValue(F"{snamef3}%")
,,a8.SetValue(dob)
,,lef 569 202 w 1 ;;editable text
,,a7.DoDefaultAction;6

,if (noPatLoop >= 3)
,,,MES m;m.style="O";m.timeout=3;m.default='O';int i=mes("Unable to find match patient in list.[] Patient has been logged and the macro will move onto the next one" "No Patients" m)
,,,LogFile F"PATIENT NAME - {fname} {sname}; POSTCODE - {pcode}; DOB - {dob}; xxx- {xxx}; CASE - {urn}; UNABLE TO MATCH PATIENT" 1 F"C:\Users\xxx.xxx\Desktop\Errors{Today}.txt"
,,,Acc a66.Find(n "STATICTEXT" "xxx Number Matching" "" 0x1001 1)
,,,Acc a10.Find(n "STATICTEXT" "Adastra" "" 0x1001 1)    
,,,a66.DoDefaultAction;2
,,,int w1=wait(3 WV win("NMS - Google Chrome" "Chrome_WidgetWin_1"))
,,,Acc a1.Find(w1 "STATICTEXT" "Adastra" "" 0x3001 3)
,,,a1.DoDefaultAction
,,,
,,,mac "PDS Main"
,goto PC_Checkpoint_1


Forum Jump:


Users browsing this thread: 1 Guest(s)