PK.CLINICAL.NOTES
A^prefix,
B^cats,
@OPEN.NUR,
@PATS,
END;

OPEN.NUR
@misdir,
O(&,@misdict),
@admdir,
O(:,@admdata),
@nurdir,
O(*,@nurdata),
O(\,@nurdict),
@pkdir

PATS
/ARGV[1]^DT,
2^nr,
DO{nr</ARGC 1,
   /ARGV[nr]^ACT,
   :AAAI[ACT]^aa,
   @NOTES,
   nr+1^nr}

NOTES
DO{@NEXT.NOTE IF{*NOTE[aa]N[note]TU!(('/CONF[cats]["all"])&('/CONF[cats][*NOTE[aa]N[note]|3])) 1;@SEND}}

NEXT.NOTE
+(*NOTE[aa]N[note],XX)^note

SEND
IF{"check rx enter date against date from pk",
   ;XX|4<DT;
   "<Document>"^!,
   "<InstanceMnemonic>"_prefix_aa_"-"_note_"</InstanceMnemonic>"^!,
   IF{-(*NOTE[aa]N[note]TA[""],YY)^AMEND YY|0_YY|1;XX|0_XX|1}^UPD,
   "append x to key because t0 may be empty",
   "<Key>"_"x"_UPD_"</Key>"^!,
   "<PersonMnemonic>"_:AA[aa]|3_"</PersonMnemonic>"^!,
   "<EventEndDateTime>"_*NOTE[aa]N[note]|0_"</EventEndDateTime>"^!,
   "<EventSetMnemonic>NURSE</EventSetMnemonic>"^!,
   "</Document>"^!}
