45 lines
3.2 KiB
Mathematica
45 lines
3.2 KiB
Mathematica
YSESL ;SLC/DCM-ADD/EDIT/DELETE LINKS TO NODES IN DECISION SUPPORT SYSTEM ; 6/28/89 08:20 ;08/11/93 09:39
|
|
;;5.01;MENTAL HEALTH;;Dec 30, 1994
|
|
;DECISION EXPERT SYSTEM (VERSION 1.0) FOR MENTAL HEALTH PACKAGE - DWIGHT MCDANIEL / REGION 5 ISC, SLC
|
|
E G ED
|
|
PUSH S ST=ST+1,SDIC(ST)=DIC,SDIC0(ST)=DIC(0),ESDBP(ST)=ESDBP,ESDBP1(ST)=ESDBP1 Q
|
|
POP S DIC=SDIC(ST),DIC(0)=SDIC0(ST),ESDBP=ESDBP(ST),ESDBP1=ESDBP1(ST) K SDIC(ST),ESDBP(ST),ESDBP1(ST) S ST=ST-1 Q
|
|
SET S @(ESDBP_GN2_",2)")=A5ARSP_"^"_ESLNKS,LK="" G ED1
|
|
FIND S ESI=LND,ESK=1 F ESJ=1:1 S ESI=$O(@(ESDBP1_Q_ESI_Q_")")) Q:ESI="" I $E(ESI,1,$L(LND))=LND S ND(ESK)=ESI,ESK=ESK+1
|
|
S ESK=ESK-1 I ESK<1 S GN2=-1 W $C(7)," ??" Q
|
|
I ESK>1 W $C(7),!! F ESI=1:1:ESK W ESI,". ",ND(ESI),!
|
|
F1 I ESK>1 W !!,"Which node? (1-",ESK,") " R ESJ:DTIME I '$T!(ESJ="") S LND=-1 Q
|
|
I ESK>1,ESJ>ESK!(ESJ<1) W $C(7) G F1
|
|
S:ESK=1 ESJ=1 S GN2=$O(@(ESDBP1_Q_ND(ESJ)_Q_",0)")) W:GN2>0 $S((ESK-1)>1:" "_$P(@(ESDBP_GN2_",0)"),U),1:$P($E(@(ESDBP_GN2_",0)"),$L(LND)+1,99),U))
|
|
Q
|
|
ED K A5ARSP,ESLNKS D PUSH W @IOF,!?(80-(($L(A5ALG)+37))\2),"LINK << ",A5ALG," >> DECISION ALGORITHM NODES",!
|
|
S ESDBP=ESDBP_GN1_",2,"
|
|
ED1 S (Y1,Y2,Y3)="" W !!,"Node Being Linked: " R LND:DTIME G:'$T!(LND="") END I LND["?" D HLP^YSESH:LND?1"?",LST^YSESH:LND["??" G ED1
|
|
S GN2=$O(@(ESDBP1_Q_LND_Q_",0)")) I GN2']"" D FIND I GN2<1 W $C(7)," ??" G ED1
|
|
I $D(@(ESDBP_GN2_",2)")) S A5ARSP=$P(^(2),U),ESLNKS=$P(^(2),U,2) I $D(A5ARSP),A5ARSP]"",$D(ESLNKS),ESLNKS]"" S LK=ESLNKS D ^YSESR G EDIT
|
|
ADD S:'$D(ESLNKS) (LK,ESLNKS)="" I '$D(A5ARSP) S A5ARSP=""
|
|
I A5ARSP="",ESLNKS'="[0]" R !!,"Is this a Goal Node? (Y/N) // ",A5AX:DTIME G:'$T ED1 I "Nn"[A5AX D ^YSESR G:A5ARSP]"" EDIT
|
|
I A5ARSP="",ESLNKS'="[0]","Nn"[A5AX D ERROR^YSESH G ED1
|
|
AD1 S LK=ESLNKS W !!,"Definde Responses: ",$S(ESLNKS["[0]":" (THIS IS A GOAL NODE) ",1:"")_$S(A5ARSP=0:"NO RESPONSES DEFINED",A5ARSP]"":A5ARSP,1:""),!!
|
|
W "LINKS: "_$S(ESLNKS]"":ESLNKS_" // ",1:" // ") R ESLNKS:DTIME G:'$T!(ESLNKS="") ED1 I ESLNKS["?" D HLP2^YSESH S ESLNKS=LK G AD1
|
|
I A5ARSP="",ESLNKS'["0" D ERROR^YSESH G ED1
|
|
D ^YSESP S:EF=0 @(ESDBP_GN2_",2)")=A5ARSP_"^"_ESLNKS W:EF=1 !!,"****** NOTHING CHANGED ******",! K RF S ESLNKS=LK G ED1
|
|
G ED1
|
|
EDIT W !!,"Prompted Responses: ",$S(ESLNKS["[0]":" (THIS IS A GOAL NODE) ",1:"")_A5ARSP,!,"Defined Links: ",ESLNKS
|
|
I ESLNKS="" G ADD
|
|
EDT W !!,"Replace: " R ESJ:DTIME I '$T K A5ARSP S (ESLNKS,LK)="" G ED1
|
|
I ESLNKS="" D ADD G ED1
|
|
I ESJ="",LK=ESLNKS K A5ARSP S (ESLNKS,LK)="" G ED1
|
|
I ESJ="",ESLNKS'=LK D ^YSESP G:EF=0 SET I EF=1 W !!?15,"****** NOTHING CHANGED ******" K ER S ESLNKS=LK G ED1
|
|
I ESJ["?" D HLP2^YSESH G EDIT
|
|
I ESJ'["..." G:$F(ESLNKS,ESJ,1)>0 2 W $C(7)," ??" G EDIT
|
|
S ESJ=$P(ESJ,"..."),ESJ=$F(ESLNKS,ESJ,1) I ESJ=0 W $C(7)," ??" G EDIT
|
|
S ESJ=$F(ESLNKS,ESJ,1) I ESJ=0 W $C(7)," ??" G EDIT
|
|
1 S Y=$E(ESLNKS,ESJ,1) W !,"With: " R Y1:DTIME G:'$T!(Y1="") ED1 I Y1["?" D HLP3^YSESH G 1
|
|
S ESLNKS=Y_Y1 D ^YSESP I EF=1 W !!,"****** NOTHING CHANGED ******",! K EF S ESLNKS=LK G EDIT
|
|
W !!,"New Defined Links: ",ESLNKS G EDT
|
|
2 S Y1=$P(ESLNKS,ESJ),Y3=$E(ESLNKS,$F(ESLNKS,ESJ,1),99)
|
|
A2 W !,"With: " R Y2:DTIME G:'$T!(Y2="") ED1 I Y2["?" D HLP3^YSESH G A2
|
|
S ESLNKS=Y1_Y2_Y3 W !!,"New Links: ",ESLNKS G EDT
|
|
END K K,Y1,Y2,Y3,Z,ESK,ESLNKS,LK,ND S ESI="" D POP Q
|