Query on max lengths changes

I am doing a tweak (adjust act.patientMedication to include the label text in the description) that required extending the length of the description field beyond 255 characters to say 500 characters.

Am I correct in thinking that two changes are required: 1) change the act.patientMedication archetype to inclease the max length of the description field; 2) alter the size of the description column in the acts table from 255 to say 500 characters.

I have done the above (the 2nd using "alter table acts modify column description varchar(500) null;").

This seems to be working - ie the Medical Records screen now shows (after modifying the act.patientMedication archetype to get the label text included in the description):

Q1: Is this increase in the acts description column going to cause any problems I have not found yet? [I am concerned that 255 max length is so common in the system that there are bits in the code that assume strings are in general no more than 255 characters.]

Q2: although I have used "alter table .. modify column ..." to do the testing, for my conversion runs (which completely rebuild the database), I plan to simply edit the db.sql file to increase the column size to 500.  This is correct isn't it?

Regards, Tim G

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Query on max lengths changes

It should work, although you can probably avoid doing this by changing how medications display rather than changing the database.

There is a configuration file named IMObjectTableModelFactory.xml in the openvpms-web-workspaces jar that can be changed to alter the display. Note that you'll need to unzip/rezip the jar in order to do this.

Current contents are:

     <handler>
        <type>org.openvpms.web.workspace.patient.history.PatientHistoryTableModel</type>
        <properties>
            <entry>
                <string>expressions</string>
                <java.util.Map>
                    <entry>
                        <string>act.patientClinicalEvent</string>
                        <string>/description</string>
                    </entry>
                    <entry>
                        <string>act.patientClinicalProblem</string>
                        <string>/description</string>
                    </entry>
                    <entry>
                        <string>act.patientClinicalNote</string>
                        <string>/details/note</string>
                    </entry>
                    <entry>
                        <string>act.patientInvestigation</string>
                        <string>concat(openvpms:get(.,'investigationType.entity.name')," - Request No: ",/id," - ",
                            /description, " [", openvpms:lookup(.,"status"), "]")
                        </string>
                    </entry>
                    <entry>
                        <string>act.patientMedication</string>
                        <string>/description</string>
                    </entry>
                </java.util.Map>
            </entry>
        </properties>
    </handler> 

You'd need to change the act.patientMedication entry. E.g.:

<entry>
                        <string>act.patientMedication</string>
                        <string>concat(/description, ' ', /details/label)</string>
                    </entry>

-Tim A

Re: Query on max lengths changes

Tim - thanks for this - works a treat. I ended up using:

 <string>concat(/description, ' ',expr:if(boolean(/details/label),concat('&#10;',/details/label,'&#10;'),''))</string> 

to format the label onto its own lines.

Regards, Tim G

Syndicate content