All your base are belong to us                 Monk Functions Page

This page provides links to Monk Functions written/modified by Datagate/e*Gate users and contributed freely to this site.  All functions can be considered open source.  Use of these functions in a production environment is at the user's risk.


Current Offerings

    Name                                        Description
get-middle-initial.monk Monk function that will return the middle initial from a string formatted as "LAST,FIRST M".  This function differs from the standard get-middle-name.monk function (standard with Datagate) in that it returns nothing if there is no middle initial (rather than an error).  It also returns nothing if the middle initial is greater than 1 character.
capitals.monk Modified version of STC's "capitalize.monk" which converts a given string to one with only the initial characters of each word 
capitalized. e.g. "JOHN SMITH" or "john smith" becomes "John Smith". Note that if used for proper names it will not handle 
cases like "McDonald" or "de Vries" properly.  Contributed by Richard Sheppard, HelathLink Clinical Data Network, Toronto, Ontario.
cc-get-field.monk This is a custom monk function that returns a field from a string where the string is a set of delimited fields.  It's handy for parsing 
HL7 segments, particularly in IDs, where we try to keep the message structures as simple as possible.  The "cc" prefix is how we distinguish our Christiana Care custom monk functions from the others.  Contributed by Dave Perry, Christiana Care 

Example: 

  (cc-get-field "PERRY^DAVID^C^MR^MD" 2 "^") => "DAVID" 
 

get-suffix.monk In a name formatted as "Jones Jr" or "St Claire Sr", this function returns the generational suffix.  If the string does not have suffix an empty string is returned.  Its complex enough to work correctly for the string "St Claire", where "Claire" is not a suffix.  Contributed by Louisa Jones of Riverside Health System in Southeastern Virginia
strip-suffix.monk In a name formatted as "Jones Jr" or "St Claire Sr", this function returns the last name without the suffix.  Contributed by Louisa Jones of Riverside Health System in Southeastern Virginia
hl-find-get-after.monk Returns the remainder of <source> string after given <substring> pattern.  Contributed by Richard Sheppard, HealthLink Clinical Data Network, Toronto, Ontario.
string-search-all.monk
string-search-all.txt
Monk version of the Scheme function which returns a list of indexes of occurrences of a given pattern in a string or '() [the empty list] if the string does not contain the pattern.  e.g.: (string-search-all "rat" "pirate rations")   returns (2 7) 
e.g.: (string-search-all "i" "Mississippi")   returns (1 4 7 10)  Contributed by Richard Sheppard, HealthLink Clinical Data Network, Toronto, Ontario. 

string-search-all.txt is the README file

insert-commas.monk This monk function will return the string with commas in the appropriate place. It will also ensure there are only two decimal places.  To use it just do the following:

     (let ((total ""))
        (set! total (insert-commas ~input%your_number))
     )

     ex. 100000000 becomes 100,000,000.00
     ex. 100000000.7 becomes 100,000,000.70
     ex. 100000000.14 becomes 100,000,000.14
     ex. 100000000.780000 becomes 100,000,000.78

Contributed by Roger Baxley of HypoVereinsbank, New York, NY

home