concepts are not showing on saved forms

Hello all, I have updated OpenMRS from 2.3 to 2.5. I was faced by the following problem:

OpenMRS is showing concepts on saved forms as numbers not names. For example for coded concepts like DOES PATIENT HAVE RASH The answers on the form before saving it were : yes , no , unknown Once you select one answer and go to patient dashboard to review the information, it will look like this DOES PATIENT HAVE RASH: # concept 1234 Instead of DOES PATIENT HAVE RASH: No

in other words, openmrs won’t show the concept name on saved forms but rather concept # as an answer. Do u have an idea what is going on here.

Thanks all

Can you share a screenshot with this problem?

My recollection is that typically this happens when there is an underlying exception trying to retrieve Concept Names for a Concept (usually use to a Hibernate Lazy Loading error or similar), and the fallback behavior when all else fails is to use the toString() method,

Are there any errors or warnings being logged that might indicate the underlying error that is causing this?

Also, sometimes restarting the server helps with this (though I know that isn’t an adequate solution). Any chance that fixes things?

Mike

Thanks @dkayiwa and @mseaton

This is a screenshot before saving the form

This is a screen shot after saving the form

Please note the following:

In other words, we have added this “displayWithHtmlForm”: true

I have created another encounter without “displayWithHtmlForm”: true , the concepts was displayed fine on the saved forms. However, we cannot remove “displayWithHtmlForm”: true as we have 100s of forms designed using this feature.

Restarting the server didnt solve the issue I will clear all logs tonight and attach error logs. However, no apparent errors there

Any advice is highly appreciated.

Hello @dkayiwa and @mseaton here is the complete logs

http://pastebin.com/cpYq0Em3

http://pastebin.com/zpGum1Nm

Please let me know

Sounds like this may be the same issue as this (read the full comment change):

Yes @mogoodrich that is exactly it. Anyone is working on it now ?

I appreciate your help

@yadamz are you able to reproduce this when you replace your war file with the one of platform 2.0.4?

I will try @dkayiwa and let you know

@dkayiwa it is the same result with 2.0.4 . I was able to reproduce the same result

@yadamz to get a log that is specific to this, you could remove all log contents just before u load the form, such that it clear all startup messages and errors caused by other things. Once you confirm that the log is clean, then you click the link which loads the form. Then new log contents will be created that are specifically to do with this.

Hi Everyone,

I created a new HTML form with the following code:

<htmlform>
<!-- Autogenerated example form  (template from 01-Nov-2010 -->
<macros>
	paperFormId = (Fill this in)
	headerColor =#009d8e
	fontOnHeaderColor = white
</macros>

<style>
	.section {
		border: 1px solid $headerColor;
		padding: 2px;
		text-align: left;
		margin-bottom: 1em;
	}
	.sectionHeader {
		background-color: $headerColor;
		color: $fontOnHeaderColor;
		display: block;
		padding: 2px;
		font-weight: bold;
	}
	table.baseline-aligned td {
		vertical-align: baseline;
	}
</style>

<span style="float:right">Paper Form ID: $paperFormId</span>
<h2>test form (v1.0)</h2>

<section headerLabel="1. Encounter Details">
	<table class="baseline-aligned">
		<tr>
			<td>Date:</td>
			<td><encounterDate default="today"/></td>
		</tr>
		<tr>
			<td>Location:</td>
			<td><encounterLocation/></td>
		</tr>
		<tr>
			<td>Provider:</td>
			<td><encounterProvider/></td>
		</tr>
	</table>
</section>

<section>
<obs conceptId="300"/>
</section>

<submit/>

I change the log level to debug and refreshed the page (http://127.0.0.1:8080/openmrs/module/htmlformentry/htmlFormEntry.form?encounterId=9) in the legacy UI. Here’s the catalina.out for just the refresh period.

In the example above, I stripped down the just to the conceptId=“300” for simplicity.

@craigappl do you think you can reproduce this on qa-refapp.openmrs.org?

Thanks @dkayiwa It’s reproduced at: http://qa-refapp.openmrs.org/openmrs/module/htmlformentry/htmlFormEntry.form?encounterId=7496

PatientID: 102TKR EncounterType: Check In Form Name: Test - no view form (in the current visit action in the reference app)

I did notice that the “edit” pencil pops up next to the reference app vitals form in the visits dashboard, but not this test form.

@craigappl that was very helpful for me to locally reproduce. :slight_smile:

This line used to return just the concept id before platform 2.x https://github.com/openmrs/openmrs-module-htmlformentry/blob/3.3.1/api/src/main/java/org/openmrs/module/htmlformentry/widget/SingleOptionWidget.java#L32 Which played very well with this: https://github.com/openmrs/openmrs-module-htmlformentry/blob/master/api/src/main/java/org/openmrs/module/htmlformentry/widget/DropdownWidget.java#L34 as it could find a label with a matching concept id.

When platform 2.x changed from: https://github.com/openmrs/openmrs-core/blob/1.12.x/api/src/main/java/org/openmrs/Concept.java#L1649 to this: https://github.com/openmrs/openmrs-core/blob/2.0.x/api/src/main/java/org/openmrs/Concept.java#L1447 the drop down widget could no longer find the appropriate label because it now for instance has “Concept #696” instead of just “696”

My proposed fix is this: https://github.com/openmrs/openmrs-module-htmlformentry/commit/711a2a4f0beabbf5f6f70bdcfbe64689b82f3215

I built the module with this commit and confirm that this commit fixes the issue on both situations: I verified this in both edit and view modes in the Legacy UI and the Reference App UI.

FYI @jmaxy, @jamesfeshner @guerschon

@yadamz, you can build the htmlformentry module from source and install it in your environment to pull in Daniel’s change.

This is amazing @craigappl and @dkayiwa . Just to make sure that I am getting the correct one. Do you mind posting the link to the source I should get. I appreciate your help

Yes, you should build

Craig

Hello @craigappl and @dkayiwa , The initial problem above was not fully resolved. I used getField function to retrieve a concept (coded concept) value. The concept ID was retrieved but not the concept name. I am now using the latest snapshot of HTML Form Entry 3.4.