Saturday, September 21, 2013

Email with attachments to ECM

Some vendors will want to create invoices or patient information in electronic form, such as PDF. They will want a email address to send it to as an attachment. There are many aspects to consider when automating the processing of email with attachments:

  • Setting up the email account (who has access, gets notifications, what listener to set up)
  • Rules for routing the email based on subject content, from address, body of the email
  • Whether or not to store the email body
  • Determining the attachment's contents: one page per attachment, all together? Different PO's in one batch?
  • Whether to split up the attachment
  • Classification of the attachment: who is it from?
  • OCR of email body and attachment(s)
  • Advanced capture on the attachment to automatically index the page based on PO# for example
For each of the above aspects there are many finer details, but it is clear that this type of interchange of information is not ideal. For one, it would be better to setup a formatted xml file which describes all of the attachments, their PO# or Account#, the basic metadata of each file such as invoice number, total amount, vendor name, or for healthcare MRN, Patient Name, date of birth, etc. There's room for improvement and eventually this type of communication will be much accurate. 

Sunday, September 8, 2013

OnBase Unity Script to Export an Image

Link to other Onbase Scripts

Writing a script in VB or C# for OnBase is not hard once you take API course or you get you hands on the SDK for OnBase. I had neither the first time I wrote a VBScript to export a file from OnBase. I read through some samples and fumbled my way through only to realize that the script I wrote could only export the first page of an image which multiple pages appended to it. So here's a basic Unity script written in C# which will export the whole file from a workflow action to a local drive. Enjoy!

namespace SaveToFile
{
    using System;
    using System.Text;
    using Hyland.Unity;
    using Hyland.Unity.Workflow;
    
    
    ///





    /// Save a file to disk
    ///
    public class SaveToFile : Hyland.Unity.IWorkflowScript
    {
        
        #region IWorkflowScript
        ///





        /// Implementation of .
        ///
        ///
        ///
        ///
        public void OnWorkflowScriptExecute(Hyland.Unity.Application app, Hyland.Unity.WorkflowEventArgs args)
        {
            // Add Code Here
try{
string dirPath = @"c:\Temp\" + args.Document.ID + ".";

//create doc
Document wfdoc = args.Document;


//Redition
Rendition wfrend = wfdoc.DefaultRenditionOfLatestRevision;

//PageData
//using for the disposal
//PDF for the format

using (PageData wfPageData = app.Core.Retrieval.PDF.GetDocument(wfrend))
{
//Utility to write data page stream
Utility.WriteStreamToFile(wfPageData.Stream, dirPath + wfPageData.Extension);
}
}
catch(UnityAPIException Uex)
{
app.Diagnostics.Write(Uex.Message);
}
catch(Exception ex)
{
app.Diagnostics.Write(ex.Message);
}

        }
        #endregion
    }
}