tag:blogger.com,1999:blog-85682038527776413492024-03-14T08:18:57.109-07:00Computers and AutomobilesAnonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-8568203852777641349.post-40751194996741439982017-08-21T10:52:00.001-07:002017-08-21T10:52:39.225-07:00Refining and Working on Demo.As i've finished all the objectives listed in the project site, this period is used to do refinements and creating the final demo of the project.<br />
<br />
I've given all the information on building and running the product in the previous post.<br />
<br />
<b>Github Repos</b><br />
<b><br /></b>
I've forked all three repositories that were required to register and test an Unknown patient.<br />
But developing on the master branch of each repo seems to be useless as Openmrs barely support any backward compatibility.<br />
If i were to develop the platform using the master branch, it would not be compatible with the modules.<br />
Therefore, my approach was to develop using the versions that are available on the downloads page, so that they are confirmed compatible with each other.<br />
However, i still needs to talk further about this with my mentor.<br />
<br />
When develop using a version other than the master branch, i've selected the tag releases. This caused me a serious problem at the end since i can't push any changes to a tag branch.<br />
Sincere there were not much of a choice left to me, i've created a branch in each repository starting<br />
<b>b-<version></b><br />
For now, you have to refer to this branch in Core, RegistrationApp and RegistrationCore modules.<br />
<br />
I'll update the blog once the demo video is done.<br />
<b><br /></b>
<br />Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-36654929896524810142017-08-15T12:14:00.001-07:002017-08-15T12:14:54.599-07:00Up and RunningI have completed movingthe functionality to core. And altered registration appa dn registration core modules to function with that.<br />
<br />
Here are the instructions to test the priject<br />
<br />
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;">
Please follow the instructions to build and run the project.</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;">
1. Platform</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;">
Repo - <a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://github.com/nipunthathsara/openmrs-core/tree/b-2.0.5&source=gmail&ust=1502910879358000&usg=AFQjCNHAt_dLUQbqVm6pgoifpzkhUJJIJg" href="https://github.com/nipunthathsara/openmrs-core/tree/b-2.0.5" style="color: #1155cc;" target="_blank">https://github.com/<wbr></wbr>nipunthathsara/openmrs-core/<wbr></wbr>tree/b-2.0.5</a> </div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;">
Clone: <b>git clone <a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://github.com/nipunthathsara/openmrs-core.git&source=gmail&ust=1502910879358000&usg=AFQjCNFrb9a6nOPzkUOxk9FhDrT2jIcG8g" href="https://github.com/nipunthathsara/openmrs-core.git" style="color: #1155cc;" target="_blank">https://github.com/<wbr></wbr>nipunthathsara/openmrs-core.<wbr></wbr>git</a></b></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;">
Checkout branch: <b>git checkout b-2.0,5</b></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;">
Build: <b>mvn clean install -U -DskipTests</b> (Build core first and update your .m2 to build other modules)</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;">
<div>
2. RegistrationCore module</div>
<div>
Repo - <a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://github.com/nipunthathsara/openmrs-module-registrationcore/tree/b-1.7.1&source=gmail&ust=1502910879358000&usg=AFQjCNGB3N4O2nQyd1hok0qj-TCrUMqJPg" href="https://github.com/nipunthathsara/openmrs-module-registrationcore/tree/b-1.7.1" style="color: #1155cc;" target="_blank">https://github.com/<wbr></wbr>nipunthathsara/openmrs-module-<wbr></wbr>registrationcore/tree/b-1.7.1</a></div>
<div>
Clone: <b>git clone <a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://github.com/nipunthathsara/openmrs-module-registrationcore.git&source=gmail&ust=1502910879358000&usg=AFQjCNH1FjtAQk-C2qKWTR-6wdrc-orpYg" href="https://github.com/nipunthathsara/openmrs-module-registrationcore.git" style="color: #1155cc;" target="_blank">https://github.com/<wbr></wbr>nipunthathsara/openmrs-module-<wbr></wbr>registrationcore.git</a></b></div>
<div>
Checkout branch: <b>git checkout b-1.7.1</b></div>
<div>
Build: <b>mvn clean install -DskipTests</b></div>
<div>
<b><br /></b></div>
<div>
3. RegistrationApp module</div>
<div>
Repo: <a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://github.com/nipunthathsara/openmrs-module-registrationapp/tree/b-1.8.0&source=gmail&ust=1502910879358000&usg=AFQjCNHeJo6c4aNNmV8YLQD351EqiqP8FQ" href="https://github.com/nipunthathsara/openmrs-module-registrationapp/tree/b-1.8.0" style="color: #1155cc;" target="_blank">https://github.com/<wbr></wbr>nipunthathsara/openmrs-module-<wbr></wbr>registrationapp/tree/b-1.8.0</a></div>
<div>
Clone: <b>git clone <a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://github.com/nipunthathsara/openmrs-module-registrationapp.git&source=gmail&ust=1502910879358000&usg=AFQjCNEzXo1TgElmwKF6jNozyc3Zc6tmYQ" href="https://github.com/nipunthathsara/openmrs-module-registrationapp.git" style="color: #1155cc;" target="_blank">https://github.com/<wbr></wbr>nipunthathsara/openmrs-module-<wbr></wbr>registrationapp.git</a></b></div>
<div>
Checkout: <b>git checkout b-1.8.0</b></div>
<div>
Build: <b>mvn clean install -DskipTests</b></div>
<div>
<b><br /></b></div>
<div>
4. Download other required modules</div>
<div>
Download: <a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://sourceforge.net/projects/openmrs/files/releases/OpenMRS_Reference_Application_2.6.0/referenceapplication-modules-2.6.0.zip/download&source=gmail&ust=1502910879358000&usg=AFQjCNFX4XJvHqays7SNeAySF54WeCRRkw" href="https://sourceforge.net/projects/openmrs/files/releases/OpenMRS_Reference_Application_2.6.0/referenceapplication-modules-2.6.0.zip/download" style="color: #1155cc;" target="_blank">https://sourceforge.<wbr></wbr>net/projects/openmrs/files/<wbr></wbr>releases/OpenMRS_Reference_<wbr></wbr>Application_2.6.0/<wbr></wbr>referenceapplication-modules-<wbr></wbr>2.6.0.zip/download</a></div>
<div>
Delete <b>registrationapp-1.8.0.omod</b> and<b> registrationcore-1.7.1.<wbr></wbr>omod </b>from extracted directory</div>
<div>
<b>Replace them with your build artifacts</b></div>
<div>
put modules to modules directory</div>
<div>
restart the tomcat</div>
</div>
Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-56661627320724050392017-08-08T09:44:00.002-07:002017-08-08T09:44:59.630-07:00RegistrationCore keeps build failingI've first deployed the solution using the platform and registration app along with normal versions of other required modules.<br />It kept giving errors.<br />
Figured out the registration core too, has to be rebuilt using the new platform dependency.<br />
Trying that gave me an error.<br />
Couldn't figure out since i never did any modification other than the depndency reversioning.<br />
And the error doesn't seem to that.<br />
<br />
Therefore, checkout the exact same version as the openrms download page and tried building without any modification, not at least the dependency change.<br />
It fails while running tests :(<br />
<br />
Tried for sometime and did the same with another computer. It ran fine.<br />
<br />
Have to figure out that immediately.<br />
<br />
Will give you and update once this versioning problems are solved.Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-12821287632488979592017-07-31T10:14:00.000-07:002017-07-31T10:14:51.062-07:00OpenMRS remote debuggingI am working with 3 repositories for my GSoC project,<br />
1. Registration App<br />
2. RegistrationCore<br />
3. Core<br />
<br />
Debugging the application should be done using remote debugging option. In this post i'll explain the steps to remote debug openmrs. However i haven't yet tested the solution fully since i couldn't do much in this week. Anyway, i'll share my findings here.<br />
<br />
What happens in here is, we are running the server in the debugging mode, specifying a port to communicate between the IDE and the server. Normally you pass the debugging argument along with your server start command.<br />
<b>--debug=5005</b><br />
<b><br /></b>
Once the server is fired using this argument, it will open the specified port for an outsider to listen.<br />
In this case our IDE.<br />
I am using Intellij IDEA. You create a ne w remote debugger setting the port to 5005 and host to local host.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrmon82ISc_eEVbSfXnEIzTByEDSJTTYDWB4qFbhQBRiYLaT1gUkqKGMAMhLva-D4zNEZHK-ozbrnSeukDlQ9k-o7fmyo8slcEwnQxGeZEQgbiWJReXylyrLDHWNPJlUcUq_zEHwOH1LCa/s1600/Screenshot+from+2017-07-31+22-41-31.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="900" data-original-width="1600" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrmon82ISc_eEVbSfXnEIzTByEDSJTTYDWB4qFbhQBRiYLaT1gUkqKGMAMhLva-D4zNEZHK-ozbrnSeukDlQ9k-o7fmyo8slcEwnQxGeZEQgbiWJReXylyrLDHWNPJlUcUq_zEHwOH1LCa/s400/Screenshot+from+2017-07-31+22-41-31.png" width="400" /></a></div>
<br />
Then checkout the exact version of the repository that you want to debug.<br />
Connect to the debugging port by running the debugger you just configured.<br />
<br />
Server will communicate all the changes just like in normal local debugger.<br />
<br />
I'll be integrate the parts and debug to see if the solution is working in this week.<br />
<br />Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-71092177838783142282017-07-24T09:57:00.001-07:002017-07-24T09:57:50.075-07:00Testing the solutionI've implemented the solution up to an extent, now that's the time to put the pieces together and run the system. But proceeding forward got a problem when building the each module and core.<br />
<br />
The core and the registrationApp both has the maven repository's copy of their respective dependencies. These repos do not include my changes. therefore, i have to build these repos locally and add themselves as the dependencies accordingly.<br />
<br />
But the core builds up as a war file not a jar. Therefore, i've faced a difficulty in adding them as a library in the other modules. I've contacted the mentor and asked from the community as well.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijj01InrhWifKaRQZfo2gbIg-B6lzX7YUd2dN2LVDHHB_Jy737zjntIdoR4AehNLp1iGKq2FndN8eEqdIEBfY83AUJ3fhWVNAqro_zuLBn4JYgFmNEEIkPbVGkf6qcbN3w6MsFnfKiPlBA/s1600/Screenshot+from+2017-07-24+22-22-41.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="900" data-original-width="1600" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijj01InrhWifKaRQZfo2gbIg-B6lzX7YUd2dN2LVDHHB_Jy737zjntIdoR4AehNLp1iGKq2FndN8eEqdIEBfY83AUJ3fhWVNAqro_zuLBn4JYgFmNEEIkPbVGkf6qcbN3w6MsFnfKiPlBA/s320/Screenshot+from+2017-07-24+22-22-41.png" width="320" /></a></div>
<a href="https://talk.openmrs.org/t/changes-in-core-doesnt-reflect-in-modules/12473">https://talk.openmrs.org/t/changes-in-core-doesnt-reflect-in-modules/12473</a><br /><br /><br />Got an answer from the community and i'm going to check it out tomorrow and test if the current implementation is working fine or not.<br />
<br />
Other difficulty that i'm facing is debugging the OpenMRS. As it's running on top of core and multiple modules, it doesn't have a single code base but many. Therefore, debugging is not as easy as normal web app. I've searched the internet but could found only one blog barely describing the REMOTE DEBUGGING process. I've talked to the mentor about this and hopefully we can find a solution for this soon.<br />
<br />
In this week i'll be building the solution and test if it works or not. Will give an update once done.<br /><br /><br />Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-40521288807708158472017-07-17T09:13:00.002-07:002017-07-17T09:13:47.522-07:00Coding the core and RegistrationApp ...Contd from last week..<br />
<div>
<br />
<b>CORE</b></div>
<div>
Last week i've roughly changed savePatient method in the Core, so that i can get the opinion of my mentor before continue the approach. Therefore, i didn't resolve all the dependencies.</div>
<div>
<br /></div>
<div>
Since we both agreed on the solution, here i've implemented it further more, </div>
<div>
<ul>
<li>Resolved all the dependency errors.</li>
<li>Unknown variable is yet to be passed to the core's method.</li>
<li>Adding the Unknown attribute - which is originally done in the registration app is moved here.</li>
<li>But, since emrAPI is not available in the core, i had to take the workaround method.</li>
</ul>
<div>
<b>TODO</b></div>
</div>
<div>
<ul>
<li>savePatient method of core is being used for functinalities other than registering the patient. </li>
<li>If i add a second parameter for 'unknown boolean', other use cases like EditPAtient will not work.</li>
<li>Therefore, the only solution seems to be overloading the savePatient method with two separate arguments.</li>
<li>This has to be done in future.</li>
</ul>
<div>
<br />
<pre style="background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: "arial"; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> @Override
public Patient savePatient(Patient patient) throws APIException {
//************work starts
//todo
//pass unknown att to core - is paasing along regCore as a separate para is ok?
if (unknown != null && unknown) {
PersonName name = new PersonName();
name.setFamilyName("UNKNOWN");
name.setGivenName("UNKNOWN");
patient.addName(name);
//patient.addAttribute(new PersonAttribute(emrApiProperties.getUnknownPatientPersonAttributeType(), "true"));
//work on addingAttribute - core can not depend on the relevant module. therefore rewriting that...
PersonAttributeType type = null;
type = this.personService.getPersonAttributeTypeByName("Unknown patient");
if(type == null) {
throw new IllegalStateException("Configuration required: Unknown patient");
} else {
//return type;
patient.addAttribute(new PersonAttribute(type, "true");
}
//resolve errors
}
//************work ends
</code></pre>
<br />
<br />
<br />
<b>REGISTRATIONAPP</b><br />
<b><br /></b>
Commentd out all the logic related to unknown patient registration from the registration app. This logic is moved t the core.<br />
<b>TODO</b><br />
<br />
<ul>
<li>Unknown boolean has to be passed to the registrationcore and from there to core itself. So, registration core also should either be overloaded, or add another boolean parameter to itself.</li>
</ul>
<div>
<br /></div>
<br />
<pre style="background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: "arial"; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> public FragmentActionResult submit(UiSessionContext sessionContext, @RequestParam(value="appId") AppDescriptor app,
@SpringBean("registrationCoreService") RegistrationCoreService registrationService,
@ModelAttribute("patient") @BindParams Patient patient,
@ModelAttribute("personName") @BindParams PersonName name,
@ModelAttribute("personAddress") @BindParams PersonAddress address,
@RequestParam(value="birthdateYears", required = false) Integer birthdateYears,
@RequestParam(value="birthdateMonths", required = false) Integer birthdateMonths,
@RequestParam(value="registrationDate", required = false) Date registrationDate,
@RequestParam(value="unknown", required = false) Boolean unknown,
@RequestParam(value="patientIdentifier", required = false) String patientIdentifier,
HttpServletRequest request,
@SpringBean("messageSourceService") MessageSourceService messageSourceService,
@SpringBean("encounterService") EncounterService encounterService,
@SpringBean("obsService") ObsService obsService,
@SpringBean("conceptService") ConceptService conceptService,
@SpringBean("emrApiProperties") EmrApiProperties emrApiProperties,
@SpringBean("patientValidator") PatientValidator patientValidator, UiUtils ui) throws Exception {
NavigableFormStructure formStructure = RegisterPatientFormBuilder.buildFormStructure(app);
// if (unknown != null && unknown) {
// // TODO make "UNKNOWN" be configurable
// name.setFamilyName("UNKNOWN");
// name.setGivenName("UNKNOWN");
// patient.addAttribute(new PersonAttribute(emrApiProperties.getUnknownPatientPersonAttributeType(), "true"));
// }
//
// patient.addName(name);
patient.addAddress(address);
</code></pre>
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-40512521213245323082017-07-10T07:38:00.001-07:002017-07-10T07:38:47.910-07:00Starting with coreAs explained in the previous post, the dependency with registration module when saving an unknown patient is, setting its given name and family to UNKNOWN in the registration app. this should be done in the core.<br />
<br />
To identify the saving patient is an unknow in the core, unknown boolean has to passed to the core through registration app > registrationCore > core. Assuming the unknown status is passed to the core, validating whether patient is unknown and if so, setting name and unknown attribute is done in the core. Which are previously done in the registrationApp.<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: "arial"; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> @Override
public Patient savePatient(Patient patient) throws APIException {
//************work starts
//todo
//pass unknown att to core - is paasing along regCore as a separate para is ok?
if (unknown != null && unknown) {
PersonName name = new PersonName();
name.setFamilyName("UNKNOWN");
name.setGivenName("UNKNOWN");
patient.addName(name);
//patient.addAttribute(new PersonAttribute(emrApiProperties.getUnknownPatientPersonAttributeType(), "true"));
//work on addingAttribute - core can not depend on the relevant module. therefore rewrite that...
PersonAttributeType type = null;
type = this.personService.getPersonAttributeTypeByName("Unknown patient");
if(type == null) {
throw new IllegalStateException("Configuration required: Unknown patient");
} else {
return type;
}
//resolve errors
}
</code></pre>
<br />
Here, unknown boolean has yet to be passed to the core.<br />
<br />
But emrApi properties is not visible in this scope since it is in a different module. Therefore, re implementing the logic again in here. Dependencies are still to be resolved.<br />
<br />
May be i should start from the beginning, from registration app and come down the way. idk.<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-9033365885821440532017-07-01T14:17:00.004-07:002017-07-01T14:17:58.469-07:00ApproachIf you take a look at the objective of the project, it is to move the Unknown patient registration functionality to the core of Openmrs. But as in previous post, the patient saving process is the same for a normal patient as for an unknown.<br />
<br />
<b>Steps: </b><br />
<ul>
<li><b>Identifying what differences are made in the process when patient is an unknown.</b><br />In RegistrationApp following configurations are made if the patient is marked unknown.<br />
<!-- HTML generated using hilite.me --><div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;">1
2
3
4
5
6</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(</span>unknown <span style="color: #333333;">!=</span> <span style="color: #008800; font-weight: bold;">null</span> <span style="color: #333333;">&&</span> unknown<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
<span style="color: #888888;">// TODO make "UNKNOWN" be configurable</span>
name<span style="color: #333333;">.</span><span style="color: #0000cc;">setFamilyName</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"UNKNOWN"</span><span style="color: #333333;">);</span>
name<span style="color: #333333;">.</span><span style="color: #0000cc;">setGivenName</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"UNKNOWN"</span><span style="color: #333333;">);</span>
patient<span style="color: #333333;">.</span><span style="color: #0000cc;">addAttribute</span><span style="color: #333333;">(</span><span style="color: #008800; font-weight: bold;">new</span> PersonAttribute<span style="color: #333333;">(</span>emrApiProperties<span style="color: #333333;">.</span><span style="color: #0000cc;">getUnknownPatientPersonAttributeType</span><span style="color: #333333;">(),</span> <span style="background-color: #fff0f0;">"true"</span><span style="color: #333333;">));</span>
<span style="color: #333333;">}</span>
</pre>
</td></tr>
</tbody></table>
</div>
These are the only changes that are specific to an unknown patient in the current implementation. Other steps are common for both identified and unknown. </li>
<li>In order to move the unknown patient registration functionality to the core, these configurations should be done in the core.</li>
<li>These should be configured inside the <b>savePatient </b>method of core.<br />
<!-- HTML generated using hilite.me --><div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #555555; font-weight: bold;">@Override</span>
<span style="color: #008800; font-weight: bold;">public</span> Patient <span style="color: #0066bb; font-weight: bold;">savePatient</span><span style="color: #333333;">(</span>Patient patient<span style="color: #333333;">)</span> <span style="color: #008800; font-weight: bold;">throws</span> APIException <span style="color: #333333;">{</span>
requireAppropriatePatientModificationPrivilege<span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(!</span>patient<span style="color: #333333;">.</span><span style="color: #0000cc;">getVoided</span><span style="color: #333333;">()</span> <span style="color: #333333;">&&</span> patient<span style="color: #333333;">.</span><span style="color: #0000cc;">getIdentifiers</span><span style="color: #333333;">().</span><span style="color: #0000cc;">size</span><span style="color: #333333;">()</span> <span style="color: #333333;">==</span> <span style="color: #0000dd; font-weight: bold;">1</span><span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
patient<span style="color: #333333;">.</span><span style="color: #0000cc;">getPatientIdentifier</span><span style="color: #333333;">().</span><span style="color: #0000cc;">setPreferred</span><span style="color: #333333;">(</span><span style="color: #008800; font-weight: bold;">true</span><span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(!</span>patient<span style="color: #333333;">.</span><span style="color: #0000cc;">getVoided</span><span style="color: #333333;">())</span> <span style="color: #333333;">{</span>
checkPatientIdentifiers<span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
setPreferredPatientIdentifier<span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
setPreferredPatientName<span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
setPreferredPatientAddress<span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">return</span> dao<span style="color: #333333;">.</span><span style="color: #0000cc;">savePatient</span><span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
<span style="color: #333333;">}</span></pre>
</td></tr>
</tbody></table>
</div>
<br /></li>
<li>Unknown attribute should be passed along with the patient object, and over writing name and etc should be done in core.<br /></li>
<li>I am planning to get the mentor's idea on this and implement the solution.</li>
</ul>
Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-37668305424071881112017-06-27T05:07:00.002-07:002017-06-27T05:07:47.372-07:00Current implementation - BackendPrevious post was about the current implementation of the front end design of current implementation. This post will mention the path to the database through the backend. Walking through i have identified that this involves two modules and the core itself.<br />
<br />
1. RegistrationApp module<br />
2. RegistrationCore module<br />
3. Openmrs Core<br />
<br />
request from the browser is:<br />
<b>URL:http://localhost:8080/openmrs/registrationapp/registerPatient/submit.action?appId=referenceapplication.registrationapp.registerPatient&&preferred=true&gender=F&unknown=true</b><br />
<b><br /></b>
<b>Step 1:</b><br />
Registration App module - <b>RegisterPatientFragmentController.java </b>submit method of this controller is used to capture submit event.<br />
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #008800; font-weight: bold;">public</span> FragmentActionResult <span style="color: #0066bb; font-weight: bold;">submit</span><span style="color: #333333;">(</span>UiSessionContext sessionContext<span style="color: #333333;">,</span> <span style="color: #555555; font-weight: bold;">@RequestParam</span><span style="color: #333333;">(</span>value<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"appId"</span><span style="color: #333333;">)</span> AppDescriptor app<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@SpringBean</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"registrationCoreService"</span><span style="color: #333333;">)</span> RegistrationCoreService registrationService<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@ModelAttribute</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"patient"</span><span style="color: #333333;">)</span> <span style="color: #555555; font-weight: bold;">@BindParams</span> Patient patient<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@ModelAttribute</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"personName"</span><span style="color: #333333;">)</span> <span style="color: #555555; font-weight: bold;">@BindParams</span> PersonName name<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@ModelAttribute</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"personAddress"</span><span style="color: #333333;">)</span> <span style="color: #555555; font-weight: bold;">@BindParams</span> PersonAddress address<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@RequestParam</span><span style="color: #333333;">(</span>value<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"birthdateYears"</span><span style="color: #333333;">,</span> required <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span><span style="color: #333333;">)</span> Integer birthdateYears<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@RequestParam</span><span style="color: #333333;">(</span>value<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"birthdateMonths"</span><span style="color: #333333;">,</span> required <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span><span style="color: #333333;">)</span> Integer birthdateMonths<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@RequestParam</span><span style="color: #333333;">(</span>value<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"registrationDate"</span><span style="color: #333333;">,</span> required <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span><span style="color: #333333;">)</span> Date registrationDate<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@RequestParam</span><span style="color: #333333;">(</span>value<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"unknown"</span><span style="color: #333333;">,</span> required <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span><span style="color: #333333;">)</span> Boolean unknown<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@RequestParam</span><span style="color: #333333;">(</span>value<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"patientIdentifier"</span><span style="color: #333333;">,</span> required <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span><span style="color: #333333;">)</span> String patientIdentifier<span style="color: #333333;">,</span>
HttpServletRequest request<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@SpringBean</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"messageSourceService"</span><span style="color: #333333;">)</span> MessageSourceService messageSourceService<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@SpringBean</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"encounterService"</span><span style="color: #333333;">)</span> EncounterService encounterService<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@SpringBean</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"obsService"</span><span style="color: #333333;">)</span> ObsService obsService<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@SpringBean</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"conceptService"</span><span style="color: #333333;">)</span> ConceptService conceptService<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@SpringBean</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"emrApiProperties"</span><span style="color: #333333;">)</span> EmrApiProperties emrApiProperties<span style="color: #333333;">,</span>
<span style="color: #555555; font-weight: bold;">@SpringBean</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"patientValidator"</span><span style="color: #333333;">)</span> PatientValidator patientValidator<span style="color: #333333;">,</span> UiUtils ui<span style="color: #333333;">)</span> <span style="color: #008800; font-weight: bold;">throws</span> Exception <span style="color: #333333;">{</span>
NavigableFormStructure formStructure <span style="color: #333333;">=</span> RegisterPatientFormBuilder<span style="color: #333333;">.</span><span style="color: #0000cc;">buildFormStructure</span><span style="color: #333333;">(</span>app<span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(</span>unknown <span style="color: #333333;">!=</span> <span style="color: #008800; font-weight: bold;">null</span> <span style="color: #333333;">&&</span> unknown<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
<span style="color: #888888;">// TODO make "UNKNOWN" be configurable</span>
name<span style="color: #333333;">.</span><span style="color: #0000cc;">setFamilyName</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"UNKNOWN"</span><span style="color: #333333;">);</span>
name<span style="color: #333333;">.</span><span style="color: #0000cc;">setGivenName</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"UNKNOWN"</span><span style="color: #333333;">);</span>
patient<span style="color: #333333;">.</span><span style="color: #0000cc;">addAttribute</span><span style="color: #333333;">(</span><span style="color: #008800; font-weight: bold;">new</span> PersonAttribute<span style="color: #333333;">(</span>emrApiProperties<span style="color: #333333;">.</span><span style="color: #0000cc;">getUnknownPatientPersonAttributeType</span><span style="color: #333333;">(),</span> <span style="background-color: #fff0f0;">"true"</span><span style="color: #333333;">));</span>
<span style="color: #333333;">}</span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<br />
this method captures any patient submit and checks if Unknown. If so sets attributes appropriately. Then the service is called.<br />
<br />
<b>Step 2:</b><br />
RegistrationCore module - RegistrationCoreServiceImple.java this service is then called.<br />
<br />
<br />
<br />
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #555555; font-weight: bold;">@Override</span>
<span style="color: #008800; font-weight: bold;">public</span> Patient <span style="color: #0066bb; font-weight: bold;">registerPatient</span><span style="color: #333333;">(</span>Patient patient<span style="color: #333333;">,</span> List<span style="color: #333333;"><</span>Relationship<span style="color: #333333;">></span> relationships<span style="color: #333333;">,</span> String identifierString<span style="color: #333333;">,</span> Location identifierLocation<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(</span>log<span style="color: #333333;">.</span><span style="color: #0000cc;">isInfoEnabled</span><span style="color: #333333;">())</span>
log<span style="color: #333333;">.</span><span style="color: #0000cc;">info</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"Registering new patient.."</span><span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(</span>patient <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">null</span><span style="color: #333333;">)</span>
<span style="color: #008800; font-weight: bold;">throw</span> <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #0066bb; font-weight: bold;">APIException</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"Patient cannot be null"</span><span style="color: #333333;">);</span>
IdentifierSourceService iss <span style="color: #333333;">=</span> Context<span style="color: #333333;">.</span><span style="color: #0000cc;">getService</span><span style="color: #333333;">(</span>IdentifierSourceService<span style="color: #333333;">.</span><span style="color: #0000cc;">class</span><span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(</span>idSource <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">null</span><span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
String idSourceId <span style="color: #333333;">=</span> adminService<span style="color: #333333;">.</span><span style="color: #0000cc;">getGlobalProperty</span><span style="color: #333333;">(</span>RegistrationCoreConstants<span style="color: #333333;">.</span><span style="color: #0000cc;">GP_OPENMRS_IDENTIFIER_SOURCE_ID</span><span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(</span>StringUtils<span style="color: #333333;">.</span><span style="color: #0000cc;">isBlank</span><span style="color: #333333;">(</span>idSourceId<span style="color: #333333;">))</span>
<span style="color: #008800; font-weight: bold;">throw</span> <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #0066bb; font-weight: bold;">APIException</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"Please set the id of the identifier source to use to generate patient identifiers"</span><span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">try</span> <span style="color: #333333;">{</span>
idSource <span style="color: #333333;">=</span> iss<span style="color: #333333;">.</span><span style="color: #0000cc;">getIdentifierSource</span><span style="color: #333333;">(</span>Integer<span style="color: #333333;">.</span><span style="color: #0000cc;">valueOf</span><span style="color: #333333;">(</span>idSourceId<span style="color: #333333;">));</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(</span>idSource <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">null</span><span style="color: #333333;">)</span>
<span style="color: #008800; font-weight: bold;">throw</span> <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #0066bb; font-weight: bold;">APIException</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"cannot find identifier source with id:"</span> <span style="color: #333333;">+</span> idSourceId<span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
<span style="color: #008800; font-weight: bold;">catch</span> <span style="color: #333333;">(</span>NumberFormatException e<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
<span style="color: #008800; font-weight: bold;">throw</span> <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #0066bb; font-weight: bold;">APIException</span><span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"Identifier source id should be a number"</span><span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
<span style="color: #333333;">}</span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
At the end this method calls the platform services.<br />
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;">1</pre>
</td><td><pre style="line-height: 125%; margin: 0;">patient <span style="color: #333333;">=</span> patientService<span style="color: #333333;">.</span><span style="color: #0000cc;">savePatient</span><span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<b>Step 3:</b><br />
Openmrs core module - <b>PatientServiceImpl.java</b> savePatient method of this class is called upon saving. therefore, the path is through the platform itself.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #555555; font-weight: bold;">@Override</span>
<span style="color: #008800; font-weight: bold;">public</span> Patient <span style="color: #0066bb; font-weight: bold;">savePatient</span><span style="color: #333333;">(</span>Patient patient<span style="color: #333333;">)</span> <span style="color: #008800; font-weight: bold;">throws</span> APIException <span style="color: #333333;">{</span>
requireAppropriatePatientModificationPrivilege<span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(!</span>patient<span style="color: #333333;">.</span><span style="color: #0000cc;">getVoided</span><span style="color: #333333;">()</span> <span style="color: #333333;">&&</span> patient<span style="color: #333333;">.</span><span style="color: #0000cc;">getIdentifiers</span><span style="color: #333333;">().</span><span style="color: #0000cc;">size</span><span style="color: #333333;">()</span> <span style="color: #333333;">==</span> <span style="color: #0000dd; font-weight: bold;">1</span><span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
patient<span style="color: #333333;">.</span><span style="color: #0000cc;">getPatientIdentifier</span><span style="color: #333333;">().</span><span style="color: #0000cc;">setPreferred</span><span style="color: #333333;">(</span><span style="color: #008800; font-weight: bold;">true</span><span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
<span style="color: #008800; font-weight: bold;">if</span> <span style="color: #333333;">(!</span>patient<span style="color: #333333;">.</span><span style="color: #0000cc;">getVoided</span><span style="color: #333333;">())</span> <span style="color: #333333;">{</span>
checkPatientIdentifiers<span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
setPreferredPatientIdentifier<span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
setPreferredPatientName<span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
setPreferredPatientAddress<span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
<span style="color: #008800; font-weight: bold;">return</span> dao<span style="color: #333333;">.</span><span style="color: #0000cc;">savePatient</span><span style="color: #333333;">(</span>patient<span style="color: #333333;">);</span>
<span style="color: #333333;">}</span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
As line 18, it calls the DAO layer now.<br />
And then to the Hibernate PatientDAO and saves to the database.<br />
<br />
If the data is routed through the platform already, then what's the difference in case of an unknown patient? that's to be solved.<br />
<br />
<br />
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-61082795812663192102017-06-19T08:36:00.002-07:002017-06-19T08:36:43.705-07:00An Excuse I'm currently going through my final year research project evaluation process. It will be till 23rd of this week. (full day, whole week 😒) I really didn't have any time to do anything this week. I'll update this post once i'm done with that.Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-43026142128762302712017-06-09T23:44:00.002-07:002017-06-09T23:44:53.222-07:00Objective 3 - Figure out the path to have the feature in platform...<h2>
Get to know the current implementation</h2>
As explained in the previous post my initial attempt would be to identify how an unknown patient is registered in the current implementation. And find the module that the feature relies on. Going through the materials found this <a href="https://issues.openmrs.org/browse/RA-472" target="_blank">ticket</a>, which seems to me the the implementation of the feature.<br />
<br />
<h3>
Front end procedure</h3>
<div>
<ul>
<li><b>registerPatient.gsp - </b><span style="color: orange;"><a href="https://github.com/openmrs/openmrs-module-registrationapp/blob/master/omod/src/main/webapp/pages/registerPatient.gsp" target="_blank">omod\src\main\webapp\pages\registerPatient.gsp</a></span></li>
</ul>
</div>
<div>
This first checks if the unknown patient registration is allowed in the configurations.<br />
<br />
<pre style="background: #000; color: #f8f8f8;"><<span style="color: #e28964;">%</span> <span style="color: #e28964;">if</span> (allowUnknownPatients) { <span style="color: #e28964;">%</span>>
</pre>
<span class="pl-pse" style="box-sizing: border-box; color: #24292e; font-family: , "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;"><br /></span><span style="color: #24292e;"><span style="white-space: pre;">The configurations are defined in a json file - </span></span><span style="color: purple; font-size: x-small;"><a href="https://github.com/openmrs/openmrs-module-registrationapp/blob/master/omod/src/main/resources/apps/registrationappAppTemplates.json#L32" target="_blank"><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; text-decoration-line: none;">omod</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; text-decoration-line: none;">src</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; text-decoration-line: none;">main</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; outline-width: 0px;">resources</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; text-decoration-line: none;">apps</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="final-path" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">registrationappAppTemplates.json</span></a></span><br />
<br />
<pre style="background: #000; color: #f8f8f8;">{
<span style="color: #65b042;">"name"</span>: <span style="color: #65b042;">"allowUnknownPatients"</span>,
<span style="color: #65b042;">"description"</span>: <span style="color: #65b042;">"True/false whether or not to allow the user to create an unknown patient, with no name or age (e.g. arriving unconscious to the ER)"</span>,
<span style="color: #65b042;">"defaultValue"</span>: true
},
</pre>
<br />
<br />
<ul>
<li><b>RegisterPatient.js </b>- <span style="color: purple;"><a href="https://github.com/openmrs/openmrs-module-registrationapp/blob/master/omod/src/main/webapp/resources/scripts/registerPatient.js#L211" target="_blank"><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; text-decoration-line: none;">omod</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; text-decoration-line: none;">src</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; text-decoration-line: none;">main</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; text-decoration-line: none;">webapp</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; text-decoration-line: none;">resources</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="js-path-segment" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="background-color: transparent; box-sizing: border-box; text-decoration-line: none;">scripts</span></span><span class="separator" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">/</span><span class="final-path" style="background-color: white; box-sizing: border-box; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";">registerPatient.js</span></a></span></li>
</ul>
<br />
Disabling all the fields except 'Gender' if unknown patient s checked, is done by registerPatient.js<br />
<pre style="background: #000; color: #f8f8f8;"><span style="color: #e9c062;">/* Unknown patient functionality */</span>
jq(<span style="color: #65b042;">'#checkbox-unknown-patient'</span>).click(function () {
<span style="color: #e28964;">if</span> (jq(<span style="color: #65b042;">'#checkbox-unknown-patient'</span>).is(<span style="color: #65b042;">':checked'</span>)) {
// disable all questions & sections except gender <span style="color: #e28964;">and</span> registration date
_.<span style="color: #dad085;">each</span>(NavigatorController.getQuestionById(<span style="color: #65b042;">'demographics-name'</span>).fields, function (field) {
<span style="color: #e28964;">if</span> (field.id != <span style="color: #65b042;">'checkbox-unknown-patient'</span>) {
field.disable();
}
});
_.<span style="color: #dad085;">each</span>(NavigatorController.getSectionById(<span style="color: #65b042;">'demographics'</span>).questions, function(question) {
<span style="color: #e28964;">if</span> (question.id != <span style="color: #65b042;">'demographics-gender'</span> && question.id != <span style="color: #65b042;">'demographics-name'</span>) {
question.disable();
}
})
// TODO sections variable is currently hackily <span style="color: #dad085;">defined</span> in registerPatient.gsp
_.<span style="color: #dad085;">each</span>(sections, function(section) {
<span style="color: #e28964;">if</span> (section != <span style="color: #65b042;">'demographics'</span>) {
NavigatorController.getSectionById(section).disable();
}
});
// set unknown flag
jq(<span style="color: #65b042;">'#demographics-unknown'</span>).val(<span style="color: #65b042;">'true'</span>);
// jump ahead to gender
NavigatorController.getQuestionById(<span style="color: #65b042;">'demographics-gender'</span>).click();
}
</pre>
<br />
<br />
<a href="https://github.com/openmrs/openmrs-module-registrationapp/blob/master/omod/src/main/webapp/resources/scripts/registerPatient.js#L151" target="_blank">Submitting the form</a><br />
<br />
<pre style="background: #000; color: #f8f8f8;">jq(<span style="color: #65b042;">'#registration'</span>).submit(function (e) {
e.preventDefault();
jq(<span style="color: #65b042;">'#submit'</span>).attr(<span style="color: #65b042;">'disabled'</span>, <span style="color: #65b042;">'disabled'</span>);
jq(<span style="color: #65b042;">'#cancelSubmission'</span>).attr(<span style="color: #65b042;">'disabled'</span>, <span style="color: #65b042;">'disabled'</span>);
jq(<span style="color: #65b042;">'#validation-errors'</span>).hide();
var formData = jq(<span style="color: #65b042;">'#registration'</span>).serialize();
jq.getJSON(emr.fragmentActionLink(<span style="color: #65b042;">"registrationapp"</span>, <span style="color: #65b042;">"registerPatient"</span>, <span style="color: #65b042;">"submit"</span>, { appId: appId }), formData)
.success(function (response) {
emr.navigateTo({<span style="color: #65b042;">"applicationUrl"</span>: response.message});
})
.error(function (response) {
jq(<span style="color: #65b042;">'#validation-errors-content'</span>).html(jq.parseJSON(response.responseText).globalErrors);
jq(<span style="color: #65b042;">'#validation-errors'</span>).show();
jq(<span style="color: #65b042;">'#submit'</span>).removeAttr(<span style="color: #65b042;">'disabled'</span>);
jq(<span style="color: #65b042;">'#cancelSubmission'</span>).removeAttr(<span style="color: #65b042;">'disabled'</span>);
});
});
</pre>
<br />
Here getJSON function's url parameter is getting its value from fragmentActionLink's return value.<br />
<br />
Request call to the back end is<br /><br />
<b><span style="background-color: black; color: orange;">RequestURL: http://localhost:8080/openmrs/registrationapp/registerPatient/submit.action?appId=referenceapplication.registrationapp.registerPatient&&preferred=true&gender=F&unknown=true</span></b><br />
<br />
Back end path is yet to be discovered, i'll continue the post once it's done...<br />
<br />
I'll be continuing to read the floss manual and read on Spring MVC as they are required. </div>
Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-2664586258421701202017-06-08T03:47:00.001-07:002017-06-08T03:47:33.651-07:00What am i supposed to do?<h2>
Anonymous Patient Registration Project</h2>
<div>
The project i got selected for is about registration of the patients who's identity is unknown at the time of admission. This may caused by unconsciousness, inability to express or language barrier maybe. Since this is a common scenario around the hospitals, this should be working fine and be available in the Openmrs platform.Let's take a quick look at what the <a href="https://wiki.openmrs.org/display/projects/Anonymous+Patient+Registration+Project" target="_blank">Wiki </a>page has to say.<br />
<br />
Let me highlight the important things. So, it provides 4 main objectives.<br />
<h3>
Objectives</h3>
</div>
<div>
<ol>
<li>Find out the required modules to get the feature working in the reference application</li>
<li>Identify what configurations need to be made to get the feature working out of the box in the reference application.</li>
<li>Figure out which path to take in order to have the feature in the platform.</li>
<li>Implement the path chosen above.</li>
</ol>
About the first objective, i've checked the feature with the latest reference application, and the function seems to be working fine. Even the merging of patients also works fine out of the box. </div>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsS3BWvpQOF11-RsyH4EYlYl7t-tshBp4iWMf08FrcUpiux7b92pW-UfohmluC8RAU21l0bmRelZtpVY0ugaJuptlfl5Nh6sU2kK5xsEpytP4N2z4aptFUafQME39QBnPaTvqezpG6EpbS/s1600/interface1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="595" data-original-width="1011" height="188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsS3BWvpQOF11-RsyH4EYlYl7t-tshBp4iWMf08FrcUpiux7b92pW-UfohmluC8RAU21l0bmRelZtpVY0ugaJuptlfl5Nh6sU2kK5xsEpytP4N2z4aptFUafQME39QBnPaTvqezpG6EpbS/s320/interface1.png" width="320" /></a><br />
<br />
Since there was no issues with the function working out of the box, i don't have to put any effort toward the second objective too.<br />
<br />
So, only 3rd and 4th objectives are remaining.<br />
<h3>
Figure out which path to take in order to have the feature in the platform</h3>
<div>
I am planning to spend this week figuring out the path of the currently implemented version of the feature.<br />The Patient registration function is mainly supported by the Registration app module. But it sure depends on other modules when register a new patient. Learnings from this step will be included in the next blog post as i'm still trying to debug the backend.</div>
<div>
<br /></div>
<div>
My targets for this week are to find the current implementation's path of registering a anonymous patient. <a href="https://issues.openmrs.org/browse/RA-472" target="_blank">Ticket</a><br />Plus, enable debugging on IntelliJ Idea for Openmrs. (Found this <a href="http://techie-notebook.blogspot.in/2012/12/debugging-code-in-intellij-for-openmrs.html" target="_blank">blog post</a>).<br /><br /><h3>
Implement the path chosen</h3>
</div>
<div>
Since the initial objectives turned out to be done already, my main objective would be to move the Anonymous patient registration function to the Openmrs core (Platform). So that, one can access the API directly from his own implementation to register a anonymous patient.</div>
<h3>
</h3>
<br />
<h3>
<b>High level work plan</b></h3>
<div>
<b>First evaluation - </b></div>
<div>
<ul>
<li>Identify the depending modules</li>
<li>Get to know the current implementation path of the feature.</li>
<li>Design the path to move the feature to the Openmrs-core.</li>
<li>Start implemetation</li>
</ul>
</div>
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0tag:blogger.com,1999:blog-8568203852777641349.post-6469984318088029192017-05-27T03:45:00.000-07:002017-05-27T21:42:00.730-07:00GSoC Newbie...<h2>
Google Summer of Code</h2>
<div>
Let me give a quick idea of what's <a href="https://developers.google.com/open-source/gsoc/" target="_blank">GSoC </a>for those who aren't still familiar with the term. But if you are from an IT background and haven't been on Mars for the last decade, please feel free to skip to the next post. 😀<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjf3cZy2HjrroZUdRgEchzKCknvviGc_7S-xw4movOegSzaEazzKAM2jUf2subKs3y9M6zFWcZAsFsrxK2iUDr8w8dLNMWfxVh6WShL-2K7RqpE_oEa0-KC19K1rc9lL8jtLFMdfpb1xCWY/s1600/gsoc+banner.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="112" data-original-width="556" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjf3cZy2HjrroZUdRgEchzKCknvviGc_7S-xw4movOegSzaEazzKAM2jUf2subKs3y9M6zFWcZAsFsrxK2iUDr8w8dLNMWfxVh6WShL-2K7RqpE_oEa0-KC19K1rc9lL8jtLFMdfpb1xCWY/s640/gsoc+banner.png" width="640" /></a><br />
Basically it's a program hosted by Google, with the support of many Opensource organizations around the globe. Its concept is to get students involved in Opensource development during their summer vacation. (Us, Sri Lankans who are not offered with any seasonal holidays in their universities...good luck with managing both!). But in common, Opensource development is 'Once in never out' kinda experience. As for me, i have worked with some Opensource projects previous to this and still find it hard to get rid of.<br />
<h3>
What you gotta do?</h3>
<div>
First thing is getting selected. Which is kind of a tricky part as thousands of students are applying for few hundreds of projects. Therefore, you got to prove yourself in order to be selected. I'm not sure about other countries but if you are from Sri Lanka, here we have many GSoC introductory sessions in which, past students and mentors come along to share their experience and guide the us towards a successful summer with GSoC. <i>As this is a lengthy process, i will be writing a separate post on this.</i></div>
<div>
<i><br /></i></div>
<div>
Organizations listed under GSoC are offering one or more projects. You have to go through them and select one or few which best fits your skill set and apply for it/them.</div>
<div>
If you are both smart and lucky enough to get through the selection process, then you will be given a timeline and set of goals to be completed. You will be assigned a mentor and your progress will be evaluated time to time.</div>
<h3>
Write some code, Earn some cash</h3>
</div>
<div>
Never contribute to Opensource if your sole motivation is $$$. It simply doesn't work like that. People who code here have a passion towards Opensource. But it's indeed motivational if you can get paid by doing what you love right?</div>
<div>
It's obvious, you can't buy a big mansion or a Lamborghini with $6000. But for an undergraduate who completely depends on parents, few thousands of dollars mean a fortune.</div>
<div>
<br />
<b>Got some bad news</b>: <i>Google has introduced a new payment formula from 2017 and you will be payed considering the PPP of your region. Accordingly, Sri Lankans are offered with the minimum sum of $2400. Nearly one third of the previous.</i> ðŸ˜</div>
<div>
<br /></div>
<div>
Stipends are paid in three installments. And no payment upon getting selected as in good old days.</div>
<div>
<ul>
<li>First evaluation 30%</li>
<li>Second evaluation 30%</li>
<li>Third evaluation 40%</li>
</ul>
But as mentioned earlier, it's not always about money. Plus, you could hardly find anyone who is offering $2400 for few months work as an undergraduate.</div>
<div>
<br /></div>
<div>
Let's talk more on applying for GSoC and <a href="http://openmrs.org/" target="_blank">OpenMRS </a>later.</div>
Anonymoushttp://www.blogger.com/profile/06385473356811976102noreply@blogger.com0Bandaranayake Mawatha, Katubedda, Moratuwa 10400, Sri Lanka6.7968769999999994 79.9017781-23.9275635 38.5931841 37.5213175 121.2103721