Just picking up on this:

“For example, if I write for a drug called Amoxicillin, 1 pill 3 times per day, 
and I give 21 pills, that should last 7 days from today.”


What happens if the prescription is written late in the afternoon? Do you 
expect all three doses to be taken that day?
If it’s very late will the course be started that day or the next?

If that’s not a problem then forgive me for butting in but you might need to 
take account of some time “options”.


Also:

I’m not sure that I follow what you did in v6.5 but regardless of version it 
sounds to me that you ought to have table columns for the number of pills and 
the number of times per day with – if you really need it - a calculated column 
for the number of days that should last.
Even better, you should be able to create your form in such a way that you can 
enter any two values and calculate the third. You would only _need_ to save two 
of them as you can always calculate the third when required.
Again, forgive me if I’ve got the wrong end of the stick – it wouldn’t be the 
first time.

Regards,
Alastair.



From: William Stacy 
Sent: Tuesday, August 23, 2011 5:51 PM
To: RBASE-L Mailing List 
Subject: [RBASE-L] - Re: Forms in 6.5 vs 7.6 and 9.1

actually, on further reflection, your question really is just simple math that 
doesn't need to be connected to any particular drug information, so long as 
you're willing to input the dosage, frequency of dosage, number of doses in the 
dispensing container, and a simple math formula to compute the # of days the 
container will last.  this is more like a "gadget" than a database item, 
although it could link to drug database files for populating some or all of the 
items.


On Tue, Aug 23, 2011 at 7:06 AM, William Stacy <[email protected]> 
wrote:

  I'd try to simplify your system.  I have a simple drug table that has just 5 
columns:

  dn is an autonumbered integer that unequivocally locates a specific drug
  dln is an integer that links to a lookup table which specifies the general 
type of drug (Rx, OTC, substance, dietary supplement, etc.)
  bname is a text field that represents brand name, if any
  gname is a text field that represents generic name, if any
  dname is a computed text column that I use to look up individual drugs.  the 
