Updrading to CPS to 12.2 or EMR 9.10

When upgrading your Centricity platform, the Blackbird Framework will require a couple of changes.  For those of you who invoke the framework with the standard quicktext macros, the update will be very easy.
  1. First, you will need to install an updated clinical kit in your Centricity Environment.
    It is located here: http://blackbirdsolutions.com/?p=650
  2. Second: If you have custom quicktext macros or custom buttons on custom forms, the URLs will need to be changed for those calls to SHOW_HTML_FORM()
Here are some examples of the differences in the URL format. Effectively, what we have done is removed the reference to the redirect form on the JBoss server.
Only deploy these changes at the time of the upgrade:
Navigate to the summary view (default invocation)
OLD: {show_html_form("//localserver/EncounterForms/BBS_EFS/BBS_redirect.html","Blackbird Clinical Framework")}
NEW: {show_html_form("http://content.blackbirdsolutions.com/bbs_efs#/lists/all","Blackbird Content Framework")}
Navigate to specific clinical list views in the patient chart
OLD: {show_html_form("//localserver/EncounterForms/BBS_EFS/BBS_redirect.html?navigateTo=problems","Blackbird Clinical Framework")}
NEW:{show_html_form("http://content.blackbirdsolutions.com/bbs_efs#/lists/problems","Blackbird Content Framework")}
OLD: {show_html_form("//localserver/EncounterForms/BBS_EFS/BBS_redirect.html?navigateTo=medications","Blackbird Clinical Framework")}
NEW: {show_html_form("http://content.blackbirdsolutions.com/bbs_efs#/lists/medications","Blackbird Content Framework")}
OLD: {show_html_form("//localserver/EncounterForms/BBS_EFS/BBS_redirect.html?navigateTo=allergies","Blackbird Clinical Framework")}
NEW: {show_html_form("http://content.blackbirdsolutions.com/bbs_efs#/lists/allergies","Blackbird Content Framework")}
OLD: {show_html_form("//localserver/EncounterForms/BBS_EFS/BBS_redirect.html?navigateTo=directives","Blackbird Clinical Framework")}
NEW: {show_html_form("http://content.blackbirdsolutions.com/bbs_efs#/lists/directives","Blackbird Content Framework")}
OLD: {show_html_form("//localserver/EncounterForms/BBS_EFS/BBS_redirect.html?navigateTo=orders","Blackbird Clinical Framework")}
NEW: {show_html_form("http://content.blackbirdsolutions.com/bbs_efs#/lists/orders","Blackbird Content Framework")}
Navigate directly to the problem search dialog
OLD: {show_html_form("//localserver/EncounterForms/BBS_EFS/BBS_redirect.html?navigateTo=addProblemDialog","Blackbird Clinical Framework")} NEW:{show_html_form("http://content.blackbirdsolutions.com/bbs_efs#/lists/problems?addProblem=true","Blackbird Content Framework")}
Navigate directly to a search for a specific problem string
OLD: {show_html_form("//localserver/EncounterForms/BBS_EFS/BBS_redirect.html?searchTerm=asthma","Blackbird Clinical Framework")} NEW: {show_html_form("http://content.blackbirdsolutions.com/bbs_efs#/lists/problems?addProblem=true&searchTerm=asthma","Blackbird Content Framework")}
OLD: {show_html_form("//localserver/EncounterForms/BBS_EFS/BBS_redirect.html?searchTerm=sinusitis, acute","Blackbird Clinical Framework")}
NEW:{show_html_form("http://content.blackbirdsolutions.com/bbs_efs#/lists/problems?addProblem=true&searchTerm=sinusitis, acute","Blackbird Content Framework")}

HTML | MEL dll registration

Occasionally, installing CPS or EMR will result in a key ActiveX control not being correctly registered on the workstation. This generally manifests itself with the Blackbird Framework appearing to have no content in the HTML window.

Usually, this can be fixed with a one-time command line procedure.

Recipe to register DLL for Single User Training:

  1. First run cmd as administrator
  2. Then cd into the Centrcity client folder:
  3. Identify the name of the DLL to be registered. The name should end with .if.dll
    CPS and EMR typically have different file names to be registered.
  4. Register the control using regsvr32
    c:\windows\syswow64\regsvr32 ge.emr.cps.msg.if.dll
  5. reboot and try again.

Converting between dates and IDs in CPS/EMR

Occasionally, you need to retrieve date fields that don’t look like dates. The most common example in CPS is the clinicaldate field in the document table.

There are formulae for converting between these IDs and their corresponding dates.

Here is an example query that shows how to retrieve the clinicaldate as a real date as well as showing how to convert the DB_CREATE_DATE to an ID format.

dbo.Convert_ID_to_date() and dbo.Convert_Date_to_ID()

SELECT ClinicalDate, dbo.Convert_ID_to_date(clinicaldate) theDate,
DB_CREATE_DATE, dbo.Convert_Date_to_ID(DB_CREATE_DATE) theID
FROM document
WHERE PID = 1225794115001060;


In case you haven’t noticed, the CPS and EMR demo systems have pretty easy default passwords. Oddly, if an account gets locked or the password expires, there isn’t an easy way to get a password less than 6 characters into the user management system.

You don’t have to be able to decode the passwords in the DoctorFacility table to set the password of a user. The following statement will set hwinston’s password to ‘asdf’

