- KMPSYNTH ;SP/JML - VistA Synthetic Transactions ;2/1/2023
- ;;4.0;CAPACITY MANAGEMENT;**1,3**;3/1/2018;Build 17
- ;
- ; Reference to ^DPT in ICR #10035
- ; Reference to PTSEC^DGSEC4 in ICR #3027
- ; Reference to GET^VPR in ICR #7135
- ; Reference to GET^VPRJD in ICR #7136
- ;
- SYNRCMD(KMPJSON) ;
- N KMPA,KMPARRAY,KMPARRAY1,KMPB,KMPC,KMPEND,KMPI,KMPRET,KMPSTART
- S KMPSTART=$$STATS()
- F KMPI=1:1:1000 D
- .S KMPA=$R(100),KMPB=$R(100),KMPC=KMPA+KMPB,KMPARRAY(KMPI)=KMPC D
- ..M KMPARRAY1=KMPARRAY K KMPARRAY
- ..D ONE
- ..D TWO
- S KMPEND=$$STATS()
- S KMPJSON.SystemCpuTime=$P(KMPEND,"^",1)-$P(KMPSTART,"^",1)
- S KMPJSON.UserCpuTime=$P(KMPEND,"^",2)-$P(KMPSTART,"^",2)
- S KMPJSON.RoutineCommands=$P(KMPEND,"^",3)-$P(KMPSTART,"^",3)
- S KMPJSON.GlobalRefs=$P(KMPEND,"^",4)-$P(KMPSTART,"^",4)
- S KMPJSON.Runtime=$NUMBER(($P($P(KMPEND,"^",5),",",2)-$P($P(KMPSTART,"^",5),",",2))*1000,0)
- Q
- ;
- ONE ;
- N KMPAAA,KMPANS1,KMPANS2,KMPANS3,KMPANS4,KMPANS5,KMPANS6,KMPARR,KMPBBB,KMPCCC,KMPX,KMPY,KMPZ
- S KMPAAA=$R(100),KMPBBB=$R(100),KMPCCC=$R(100)
- I KMPBBB=0 S KMPBBB=1000
- S KMPANS1=KMPAAA-KMPBBB S KMPANS1=$S(KMPANS1<1:1,1:KMPANS1)
- S KMPANS2=KMPAAA+KMPBBB S KMPANS2=$S(KMPANS2<1:1,1:KMPANS2)
- S KMPANS3=KMPAAA/KMPBBB S KMPANS3=$S(KMPANS3<1:1,1:KMPANS3)
- S KMPANS4=KMPAAA*KMPBBB S KMPANS4=$S(KMPANS4<1:1,1:KMPANS4)
- S KMPANS5=(KMPANS1/KMPANS2)*KMPANS3
- S KMPANS6=KMPANS4#2,KMPANS6=KMPANS1*KMPANS2*KMPANS3*KMPANS4
- F KMPX=1:1:100 D
- .F KMPY=1:1:100 D
- ..S KMPARR(KMPY)=KMPANS1*KMPANS2
- ..S KMPARR(KMPY,KMPY)=KMPANS3*KMPANS4
- ..S KMPARR(KMPY,KMPY,KMPY)=KMPANS1_"^"_KMPANS2_"^"_KMPANS3_"^"_KMPANS4
- S KMPZ=""
- F S KMPZ=$O(KMPARR(KMPZ)) Q:KMPZ="" D
- .K KMPARR(KMPZ)
- Q
- ;
- TWO ;
- N KMPALPHA,KMPFIRST,KMPFL,KMPI,KMPLAST,KMPLEN,KMPSENTARR,KMPSENTENCE,KMPSENTENCE2,KMPTOT
- S KMPALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- S KMPSENTENCE="THIS IS A ROUTINE TO GENERATE ROUTINE COMMANDS"
- S KMPLEN=$L(KMPSENTENCE," ")
- S KMPFIRST=$P(KMPSENTENCE," "),KMPLAST=$P(KMPSENTENCE," ",KMPLEN)
- S KMPFL=KMPFIRST_","_KMPLAST
- F KMPI=1:1:KMPLEN S KMPSENTARR(KMPI)=$P(KMPSENTENCE," ",KMPI)
- S KMPI=""
- F S KMPI=$O(KMPSENTARR(KMPI)) Q:KMPI="" D
- .S KMPSENTENCE2=$G(KMPSENTENCE2)_":"_$G(KMPSENTARR(KMPI))
- S KMPTOT=0 F KMPI=1:1:$L(KMPSENTENCE2) D
- .S KMPTOT=KMPTOT+$A($E(KMPSENTENCE2,KMPI))
- Q
- ;
- SYNFILE(KMPJSON) ;
- N KMPBB,KMPEND,KMPF,KMPFILE,KMPI,KMPLINE,KMPPATH,KMPSTART,KMPSTAT,KMPTEXT,KMPDFILE,KMPFILES
- N KMPLN,KMPMATCH,KMPDELS,KMPSTART1,KMPEND1,KMPSTART2,KMPEND2,KMPSTART3,KMPEND3,POP
- S KMPSTART1=$$STATS(),KMPSTAT=""
- ; create file and write lorem ipsem text
- S KMPPATH=$$DEFDIR^%ZISH(),KMPFILE="VistaSystemMonitor"_$J_".txt"
- D OPEN^%ZISH("KMPFILE",KMPPATH,KMPFILE,"W")
- I POP=1 S KMPJSON.FileOpen="Failure" Q
- I POP=0 D
- .S KMPJSON.FileOpen="Success"
- .U IO
- .F KMPI=1:1:500 D
- ..S KMPTEXT="",KMPLINE=1
- ..F D Q:KMPTEXT=""
- ...S KMPTEXT=$P($TEXT(LOREM+KMPLINE),";;",2)
- ...W !,KMPTEXT
- ...S KMPLINE=KMPLINE+1
- D CLOSE^%ZISH("KMPFILE")
- S (KMPEND1,KMPSTART2)=$$STATS()
- D OPEN^%ZISH("KMPFILE",KMPPATH,KMPFILE,"R")
- I POP=1 S KMPJSON.FileOpen="Failure" Q
- I POP=0 D
- .F U IO R KMPLN:1 Q:$$STATUS^%ZISH S KMPBB=KMPLN
- .D CLOSE^%ZISH("KMPFILE")
- S (KMPEND2,KMPSTART3)=$$STATS()
- ; delete any files created with this routine
- S KMPMATCH("VistaSystemMonitor*.txt")=""
- S KMPBB=$$LIST^%ZISH(KMPPATH,"KMPMATCH","KMPFILES")
- S KMPFILE="",KMPDELS=0
- F S KMPFILE=$O(KMPFILES(KMPFILE)) Q:KMPFILE="" D
- .S KMPDFILE(KMPFILE)=""
- .S KMPDELS=KMPDELS+1
- S KMPBB=$$DEL^%ZISH(KMPPATH,$NA(KMPDFILE))
- S KMPEND3=$$STATS()
- ; calculate stats and return
- S KMPJSON.ReadSystemCpuTime=$P(KMPEND1,"^",1)-$P(KMPSTART1,"^",1)
- S KMPJSON.ReadUserCpuTime=$P(KMPEND1,"^",2)-$P(KMPSTART1,"^",2)
- S KMPJSON.ReadRoutineCommands=$P(KMPEND1,"^",3)-$P(KMPSTART1,"^",3)
- S KMPJSON.ReadGlobalRefs=$P(KMPEND1,"^",4)-$P(KMPSTART1,"^",4)
- S KMPJSON.ReadRuntime=$NUMBER(($P($P(KMPEND1,"^",5),",",2)-$P($P(KMPSTART1,"^",5),",",2))*1000,0)
- S KMPJSON.WriteSystemCpuTime=$P(KMPEND2,"^",1)-$P(KMPSTART2,"^",1)
- S KMPJSON.WriteUserCpuTime=$P(KMPEND2,"^",2)-$P(KMPSTART2,"^",2)
- S KMPJSON.WriteRoutineCommands=$P(KMPEND2,"^",3)-$P(KMPSTART2,"^",3)
- S KMPJSON.WriteGlobalRefs=$P(KMPEND2,"^",4)-$P(KMPSTART2,"^",4)
- S KMPJSON.WriteRuntime=$NUMBER(($P($P(KMPEND2,"^",5),",",2)-$P($P(KMPSTART2,"^",5),",",2))*1000,0)
- S KMPJSON.DeleteSystemCpuTime=$P(KMPEND3,"^",1)-$P(KMPSTART3,"^",1)
- S KMPJSON.DeleteUserCpuTime=$P(KMPEND3,"^",2)-$P(KMPSTART3,"^",2)
- S KMPJSON.DeleteRoutineCommands=$P(KMPEND3,"^",3)-$P(KMPSTART3,"^",3)
- S KMPJSON.DeleteGlobalRefs=$P(KMPEND3,"^",4)-$P(KMPSTART3,"^",4)
- S KMPJSON.DeleteRuntime=$NUMBER(($P($P(KMPEND3,"^",5),",",2)-$P($P(KMPSTART3,"^",5),",",2))*1000,0)
- S KMPJSON.DeletedFileCount=KMPDELS
- Q
- SYNVPR(KMPJSON,KMPDFN,KMPCDOMS) ;
- N DT,KMPDARR,KMPEND,KMPI,KMPLAST,KMPLINE,KMPLINE2,KMPRET,KMPSTART,KMPTCHAR
- S KMPSTART=$$STATS()
- S DT=$$DT^XLFDT
- S KMPDARR=##class(%DynamicArray).%New()
- S KMPTCHAR=0,KMPI=0
- I $G(KMPDFN)="" S KMPDFN=$O(^DPT("A"),-1) ;supported by ICR #10035
- D GET^VPRD(.KMPRET,KMPDFN,$G(KMPCDOMS)) ;supported by ICR #7135
- S KMPLAST=$O(@KMPRET@(999),-1)
- F KMPI=1:1:KMPLAST D
- .S KMPLINE=$G(@KMPRET@(KMPI))
- .Q:KMPLINE=""
- .S KMPTCHAR=KMPTCHAR+$L(KMPLINE)
- .S $P(KMPLINE2,"X",$L(KMPLINE))="X"
- .D KMPDARR.%Push(KMPLINE2)
- .K KMPLINE2
- K @KMPRET
- S KMPJSON.Payload=KMPDARR
- S KMPJSON.TotalLines=KMPLAST
- S KMPJSON.TotalCharacters=KMPTCHAR
- S KMPJSON.Dfn=KMPDFN
- S KMPEND=$$STATS()
- S KMPJSON.SystemCpuTime=$P(KMPEND,"^",1)-$P(KMPSTART,"^",1)
- S KMPJSON.UserCpuTime=$P(KMPEND,"^",2)-$P(KMPSTART,"^",2)
- S KMPJSON.RoutineCommands=$P(KMPEND,"^",3)-$P(KMPSTART,"^",3)
- S KMPJSON.GlobalRefs=$P(KMPEND,"^",4)-$P(KMPSTART,"^",4)
- S KMPJSON.Runtime=$NUMBER(($P($P(KMPEND,"^",5),",",2)-$P($P(KMPSTART,"^",5),",",2))*1000,0)
- Q
- ;
- PATLIST(KMPJSON,KMPMAX) ;
- ; LAST 4, LASTNAME, FIRSTMIDNAME, DUZ, last appointment
- N KMPPARR,KMPDFN,KMPCNT,KMPSTOP,DGSENS,DGSENFLG,KMPN0,KMPNAME,KMPLNAME,KMPFMNAME,KMPSSN,KMPLAST4,KMPSCDT,KMPPAT
- ;
- S KMPPARR=##class(%DynamicArray).%New()
- S KMPMAX=+$G(KMPMAX) I KMPMAX=0 S KMPMAX=10
- S KMPDFN="A",KMPCNT=0,KMPSTOP=0
- F S KMPDFN=$O(^DPT(KMPDFN),-1) Q:KMPDFN=""!(KMPSTOP) D ;supported by ICR #10035
- .; Quit if patient is deceased
- .Q:$P($G(^DPT(KMPDFN,.35)),"^")]""
- .; Quit if patient is restricted
- .D PTSEC^DGSEC4(.DGSENS,KMPDFN) ;supported by ICR #3027
- .Q:DGSENS(1)'=0
- .S KMPN0=$G(^DPT(KMPDFN,0))
- .S KMPNAME=$P(KMPN0,"^"),KMPLNAME=$P(KMPNAME,","),KMPFMNAME=$P(KMPNAME,",",2)
- .S KMPSSN=$P(KMPN0,"^",9),KMPLAST4=$E(KMPSSN,6,9)
- .S KMPSCDT=$O(^DPT(KMPDFN,"S",""),-1)
- .S KMPPAT=##class(%DynamicObject).%New()
- .S KMPPAT.SsnLast4=KMPLAST4,KMPPAT.LastName=KMPLNAME
- .S KMPPAT.FirstMiddleName=KMPFMNAME,KMPPAT.Dfn=KMPDFN
- .S KMPPAT.LastApptDate=$P($$TSTAMP^KMPUTLW(KMPSCDT,"FILEMAN"),"^")
- .D KMPPARR.%Push(KMPPAT)
- .S KMPCNT=KMPCNT+1
- .I KMPCNT>=KMPMAX S KMPSTOP=1
- S KMPJSON.Patients=KMPPARR
- Q
- ;
- STATS() ;
- N KMPVCPU,KMPVPROC,KMPVRET
- S KMPVRET=""
- S KMPVPROC=##class(%SYS.ProcessQuery).%OpenId($J)
- I KMPVPROC="" Q KMPVRET
- ; cpu time
- S KMPVCPU=KMPVPROC.GetCPUTime()
- S $P(KMPVRET,"^")=$P(KMPVCPU,",")
- S $P(KMPVRET,"^",2)=$P(KMPVCPU,",",2)
- ; m commands - commands
- S $P(KMPVRET,"^",3)=KMPVPROC.CommandsExecuted
- ; global references
- S $P(KMPVRET,"^",4)=KMPVPROC.GlobalReferences
- ; current time UTC
- S $P(KMPVRET,"^",5)=$ZTIMESTAMP
- K KMPVPROC
- Q KMPVRET
- ;
- LOREM ;
- ;;Lorem ipsum is a pseudo-Latin text used in web design, typography,
- ;;layout, and printing ;; in place of English to emphasise design
- ;;elements over content. It's also called placeholder (or filler)
- ;;text. It's a convenient tool for mock-ups. It helps to outline
- ;;the visual elements of a document or presentation, eg typography,
- ;;font, or layout. Lorem ipsum is mostly a part of a Latin text by
- ;;the classical author and philosopher Cicero. Its words and letters
- ;;have been changed by addition or removal, so to deliberately render
- ;;its content nonsensical; it's not genuine, correct, or comprehensible
- ;;Latin anymore. While lorem ipsum's still resembles classical Latin,
- ;;it actually has no meaning whatsoever. As Cicero's text doesn't
- ;;contain the letters K, W, or Z, alien to latin, these, and others
- ;;are often inserted randomly to mimic the typographic appearence
- ;;of European languages, as are digraphs not to be found in the original.
- ;;In a professional context it often happens that private or corporate
- ;;clients corder a publication to be made and presented with the
- ;;actual content still not being ready. Think of a news blog that's
- ;;filled with content hourly on the day of going live. However,
- ;;reviewers tend to be distracted by comprehensible content, say, a
- ;;random text copied from a newspaper or the internet. The are likely
- ;;to focus on the text, disregarding the layout and its elements.
- ;;Besides, random text risks to be unintendedly humorous or offensive,
- ;;an unacceptable risk in corporate environments. Lorem ipsum and its
- ;;many variants have been employed since the early 1960ies, and quite
- ;;likely since the sixteenth century.
- ;;Lorem Ipsum: common examples layout based on Lorem Ipsum Most of
- ;;its text is made up from sections 1.10.32-3 of Cicero's De finibus
- ;;bonorum et malorum (On the Boundaries of Goods and Evils; finibus
- ;;may also be translated as purposes). Neque porro quisquam est qui
- ;;dolorem ipsum quia dolor sit amet, consectetur, adipisci velit is
- ;;The first known version ("Neither is there anyone who loves grief
- ;;itself since it is grief and thus wants to obtain it"). It was found
- ;;by Richard McClintock, a philologist, director of publications at
- ;;Hampden-Sydney College in Virginia; he searched for citings of
- ;;consectetur in classical Latin literature, a term of remarkably
- ;;low frequency in that literary corpus. Cicero famously orated
- ;;against his political opponent Lucius Sergius Catilina. Occasionally
- ;;the first Oration against Catiline is taken for type specimens:
- ;;Quo usque tandem abutere, Catilina, patientia nostra? Quam diu
- ;;etiam furor iste tuus nos eludet? (How long, O Catiline, will you
- ;;abuse our patience? And for how long will that madness of yours
- ;;mock us?) Cicero's version of Liber Primus (first Book), sections
- ;;1.10.32-3 (fragments included in most Lorem Ipsum variants in red):
- ;;Cicero writing letters; from an early edition by Hieronymus Scotus
- ;;Sed ut perspiciatis, unde omnis iste natus error sit voluptatem
- ;;accusantium doloremque laudantium, totam rem aperiam eaque ipsa,
- ;;quae ab illo inventore veritatis et quasi architecto beatae vitae
- ;;dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit,
- ;;aspernatur aut odit aut fugit, sed quia consequuntur magni dolores
- ;;eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est,
- ;;qui dolorem ipsum, quia dolor sit amet, consectetur, adipisci[ng]
- ;;velit, sed quia non numquam [do] eius modi tempora inci[di]dunt, ut
- ;;labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima
- ;;veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam,
- ;;nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure
- ;;reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae
- ;;consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla
- ;;pariatur?
- ;;Lorem Ipsum: translation
- ;;The Latin scholar H. Rackham translated the above in 1914:
- ;;De Finibus Bonorum Et Malorum But I must explain to you how all this
- ;;mistaken idea of denouncing pleasure and praising pain was born and I
- ;;will give you a complete account of the system, and expound the actual
- ;;teachings of the great explorer of the truth, the master-builder
- ;;of human happiness. No one rejects, dislikes, or avoids pleasure itself,
- ;;because it is pleasure, but because those who do not know how to pursue
- ;;pleasure rationally encounter consequences that are extremely painful.
- ;;Nor again is there anyone who loves or pursues or desires to obtain pain
- ;;of itself, because it is pain, but occasionally circumstances occur in
- ;;which toil and pain can procure him some great pleasure. To take a
- ;;trivial example, which of us ever undertakes laborious physical exercise,
- ;;except to obtain some advantage from it? But who has any right to find
- ;;fault with a man who chooses to enjoy a pleasure that has no annoying
- ;;consequences, or one who avoids a pain that produces no resultant
- ;;pleasure? On the other hand, we denounce with righteous indignation
- ;;and dislike men who are so beguiled and demoralized by the charms of
- ;;pleasure of the moment, so blinded by desire, that they cannot foresee
- ;;the pain and trouble that are bound to ensue; and equal blame belongs
- ;;to those who fail in their duty through weakness of will, which is the
- ;;same as saying through shrinking from toil and pain. These cases are
- ;;perfectly simple and easy to distinguish. In a free hour, when our
- ;;power of choice is untrammelled and when nothing prevents our being able
- ;;to do what we like best, every pleasure is to be welcomed and every pain
- ;;avoided. But in certain circumstances and owing to the claims of duty
- ;;or the obligations of business it will frequently occur that pleasures
- ;;have to be repudiated and annoyances accepted. The wise man therefore
- ;;always holds in these matters to this principle of selection: he
- ;;rejects pleasures to secure other greater pleasures, or else
- ;;he endures pains to avoid worse pains.
- ;;Lorem Ipsum: variants and technical information
- ;;Adobe Fireworks Lorem Ipsum plugin In 1985 Aldus Corporation launched
- ;;its first desktop publishing program Aldus PageMaker for Apple Macintosh
- ;;computers, released in 1987 for PCs running Windows 1.0. Both contained
- ;;the variant lorem ipsum most common today. Laura Perry, then art director
- ;;with Aldus, modified prior versions of Lorem Ipsum text from typographical
- ;;specimens; in the 1960s and 1970s it appeared often in lettering
- ;;catalogs by Letraset. Anecdotal evidence has it that Letraset used Lorem
- ;;ipsum already from 1970 onwards, eg. for grids (page layouts) for ad
- ;;agencies. Many early desktop publishing programs, eg. Adobe PageMaker,
- ;;used it to create template. Most text editors like MS Word or Lotus
- ;;Notes generate random lorem text when needed, either as pre-installed
- ;;module or plug-in to be added. Word selection or sequence don't
- ;;necessarily match the original, which is intended to add variety.
- ;;Presentation software like Keynote or Pages use it as a samples for
- ;;screenplay layout. Content management software as Joomla, Drupal, Mambo,
- ;;PHP-Nuke, WordPress, or Movable Type offer Lorem Ipsum plug-ins
- ;;with the same functionality.
- ;;DONE
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HKMPSYNTH 15020 printed Apr 23, 2025@17:56:21 Page 2
- KMPSYNTH ;SP/JML - VistA Synthetic Transactions ;2/1/2023
- +1 ;;4.0;CAPACITY MANAGEMENT;**1,3**;3/1/2018;Build 17
- +2 ;
- +3 ; Reference to ^DPT in ICR #10035
- +4 ; Reference to PTSEC^DGSEC4 in ICR #3027
- +5 ; Reference to GET^VPR in ICR #7135
- +6 ; Reference to GET^VPRJD in ICR #7136
- +7 ;
- SYNRCMD(KMPJSON) ;
- +1 NEW KMPA,KMPARRAY,KMPARRAY1,KMPB,KMPC,KMPEND,KMPI,KMPRET,KMPSTART
- +2 SET KMPSTART=$$STATS()
- +3 FOR KMPI=1:1:1000
- Begin DoDot:1
- +4 SET KMPA=$RANDOM(100)
- SET KMPB=$RANDOM(100)
- SET KMPC=KMPA+KMPB
- SET KMPARRAY(KMPI)=KMPC
- Begin DoDot:2
- +5 MERGE KMPARRAY1=KMPARRAY
- KILL KMPARRAY
- +6 DO ONE
- +7 DO TWO
- End DoDot:2
- End DoDot:1
- +8 SET KMPEND=$$STATS()
- +9 SET KMPJSON.SystemCpuTime=$PIECE(KMPEND,"^",1)-$PIECE(KMPSTART,"^",1)
- +10 SET KMPJSON.UserCpuTime=$PIECE(KMPEND,"^",2)-$PIECE(KMPSTART,"^",2)
- +11 SET KMPJSON.RoutineCommands=$PIECE(KMPEND,"^",3)-$PIECE(KMPSTART,"^",3)
- +12 SET KMPJSON.GlobalRefs=$PIECE(KMPEND,"^",4)-$PIECE(KMPSTART,"^",4)
- +13
- *** ERROR ***
- SET KMPJSON.Runtime=$NUMBER(($PIECE($PIECE(KMPEND,"^",5),",",2)-$PIECE($PIECE(KMPSTART,"^",5),",",2))*1000,0)
- +14 QUIT
- +15 ;
- ONE ;
- +1 NEW KMPAAA,KMPANS1,KMPANS2,KMPANS3,KMPANS4,KMPANS5,KMPANS6,KMPARR,KMPBBB,KMPCCC,KMPX,KMPY,KMPZ
- +2 SET KMPAAA=$RANDOM(100)
- SET KMPBBB=$RANDOM(100)
- SET KMPCCC=$RANDOM(100)
- +3 IF KMPBBB=0
- SET KMPBBB=1000
- +4 SET KMPANS1=KMPAAA-KMPBBB
- SET KMPANS1=$SELECT(KMPANS1<1:1,1:KMPANS1)
- +5 SET KMPANS2=KMPAAA+KMPBBB
- SET KMPANS2=$SELECT(KMPANS2<1:1,1:KMPANS2)
- +6 SET KMPANS3=KMPAAA/KMPBBB
- SET KMPANS3=$SELECT(KMPANS3<1:1,1:KMPANS3)
- +7 SET KMPANS4=KMPAAA*KMPBBB
- SET KMPANS4=$SELECT(KMPANS4<1:1,1:KMPANS4)
- +8 SET KMPANS5=(KMPANS1/KMPANS2)*KMPANS3
- +9 SET KMPANS6=KMPANS4#2
- SET KMPANS6=KMPANS1*KMPANS2*KMPANS3*KMPANS4
- +10 FOR KMPX=1:1:100
- Begin DoDot:1
- +11 FOR KMPY=1:1:100
- Begin DoDot:2
- +12 SET KMPARR(KMPY)=KMPANS1*KMPANS2
- +13 SET KMPARR(KMPY,KMPY)=KMPANS3*KMPANS4
- +14 SET KMPARR(KMPY,KMPY,KMPY)=KMPANS1_"^"_KMPANS2_"^"_KMPANS3_"^"_KMPANS4
- End DoDot:2
- End DoDot:1
- +15 SET KMPZ=""
- +16 FOR
- SET KMPZ=$ORDER(KMPARR(KMPZ))
- if KMPZ=""
- QUIT
- Begin DoDot:1
- +17 KILL KMPARR(KMPZ)
- End DoDot:1
- +18 QUIT
- +19 ;
- TWO ;
- +1 NEW KMPALPHA,KMPFIRST,KMPFL,KMPI,KMPLAST,KMPLEN,KMPSENTARR,KMPSENTENCE,KMPSENTENCE2,KMPTOT
- +2 SET KMPALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- +3 SET KMPSENTENCE="THIS IS A ROUTINE TO GENERATE ROUTINE COMMANDS"
- +4 SET KMPLEN=$LENGTH(KMPSENTENCE," ")
- +5 SET KMPFIRST=$PIECE(KMPSENTENCE," ")
- SET KMPLAST=$PIECE(KMPSENTENCE," ",KMPLEN)
- +6 SET KMPFL=KMPFIRST_","_KMPLAST
- +7 FOR KMPI=1:1:KMPLEN
- SET KMPSENTARR(KMPI)=$PIECE(KMPSENTENCE," ",KMPI)
- +8 SET KMPI=""
- +9 FOR
- SET KMPI=$ORDER(KMPSENTARR(KMPI))
- if KMPI=""
- QUIT
- Begin DoDot:1
- +10 SET KMPSENTENCE2=$GET(KMPSENTENCE2)_":"_$GET(KMPSENTARR(KMPI))
- End DoDot:1
- +11 SET KMPTOT=0
- FOR KMPI=1:1:$LENGTH(KMPSENTENCE2)
- Begin DoDot:1
- +12 SET KMPTOT=KMPTOT+$ASCII($EXTRACT(KMPSENTENCE2,KMPI))
- End DoDot:1
- +13 QUIT
- +14 ;
- SYNFILE(KMPJSON) ;
- +1 NEW KMPBB,KMPEND,KMPF,KMPFILE,KMPI,KMPLINE,KMPPATH,KMPSTART,KMPSTAT,KMPTEXT,KMPDFILE,KMPFILES
- +2 NEW KMPLN,KMPMATCH,KMPDELS,KMPSTART1,KMPEND1,KMPSTART2,KMPEND2,KMPSTART3,KMPEND3,POP
- +3 SET KMPSTART1=$$STATS()
- SET KMPSTAT=""
- +4 ; create file and write lorem ipsem text
- +5 SET KMPPATH=$$DEFDIR^%ZISH()
- SET KMPFILE="VistaSystemMonitor"_$JOB_".txt"
- +6 DO OPEN^%ZISH("KMPFILE",KMPPATH,KMPFILE,"W")
- +7 IF POP=1
- SET KMPJSON.FileOpen="Failure"
- QUIT
- +8 IF POP=0
- Begin DoDot:1
- +9 SET KMPJSON.FileOpen="Success"
- +10 USE IO
- +11 FOR KMPI=1:1:500
- Begin DoDot:2
- +12 SET KMPTEXT=""
- SET KMPLINE=1
- +13 FOR
- Begin DoDot:3
- +14 SET KMPTEXT=$PIECE($TEXT(LOREM+KMPLINE),";;",2)
- +15 WRITE !,KMPTEXT
- +16 SET KMPLINE=KMPLINE+1
- End DoDot:3
- if KMPTEXT=""
- QUIT
- End DoDot:2
- End DoDot:1
- +17 DO CLOSE^%ZISH("KMPFILE")
- +18 SET (KMPEND1,KMPSTART2)=$$STATS()
- +19 DO OPEN^%ZISH("KMPFILE",KMPPATH,KMPFILE,"R")
- +20 IF POP=1
- SET KMPJSON.FileOpen="Failure"
- QUIT
- +21 IF POP=0
- Begin DoDot:1
- +22 FOR
- USE IO
- READ KMPLN:1
- if $$STATUS^%ZISH
- QUIT
- SET KMPBB=KMPLN
- +23 DO CLOSE^%ZISH("KMPFILE")
- End DoDot:1
- +24 SET (KMPEND2,KMPSTART3)=$$STATS()
- +25 ; delete any files created with this routine
- +26 SET KMPMATCH("VistaSystemMonitor*.txt")=""
- +27 SET KMPBB=$$LIST^%ZISH(KMPPATH,"KMPMATCH","KMPFILES")
- +28 SET KMPFILE=""
- SET KMPDELS=0
- +29 FOR
- SET KMPFILE=$ORDER(KMPFILES(KMPFILE))
- if KMPFILE=""
- QUIT
- Begin DoDot:1
- +30 SET KMPDFILE(KMPFILE)=""
- +31 SET KMPDELS=KMPDELS+1
- End DoDot:1
- +32 SET KMPBB=$$DEL^%ZISH(KMPPATH,$NAME(KMPDFILE))
- +33 SET KMPEND3=$$STATS()
- +34 ; calculate stats and return
- +35 SET KMPJSON.ReadSystemCpuTime=$PIECE(KMPEND1,"^",1)-$PIECE(KMPSTART1,"^",1)
- +36 SET KMPJSON.ReadUserCpuTime=$PIECE(KMPEND1,"^",2)-$PIECE(KMPSTART1,"^",2)
- +37 SET KMPJSON.ReadRoutineCommands=$PIECE(KMPEND1,"^",3)-$PIECE(KMPSTART1,"^",3)
- +38 SET KMPJSON.ReadGlobalRefs=$PIECE(KMPEND1,"^",4)-$PIECE(KMPSTART1,"^",4)
- +39
- *** ERROR ***
- SET KMPJSON.ReadRuntime=$NUMBER(($PIECE($PIECE(KMPEND1,"^",5),",",2)-$PIECE($PIECE(KMPSTART1,"^",5),",",2))*1000,0)
- +40 SET KMPJSON.WriteSystemCpuTime=$PIECE(KMPEND2,"^",1)-$PIECE(KMPSTART2,"^",1)
- +41 SET KMPJSON.WriteUserCpuTime=$PIECE(KMPEND2,"^",2)-$PIECE(KMPSTART2,"^",2)
- +42 SET KMPJSON.WriteRoutineCommands=$PIECE(KMPEND2,"^",3)-$PIECE(KMPSTART2,"^",3)
- +43 SET KMPJSON.WriteGlobalRefs=$PIECE(KMPEND2,"^",4)-$PIECE(KMPSTART2,"^",4)
- +44
- *** ERROR ***
- SET KMPJSON.WriteRuntime=$NUMBER(($PIECE($PIECE(KMPEND2,"^",5),",",2)-$PIECE($PIECE(KMPSTART2,"^",5),",",2))*1000,0)
- +45 SET KMPJSON.DeleteSystemCpuTime=$PIECE(KMPEND3,"^",1)-$PIECE(KMPSTART3,"^",1)
- +46 SET KMPJSON.DeleteUserCpuTime=$PIECE(KMPEND3,"^",2)-$PIECE(KMPSTART3,"^",2)
- +47 SET KMPJSON.DeleteRoutineCommands=$PIECE(KMPEND3,"^",3)-$PIECE(KMPSTART3,"^",3)
- +48 SET KMPJSON.DeleteGlobalRefs=$PIECE(KMPEND3,"^",4)-$PIECE(KMPSTART3,"^",4)
- +49
- *** ERROR ***
- SET KMPJSON.DeleteRuntime=$NUMBER(($PIECE($PIECE(KMPEND3,"^",5),",",2)-$PIECE($PIECE(KMPSTART3,"^",5),",",2))*1000,0)
- +50 SET KMPJSON.DeletedFileCount=KMPDELS
- +51 QUIT
- SYNVPR(KMPJSON,KMPDFN,KMPCDOMS) ;
- +1 NEW DT,KMPDARR,KMPEND,KMPI,KMPLAST,KMPLINE,KMPLINE2,KMPRET,KMPSTART,KMPTCHAR
- +2 SET KMPSTART=$$STATS()
- +3 SET DT=$$DT^XLFDT
- +4 SET KMPDARR=##class(%DynamicArray).%New()
- +5 SET KMPTCHAR=0
- SET KMPI=0
- +6 ;supported by ICR #10035
- IF $GET(KMPDFN)=""
- SET KMPDFN=$ORDER(^DPT("A"),-1)
- +7 ;supported by ICR #7135
- DO GET^VPRD(.KMPRET,KMPDFN,$GET(KMPCDOMS))
- +8 SET KMPLAST=$ORDER(@KMPRET@(999),-1)
- +9 FOR KMPI=1:1:KMPLAST
- Begin DoDot:1
- +10 SET KMPLINE=$GET(@KMPRET@(KMPI))
- +11 if KMPLINE=""
- QUIT
- +12 SET KMPTCHAR=KMPTCHAR+$LENGTH(KMPLINE)
- +13 SET $PIECE(KMPLINE2,"X",$LENGTH(KMPLINE))="X"
- +14 DO KMPDARR.%Push(KMPLINE2)
- +15 KILL KMPLINE2
- End DoDot:1
- +16 KILL @KMPRET
- +17 SET KMPJSON.Payload=KMPDARR
- +18 SET KMPJSON.TotalLines=KMPLAST
- +19 SET KMPJSON.TotalCharacters=KMPTCHAR
- +20 SET KMPJSON.Dfn=KMPDFN
- +21 SET KMPEND=$$STATS()
- +22 SET KMPJSON.SystemCpuTime=$PIECE(KMPEND,"^",1)-$PIECE(KMPSTART,"^",1)
- +23 SET KMPJSON.UserCpuTime=$PIECE(KMPEND,"^",2)-$PIECE(KMPSTART,"^",2)
- +24 SET KMPJSON.RoutineCommands=$PIECE(KMPEND,"^",3)-$PIECE(KMPSTART,"^",3)
- +25 SET KMPJSON.GlobalRefs=$PIECE(KMPEND,"^",4)-$PIECE(KMPSTART,"^",4)
- +26
- *** ERROR ***
- SET KMPJSON.Runtime=$NUMBER(($PIECE($PIECE(KMPEND,"^",5),",",2)-$PIECE($PIECE(KMPSTART,"^",5),",",2))*1000,0)
- +27 QUIT
- +28 ;
- PATLIST(KMPJSON,KMPMAX) ;
- +1 ; LAST 4, LASTNAME, FIRSTMIDNAME, DUZ, last appointment
- +2 NEW KMPPARR,KMPDFN,KMPCNT,KMPSTOP,DGSENS,DGSENFLG,KMPN0,KMPNAME,KMPLNAME,KMPFMNAME,KMPSSN,KMPLAST4,KMPSCDT,KMPPAT
- +3 ;
- +4 SET KMPPARR=##class(%DynamicArray).%New()
- +5 SET KMPMAX=+$GET(KMPMAX)
- IF KMPMAX=0
- SET KMPMAX=10
- +6 SET KMPDFN="A"
- SET KMPCNT=0
- SET KMPSTOP=0
- +7 ;supported by ICR #10035
- FOR
- SET KMPDFN=$ORDER(^DPT(KMPDFN),-1)
- if KMPDFN=""!(KMPSTOP)
- QUIT
- Begin DoDot:1
- +8 ; Quit if patient is deceased
- +9 if $PIECE($GET(^DPT(KMPDFN,.35)),"^")]""
- QUIT
- +10 ; Quit if patient is restricted
- +11 ;supported by ICR #3027
- DO PTSEC^DGSEC4(.DGSENS,KMPDFN)
- +12 if DGSENS(1)'=0
- QUIT
- +13 SET KMPN0=$GET(^DPT(KMPDFN,0))
- +14 SET KMPNAME=$PIECE(KMPN0,"^")
- SET KMPLNAME=$PIECE(KMPNAME,",")
- SET KMPFMNAME=$PIECE(KMPNAME,",",2)
- +15 SET KMPSSN=$PIECE(KMPN0,"^",9)
- SET KMPLAST4=$EXTRACT(KMPSSN,6,9)
- +16 SET KMPSCDT=$ORDER(^DPT(KMPDFN,"S",""),-1)
- +17 SET KMPPAT=##class(%DynamicObject).%New()
- +18 SET KMPPAT.SsnLast4=KMPLAST4
- SET KMPPAT.LastName=KMPLNAME
- +19 SET KMPPAT.FirstMiddleName=KMPFMNAME
- SET KMPPAT.Dfn=KMPDFN
- +20 SET KMPPAT.LastApptDate=$PIECE($$TSTAMP^KMPUTLW(KMPSCDT,"FILEMAN"),"^")
- +21 DO KMPPARR.%Push(KMPPAT)
- +22 SET KMPCNT=KMPCNT+1
- +23 IF KMPCNT>=KMPMAX
- SET KMPSTOP=1
- End DoDot:1
- +24 SET KMPJSON.Patients=KMPPARR
- +25 QUIT
- +26 ;
- STATS() ;
- +1 NEW KMPVCPU,KMPVPROC,KMPVRET
- +2 SET KMPVRET=""
- +3 SET KMPVPROC=##class(%SYS.ProcessQuery).%OpenId($JOB)
- +4 IF KMPVPROC=""
- QUIT KMPVRET
- +5 ; cpu time
- +6 SET KMPVCPU=KMPVPROC.GetCPUTime()
- +7 SET $PIECE(KMPVRET,"^")=$PIECE(KMPVCPU,",")
- +8 SET $PIECE(KMPVRET,"^",2)=$PIECE(KMPVCPU,",",2)
- +9 ; m commands - commands
- +10 SET $PIECE(KMPVRET,"^",3)=KMPVPROC.CommandsExecuted
- +11 ; global references
- +12 SET $PIECE(KMPVRET,"^",4)=KMPVPROC.GlobalReferences
- +13 ; current time UTC
- +14 SET $PIECE(KMPVRET,"^",5)=$ZTIMESTAMP
- +15 KILL KMPVPROC
- +16 QUIT KMPVRET
- +17 ;
- LOREM ;
- +1 ;;Lorem ipsum is a pseudo-Latin text used in web design, typography,
- +2 ;;layout, and printing ;; in place of English to emphasise design
- +3 ;;elements over content. It's also called placeholder (or filler)
- +4 ;;text. It's a convenient tool for mock-ups. It helps to outline
- +5 ;;the visual elements of a document or presentation, eg typography,
- +6 ;;font, or layout. Lorem ipsum is mostly a part of a Latin text by
- +7 ;;the classical author and philosopher Cicero. Its words and letters
- +8 ;;have been changed by addition or removal, so to deliberately render
- +9 ;;its content nonsensical; it's not genuine, correct, or comprehensible
- +10 ;;Latin anymore. While lorem ipsum's still resembles classical Latin,
- +11 ;;it actually has no meaning whatsoever. As Cicero's text doesn't
- +12 ;;contain the letters K, W, or Z, alien to latin, these, and others
- +13 ;;are often inserted randomly to mimic the typographic appearence
- +14 ;;of European languages, as are digraphs not to be found in the original.
- +15 ;;In a professional context it often happens that private or corporate
- +16 ;;clients corder a publication to be made and presented with the
- +17 ;;actual content still not being ready. Think of a news blog that's
- +18 ;;filled with content hourly on the day of going live. However,
- +19 ;;reviewers tend to be distracted by comprehensible content, say, a
- +20 ;;random text copied from a newspaper or the internet. The are likely
- +21 ;;to focus on the text, disregarding the layout and its elements.
- +22 ;;Besides, random text risks to be unintendedly humorous or offensive,
- +23 ;;an unacceptable risk in corporate environments. Lorem ipsum and its
- +24 ;;many variants have been employed since the early 1960ies, and quite
- +25 ;;likely since the sixteenth century.
- +26 ;;Lorem Ipsum: common examples layout based on Lorem Ipsum Most of
- +27 ;;its text is made up from sections 1.10.32-3 of Cicero's De finibus
- +28 ;;bonorum et malorum (On the Boundaries of Goods and Evils; finibus
- +29 ;;may also be translated as purposes). Neque porro quisquam est qui
- +30 ;;dolorem ipsum quia dolor sit amet, consectetur, adipisci velit is
- +31 ;;The first known version ("Neither is there anyone who loves grief
- +32 ;;itself since it is grief and thus wants to obtain it"). It was found
- +33 ;;by Richard McClintock, a philologist, director of publications at
- +34 ;;Hampden-Sydney College in Virginia; he searched for citings of
- +35 ;;consectetur in classical Latin literature, a term of remarkably
- +36 ;;low frequency in that literary corpus. Cicero famously orated
- +37 ;;against his political opponent Lucius Sergius Catilina. Occasionally
- +38 ;;the first Oration against Catiline is taken for type specimens:
- +39 ;;Quo usque tandem abutere, Catilina, patientia nostra? Quam diu
- +40 ;;etiam furor iste tuus nos eludet? (How long, O Catiline, will you
- +41 ;;abuse our patience? And for how long will that madness of yours
- +42 ;;mock us?) Cicero's version of Liber Primus (first Book), sections
- +43 ;;1.10.32-3 (fragments included in most Lorem Ipsum variants in red):
- +44 ;;Cicero writing letters; from an early edition by Hieronymus Scotus
- +45 ;;Sed ut perspiciatis, unde omnis iste natus error sit voluptatem
- +46 ;;accusantium doloremque laudantium, totam rem aperiam eaque ipsa,
- +47 ;;quae ab illo inventore veritatis et quasi architecto beatae vitae
- +48 ;;dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit,
- +49 ;;aspernatur aut odit aut fugit, sed quia consequuntur magni dolores
- +50 ;;eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est,
- +51 ;;qui dolorem ipsum, quia dolor sit amet, consectetur, adipisci[ng]
- +52 ;;velit, sed quia non numquam [do] eius modi tempora inci[di]dunt, ut
- +53 ;;labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima
- +54 ;;veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam,
- +55 ;;nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure
- +56 ;;reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae
- +57 ;;consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla
- +58 ;;pariatur?
- +59 ;;Lorem Ipsum: translation
- +60 ;;The Latin scholar H. Rackham translated the above in 1914:
- +61 ;;De Finibus Bonorum Et Malorum But I must explain to you how all this
- +62 ;;mistaken idea of denouncing pleasure and praising pain was born and I
- +63 ;;will give you a complete account of the system, and expound the actual
- +64 ;;teachings of the great explorer of the truth, the master-builder
- +65 ;;of human happiness. No one rejects, dislikes, or avoids pleasure itself,
- +66 ;;because it is pleasure, but because those who do not know how to pursue
- +67 ;;pleasure rationally encounter consequences that are extremely painful.
- +68 ;;Nor again is there anyone who loves or pursues or desires to obtain pain
- +69 ;;of itself, because it is pain, but occasionally circumstances occur in
- +70 ;;which toil and pain can procure him some great pleasure. To take a
- +71 ;;trivial example, which of us ever undertakes laborious physical exercise,
- +72 ;;except to obtain some advantage from it? But who has any right to find
- +73 ;;fault with a man who chooses to enjoy a pleasure that has no annoying
- +74 ;;consequences, or one who avoids a pain that produces no resultant
- +75 ;;pleasure? On the other hand, we denounce with righteous indignation
- +76 ;;and dislike men who are so beguiled and demoralized by the charms of
- +77 ;;pleasure of the moment, so blinded by desire, that they cannot foresee
- +78 ;;the pain and trouble that are bound to ensue; and equal blame belongs
- +79 ;;to those who fail in their duty through weakness of will, which is the
- +80 ;;same as saying through shrinking from toil and pain. These cases are
- +81 ;;perfectly simple and easy to distinguish. In a free hour, when our
- +82 ;;power of choice is untrammelled and when nothing prevents our being able
- +83 ;;to do what we like best, every pleasure is to be welcomed and every pain
- +84 ;;avoided. But in certain circumstances and owing to the claims of duty
- +85 ;;or the obligations of business it will frequently occur that pleasures
- +86 ;;have to be repudiated and annoyances accepted. The wise man therefore
- +87 ;;always holds in these matters to this principle of selection: he
- +88 ;;rejects pleasures to secure other greater pleasures, or else
- +89 ;;he endures pains to avoid worse pains.
- +90 ;;Lorem Ipsum: variants and technical information
- +91 ;;Adobe Fireworks Lorem Ipsum plugin In 1985 Aldus Corporation launched
- +92 ;;its first desktop publishing program Aldus PageMaker for Apple Macintosh
- +93 ;;computers, released in 1987 for PCs running Windows 1.0. Both contained
- +94 ;;the variant lorem ipsum most common today. Laura Perry, then art director
- +95 ;;with Aldus, modified prior versions of Lorem Ipsum text from typographical
- +96 ;;specimens; in the 1960s and 1970s it appeared often in lettering
- +97 ;;catalogs by Letraset. Anecdotal evidence has it that Letraset used Lorem
- +98 ;;ipsum already from 1970 onwards, eg. for grids (page layouts) for ad
- +99 ;;agencies. Many early desktop publishing programs, eg. Adobe PageMaker,
- +100 ;;used it to create template. Most text editors like MS Word or Lotus
- +101 ;;Notes generate random lorem text when needed, either as pre-installed
- +102 ;;module or plug-in to be added. Word selection or sequence don't
- +103 ;;necessarily match the original, which is intended to add variety.
- +104 ;;Presentation software like Keynote or Pages use it as a samples for
- +105 ;;screenplay layout. Content management software as Joomla, Drupal, Mambo,
- +106 ;;PHP-Nuke, WordPress, or Movable Type offer Lorem Ipsum plug-ins
- +107 ;;with the same functionality.
- +108 ;;DONE