expression for that column is:  (ifeq(bname, null, gname, bname 
&('('+gname+')'))

  gname yields such things as :   Amoxil (amoxicillin),  aspirin, Lipitor  
(where, respectively, bname and gname are not null, bname is null, and gname is 
null.

  I use the gname values for all drug lookups, including printing the drug name 
on the Rx and have found no need for drug nicknames, abbreviations etc, as the 
simple lookup is like:  where dname contains .t where t is any string such as 
'amox', which returns several dnames from which a selection is made where 
t2=dname

  then I have a couple of child tables for things such as quan, freq, etc.all 
of which refer to the parent drug table by dn only.  

  In your case, one of these child tables would have, in addition to the dn, a 
freq column (integer), a frequnits (text)  column,  a quan (int) column, a 
quanunits (text) column, and a days column (int or real) that would give you 
the answer.

  example: freq=3  frequnits='hours' quan=1 quanunits='capsules'  from which 
days would be calculated (I don't have time this morning to work a formula, but 
will do it later today)

  Bill 




  On Sun, Aug 21, 2011 at 9:15 PM, Michael J. Sinclair <[email protected]> 
wrote:

    Hi All,
    I need a little help in understanding how to convert a form from version 
6.5 to 7.6 or 9.1

    I am trying to write perscriptsions with as little typing as possible

    I also want Rbase to try to figure out how long a perscription will  last 
if taken correctly.

    For example, if I write for a drug called Amoxicillin, 1 pill 3 times per 
day, and I give 21 pills, that should last 7 days from today.

    So...

    I have a table that has abreviations (shortcut) matched to long names 
(drugname).

    In this case, the abreviation (I called the column SHORTCUT) is 'AMO' and 
the Drug Name (I called that column drugname) is 'Amoxicillin'.

    Also....

    I have a look up table that matches up phrases with "rates of use per day"

    In this case, the phrase is "3 times per day" and the rate of use (in pills 
per day) is the number 3.

    In this lookup table, I call the first column (the phrase) FREQ (short for 
frequency) and the second column freqnumb (short for frequency number)

    So, if I have not lost you yet...

    In Rbase 6.5, the form has a section for variables, very similar to the 
variable section in 7.7 and 9.1
    What worked for me then (not sure if this was the right way to do it), in 
the variable section, I had 

    column names = expression

    for example, I had these expressions...

    drugname = drugname IN scripts WHERE shortcut = .vshortcut 
    freq = freq IN drugfreq WHERE drugname CONTAINS .vshortcut
    freqnumb = freqnumb IN drugfreq WHERE freq = freq

    There were similar lookups for the refill number, the quantity of pills, etc

    These expressions filled the columns with values.

    Now, in Rbase 7.6 and 9.1, I have much more flexibility with component IDs.

    My thought was to eliminate the expressions, which never made much sense to 
me since I was using expressions to give data to columns rather than to 
variables, and the section was called VARIABLES.

    So, on the field for the abreviation, I have an "ON Exit EEP"
    This is part of my code for the "On Exit EEP", exiting from the field where 
I typed the abreviation (aka shortcut)

    --on exit eep
    --look up the drugname, frequency, quantity, refill numbers etc and 
calculate how long the script should last 

    SET V vshorcut_old TEXT 
    SET V vshortcut1 TEXT
    GETPROPERTY shortcut textvalue vshortcut1
    SET EQNULL ON
    --make no changes unless the shortcut has been changed
    IF vshortcut_old <> .vshortcut1 THEN
      SET V +
      vdrugname = drugname, +
      vfreq = freq, +
      vduration = duration, +
      vdruginst = druginst, +
      vquant = quant, +
      vrefills = refills, +
      vacuteflg = acuteflg, +
      vitemflag = itemflag, +
      vdurdefault = duration_default, +
      vspeccomm = speccomm, +
      IN scripts WHERE drugname CONTAINS .vshortcut1

      --get numerical values from the text data that is part of the 
perscription, the data is in several look up tables
      SET V vfreqnumb = freqnumb IN drugfreq WHERE freq = .vfreq
      SET V vquantnum = quantnum IN drugquant WHERE quant = .vquant
      SET V vdurnumb = durnumb IN drugdur WHERE duration = .vduration
      SET V vrefnumb = refnumb IN drugrefs WHERE refills = .vrefills

      --now update all the column values from the above varialbles
      PROPERTY namedose textvalue .vnamedose
      PROPERTY freq textvalue .vfreq
      PROPERTY freqnumb textvalue .vfreqnumb
      PROPERTY DURATION textvalue .vduration
      PROPERTY druginst textvalue .vdruginst
      PROPERTY quant textvalue .vquant
      PROPERTY quantnum textvalue .vquantnum
      PROPERTY refills textvalue .vrefills
      PROPERTY acuteflg textvalue .vacuteflg
      PROPERTY itemflag textvalue .vitemflag
      PROPERTY duration_default textvalue .vdurdefault
      PROPERTY durnumb textvalue .vdurnumb
      PROPERTY refnumb textvalue .vrefnumb
      PROPERTY speccomm textvalue .vspeccomm
    ENDIF
    SET EQNULL OFF
    LABEL END
    RETURN

    Seems pretty simple, but none of my column names are getting updated until 
after I save the row.
    What happens, some of my rules for the table get violated because there is 
missing data for some of the dependent columns.
    I can make it work by using the same expressions I used in Rbase 6.5, but I 
am trying to impove my coding "skill", or lack there of.

    What is the right way to update the colums using expressions and data 
obtained from lookup tables?
    When does the PROPERTY command take effect? only after I save the row, or 
after the cursor leaves the row?

    Sorry to be soooo long winded....but I really don't know how to break down 
my issue any smaller.

    Thanks for reading
    Mike








  -- 
  William Stacy, O.D.

  Please visit my website by clicking on : 

  http://www.folsomeye.net







-- 
William Stacy, O.D.

Please visit my website by clicking on : 

http://www.folsomeye.net



Reply via email to