update DoctorFacility set LoginAttempts = 0, password = 'ZjBlNGMyZjc2YzU4OTE2ZWMyNThmMjQ2ODUxYmVhMDkxZDE0ZDQyNDdhMmZjM2UxODY5NDQ2MWIxODE2ZTEzYg==' 
where LoginUser = 'hwinston'

Encounter form tabs all mixed up?

Occasionally after a long time running the EMR or CPS and many, many imports of encounter forms, something happens where errors begin to occur during the process of importing encounter forms.

When bringing up forms that show these errors on import, the tabs may be out of synch. Sometimes, tabs appear form other forms and sometimes they are just out of order.

The solution is a bit of a trick and has to do with resynching the id generation for form components:

Begin Tran
declare @maxfid varchar(10)
select @maxfid = dbo.maxfid()
update dbo.uniqueid set fid = @maxfid where FID <> @maxfid

Compatibility View and CPS

The Blackbird Content Framework works best when using the latest version of IE on your workstation.

Meanwhile, CPS requires version 9 or greater to run.  Unfortunately, the CPS application doesn’t seem to know that 11 is greater than 9.

As a result, you may see this message when starting CPS:

CPS-IE-VersionThe workaround, is to tell CPS that the version of IE it is using is older than IE 11. To do so, click on the gear icon in the IE address bar; select “Compatibility View settings”.

CompatibilitySettingsAfter opening the Compatibility View Settings Dialog, add localhost, or the host name or IP address of the server that you are using to launch CPS.


Unfortunately, this must be done on a per-user basis. At any rate, after updating this setting, all should be well.

Fixing a Troublesome Document

As a Centricity content developer, I sometimes find myself in a situation where a Centricity document is in a state that will not allow it to be opened again. These documents are sometimes called dead documents. If they they cause the chart to not behave properly or cause CPS or EMR to crash when opened, I have heard the term “Poison Documents”

So these steps will remedy the situation:

Your first task is to find the document that is dead; you may be able to see the visdocid from the Centricity UI. If so, you can look it up that way; if not, you need to find the document via the PID or some other method.

 FROM [demo].[dbo].[DOCUMENT] where PID = (Select PatientProfile.PID From [PatientProfile] where First ='Gabriele' and Last = 'Oberheim') order by DB_UPDATED_DATE DESC

Once you have found the document, you can make changes to the database to fix it. One thing you might need to do, depending on what the behavior is in the document, is to neutralize bad acting MEL code that is part of the update. Do this by changing HOLDTEXT and NOTETEXT so that it contains short, vanilla RTF.

update DOCUMENT set HOLDTEXT='{\rtf1\ansi\ftnbj{\fonttbl{\f0 \fswiss Arial;}}', NOTETEXT='{\rtf1\ansi\ftnbj{\fonttbl{\f0 \fswiss Arial;}}' where SDID = '0000000000000000'

The next thing to do is to eliminate the locks on the document which you will need to do to open it back up in the Centricity application so that you can end the update.

delete from LOGLOCKS where SDID = '0000000000000000' 

And there you have it.

Getting a Unique ID in CPS

In certain instances, you may find that theere is a defect in LinkLogic, or you may have another reason for doing this, but for what it’s worth, there may come a time when you need to insert a row into a Centricity database that has a unique ID field.

There is a built-in stored procedure that performs the task, but it takes an input parameter, which can make it tricky to call. You can either create a wrapper function for the procedure that declares an input parameter and returns the value or you can copy the code and remove the params altogether.

I have taken the second approach so that you can see the logic of the full procedure.

/****** Object:  StoredProcedure [dbo].[CUSTOMgetUniqueEMRID]    Script Date: 05/05/2013 23:05:12 ******/
-- CUSTOM_getUniqueEMRID
-- returns a generated emrid as numeric(19,0)
-- NOTE: dependent on emridcontrol table being setup and setupEMRIDControl having been called
CREATE procedure [dbo].[CUSTOM_getUniqueEMRID]

     declare @theID numeric(19,0)
     declare @theOffset numeric(19,0)
     declare @theLastID numeric(19,0), @theWSID numeric(19,0)
     declare emridcontrolcursor cursor forward_only for
     select lastid,wsid from dbo.emridcontrol for update of lastid
     set @theID=0
     set @theOffset=50000

open emridcontrolcursor
fetch next from emridcontrolcursor
     into @theLastID, @theWSID

if @@fetch_status = 0
          set @theID = dbo.convert_date_to_id(getdate()) + @theWSID
          if @theID <=@theLastID
               set @theID = @theLastID+@theOffset
          update dbo.emridcontrol set LastID=@theID
     RAISERROR('unable to read emridcontrol table',10,1)

close emridcontrolcursor
deallocate emridcontrolcursor
select @theID as getUniqueEMRID

MEL Data Symbols 201: Scoring items using getarg and getnargs

It’s not uncommon to want a form component to have the ability to do some scoring.  The scoring might be some kind of risk factors thing; PHQ-9, Falls, and Drug and Alcohol (DAST) screenings are just a few examples.

Sometimes the scoring is a one-to-one relationship where each question is responsible for a point and other times  the scoring might have many-to-one relationship where multiple questions could be responsible for the same point.  In either instance you can use getarg and getnargs within your loop but it’s particularly useful when you’d like to utilize the same fn to do many-to-one style calculations or anytime you’d like to use a function multiple times with varying numbers of arguments.

This is an example form:

This is what the scoring code looks like: