profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/sunbiz/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Saptarshi Purkayastha sunbiz Indiana University-Purdue University Indianapolis Indianapolis, USA http://sunnytalkstech.blogspot.com

iupui-soic/mHBS-trainer 11

The mobile Helping Babies Survive (mHBS) Trainer app for Android

hakuna21/DHIS2_CHITS-OpenMRS 3

DHIS2 link with CHITS-OpenMRS

openmrs/openmrs-module-owa 3

OpenMRS module to add open web apps -

iupui-soic/dynaswap 2

The code repository for the CICI Project #1839746 at IUPUI

iupui-soic/openmrs-module-casauth 2

The OpenMRS module for CAS Authentication

sunbiz/dhis-cas 1

The CAS web application for DHIS2 database connector

sunbiz/dhis2 1

The District Health Information Software v2

sunbiz/dhis2-10811 1

The District Health Information System 2

Campus-Advisors/campus-advisor-training-sunbiz 0

campus-advisor-training-sunbiz created by GitHub Classroom

pull request commentopenmrs/openmrs-module-webservices.rest

RESTWS-821: Add REST resource with links to administration pages of installed modules

@dkayiwa So I found a way to make it work. I've added legacyui-omod as a test dependency to all 2.0+ modules. I also had to bump it to version 1.8.3. Now it passes all the tests and can be deployed, the endpoint runs as well.

The only concern I have is why the PersonResource2_2Test failed on display property? It seems that adding legacyui-omod modified Person object for test purposes.

03f6a26

@dkayiwa What do you think about my recent solution?

BartlomiejRasztabiga

comment created time in 17 minutes

pull request commentopenmrs/openmrs-module-webservices.rest

RESTWS-823: Add REST resource for Alert Management

@dkayiwa Have you got any change requests to this PR? :)

BartlomiejRasztabiga

comment created time in 17 minutes

Pull request review commentopenmrs/openmrs-core

RA-552:Adding the View Logged in Users functionality to core

+/**+ * This Source Code Form is subject to the terms of the Mozilla Public License,+ * v. 2.0. If a copy of the MPL was not distributed with this file, You can+ * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under+ * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.+ *+ * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS+ * graphic logo is a trademark of OpenMRS Inc.+ */+package org.openmrs.util;++import java.util.Collections;+import java.util.LinkedHashSet;+import java.util.Set;+import org.openmrs.User;+import org.openmrs.UserSessionListener;+import org.openmrs.api.context.Context;+import org.springframework.stereotype.Component;++@Component+public class CurrentUsers implements UserSessionListener {++	private static Set<String> currentlyLoggedInUsers = Collections.synchronizedSet(new LinkedHashSet(500));++	@Override+	public void loggedInOrOut(User user, Event event, Status status) {+		if(!(status == Status.SUCCESS)) {
		if (!(status == Status.SUCCESS)) {
HerbertYiga

comment created time in 23 minutes

Pull request review commentopenmrs/openmrs-core

RA-552:Adding the View Logged in Users functionality to core

+/**+ * This Source Code Form is subject to the terms of the Mozilla Public License,+ * v. 2.0. If a copy of the MPL was not distributed with this file, You can+ * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under+ * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.+ *+ * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS+ * graphic logo is a trademark of OpenMRS Inc.+ */+package org.openmrs.util;++import java.util.Collections;+import java.util.LinkedHashSet;+import java.util.Set;+import org.openmrs.User;+import org.openmrs.UserSessionListener;+import org.openmrs.api.context.Context;+import org.springframework.stereotype.Component;++@Component+public class CurrentUsers implements UserSessionListener {++	private static Set<String> currentlyLoggedInUsers = Collections.synchronizedSet(new LinkedHashSet(500));++	@Override+	public void loggedInOrOut(User user, Event event, Status status) {+		if(!(status == Status.SUCCESS)) {+			return;+		}+		+		if (event != null && user != null) {+			if (event == Event.LOGIN) {	+				currentlyLoggedInUsers.add(user.getUsername());+			} else if (event == Event.LOGOUT) {+				currentlyLoggedInUsers.remove(user.getUsername());+			}+		}+	}+	public static  Set<String> getCurrentUsernames(){

	public static  Set<String> getCurrentUsernames(){
HerbertYiga

comment created time in 25 minutes

Pull request review commentopenmrs/openmrs-core

RA-552:Adding the View Logged in Users functionality to core

+/**+ * This Source Code Form is subject to the terms of the Mozilla Public License,+ * v. 2.0. If a copy of the MPL was not distributed with this file, You can+ * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under+ * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.+ *+ * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS+ * graphic logo is a trademark of OpenMRS Inc.+ */+package org.openmrs.util;++import java.util.Collections;+import java.util.LinkedHashSet;+import java.util.Set;+import org.openmrs.User;+import org.openmrs.UserSessionListener;+import org.openmrs.api.context.Context;+import org.springframework.stereotype.Component;++@Component+public class CurrentUsers implements UserSessionListener {++	private static Set<String> currentlyLoggedInUsers = Collections.synchronizedSet(new LinkedHashSet(500));++	@Override+	public void loggedInOrOut(User user, Event event, Status status) {+		if(!(status == Status.SUCCESS)) {+			return;+		}+		if (event != null && user != null) {+		    if(event == Event.LOGIN) {+		    	+			currentlyLoggedInUsers.add(user.getUsername());+		    } else if(event == Event.LOGOUT) {+		    	+			 currentlyLoggedInUsers.remove(user.getUsername());+			}+		}
		if(!(status == Status.SUCCESS)) {
			return;
		}
		
		if (event != null && user != null) {
			if (event == Event.LOGIN) {	
				currentlyLoggedInUsers.add(user.getUsername());
			} else if (event == Event.LOGOUT) {
				currentlyLoggedInUsers.remove(user.getUsername());
			}
		}
HerbertYiga

comment created time in 27 minutes

pull request commentopenmrs/openmrs-distro-referenceapplication

RATEST-91:Failing Test:Book Request Appointment Test https://issues.o…

Waiting approval to run actions cc: @k-joseph

insookwa

comment created time in 34 minutes

pull request commentopenmrs/openmrs-distro-referenceapplication

RATEST-91:Failing Test:Book Request Appointment Test https://issues.o…

Yes @kdaud it passes locally

insookwa

comment created time in 37 minutes

push eventopenmrs/openmrs-module-reporting

dbaluku

commit sha ea7937e138ed899419c0fadd04a5546368e91e5c

REPORT-878:Enable RenderReport Method to accept multiple values for a parameter passed in a HTTP request (#216)

view details

push time in an hour

Pull request review commentopenmrs/openmrs-module-coreapps

'Patient Identifier column'

 function PatientSearchWidget(configuration){                             }                         });                     }+					/* Added Identifier type for the patient list in the main dashboard */+					else {+						const identifiersFiltered = patient.identifiers.filter(i => i.identifierType.uuid === "ffbd60fb-599a-4a57-b2f1-4b55847cd938" || i.identifierType.uuid === "3fa0990e-900d-4a80-a4c1-dcf01a0d4f9c");+						if (identifiersFiltered.length > 0) {

I spoke with Aldo about this, we agree on this approach.

MiguelAHPpih

comment created time in 2 hours

pull request commentopenmrs/openmrs-contrib-uitestframework

RATEST-92:RATEST-92:Failing Test: Contact Info Test

i shared the two fixes on single ticket

IMO this is not a better way to handle different issues into a single ticket and should not be encouraged. It will make tracking of work in the future very hard. Each issue should be handled in a separate ticket.

sherrif10

comment created time in 2 hours

pull request commentopenmrs/openmrs-contrib-uitestframework

RATEST-92:RATEST-92:Failing Test: Contact Info Test

True i agree but i shared the two fixes on single ticket ,so perhaps we can track them from there

sherrif10

comment created time in 2 hours

pull request commentopenmrs/openmrs-contrib-uitestframework

RATEST-92:RATEST-92:Failing Test: Contact Info Test

this is a bug within uitestframework and i needed to commit another pr in distro thank

Your right @sherrif10 ! It was my mistake on the comment I made.

I think such bugs(fixes)should be tracked in a separate ticket to for further reference.

sherrif10

comment created time in 2 hours

pull request commentopenmrs/openmrs-contrib-uitestframework

RATEST-92:RATEST-92:Failing Test: Contact Info Test

Where exactly @kdaud , this is a bug within uitestframework and i needed to commit another pr in distro thanks, Feel free to checkin here

sherrif10

comment created time in 2 hours

Pull request review commentopenmrs/openmrs-sdk

SDK-288 SDK build-distro should build SPA application

 private String buildDistro(File targetDirectory, Artifact distroArtifact, Distro             try {                 ZipFile warfile = new ZipFile(new File(web, OPENMRS_WAR));                 File tempDir = new File(web, "WEB-INF");+                tempDir.mkdir();                 moduleInstaller.installModules(distroProperties.getModuleArtifacts(distroHelper, targetDirectory),                         new File(tempDir, WAR_FILE_MODULES_DIRECTORY_NAME).getAbsolutePath());                  File owasDir = new File(tempDir, "bundledOwas");-                owasDir.mkdirs();

Yeah, when I did the refactor of the setup task I eventually realized that a owasDir.mkdirs() call was actually accidentally being used to create the server directory itself. This made it very hard to reason about what was happening when. That gave me the belief that mkdirs should be used sparingly. It opens the door for code to get messy and dependent on what should be side-effects.

brandones

comment created time in 3 hours

pull request commentopenmrs/openmrs-distro-referenceapplication

RATEST-92:Failing Test: Contact Info Test

Untill this bug is fixed with in https://github.com/openmrs/openmrs-contrib-uitestframework/pull/45#issuecomment-867672505 , then this ticket will be able to work as expected, so i fixed two at once cc @k-joseph

sherrif10

comment created time in 3 hours

PullRequestEvent

Pull request review commentopenmrs/openmrs-module-reporting

REPORT-873: SQL reports to use cursors to iterate through datasets.

 void writeDataSet(DataSet dataset, OutputStream out, String textDelimiter, Strin 		w.write(lineEnding);
 
 		// data rows
-		for (DataSetRow row : dataset) {
-			for (Iterator<DataSetColumn> i = columns.iterator(); i.hasNext();) {
-				DataSetColumn column = i.next();
-				Object colValue = row.getColumnValue(column);
-				w.write(textDelimiter);
-				if (colValue != null) {
-                    String toPrint;
-					if (colValue instanceof Cohort) {
-                        toPrint = escape(Integer.toString(((Cohort) colValue).size()));
-					}
-					else if (colValue instanceof IndicatorResult) {
-                        toPrint = ((IndicatorResult) colValue).getValue().toString();
-					}
-					else if (dateFormat != null && colValue instanceof Date) {
-                        toPrint = dateFormat.format((Date)colValue);
-                    }
-					else {
-						// this check is because a logic EmptyResult .toString() -> null
-						String temp = escape(colValue.toString());
-						if (temp != null) {
-                            toPrint = temp;
-                        } else {
-                            toPrint = "";
-                        }
-					}
-                    w.write(filterBlacklist(toPrint, blacklist));
-				}
-				w.write(textDelimiter);
-				if (i.hasNext()) {
-					w.write(fieldDelimiter);
-				}
-			}
-			w.write(lineEnding);
-		}
-
+        if (dataset instanceof IterableSqlDataSet) {

Sure - I don't want to get too bogged down in this - I was just trying to make suggestions, not trying to be a blocker. If the entire PR is ready for review again, let me know.

icrc-loliveira

comment created time in 4 hours

pull request commentopenmrs/openmrs-contrib-uitestframework

RATEST-92:RATEST-92:Failing Test: Contact Info Test

Was it an oversight to leave the @ignore annotation on the test method that the ticket is resolving ?

sherrif10

comment created time in 4 hours

Pull request review commentopenmrs/openmrs-distro-referenceapplication

RATEST-117:EditPatientRelationshipPage

+package org.openmrs.reference.page;++import org.openmrs.uitestframework.page.Page;+import org.openqa.selenium.By;+import org.openqa.selenium.support.ui.Select;++public class EditPatientRelationshipPage  extends Page {++    private  HomePage homePage;+    private static String name = "john";+    private  static  final By SELECT_RELATIONSHIP_TYPE = By.id("relationship_type");+    private static final By NAME = By.cssSelector("button, input");+    private static final By NEXT_BUTTON = By.id("next-button");+    private static final By CONFIRM_BUTTON = By.id("registration-submit");+    ++    public EditPatientRelationshipPage(Page parent) {+        super(parent);+    }++    public void clickOnSelectRelationshipType() throws InterruptedException{+        clickOn(SELECT_RELATIONSHIP_TYPE);+        Select relationshipType = new Select(driver.findElement(By.id("relationship_type")));+        relationshipType.selectByVisibleText("Doctor");+        setTextToFieldNoEnter(NAME,name);+        clickOn(NEXT_BUTTON);

setTextToFieldNoEnter(NAME,name); allows the input of the string "john"

sherrif10

comment created time in 5 hours

Pull request review commentopenmrs/openmrs-module-fhir2

FM2-398: Integration tests for $lastn in R3 and R4

 public void shouldReturnCountForObservationAsXml() throws Exception { 		assertThat(result, hasProperty("total", equalTo(21))); 		 	}+	+	@Test+	public void shouldReturnLastnObservationsAsJson() throws Exception {+		MockHttpServletResponse response = get(+		    "Observation/$lastn?max=2&subject=" + OBS_PATIENT_UUID + "&category=laboratory&code=5242")+		            .accept(FhirMediaTypes.JSON).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(7)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries,+		    everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(OBS_PATIENT_UUID))))));+		assertThat(entries, everyItem(hasResource(+		    hasProperty("code", hasProperty("coding", everyItem(hasProperty("display", equalTo("Respiratory rate"))))))));+		assertThat(entries, everyItem(hasResource(hasProperty("category",+		    everyItem(hasProperty("coding", everyItem(hasProperty("code", equalTo("laboratory")))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 2), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenMaxIsMissingAsJson() throws Exception {+		MockHttpServletResponse response = get(+		    "Observation/$lastn?subject=" + OBS_PATIENT_UUID + "&category=laboratory&code=5242").accept(FhirMediaTypes.JSON)+		            .go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(2)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries,+		    everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(OBS_PATIENT_UUID))))));+		assertThat(entries, everyItem(hasResource(+		    hasProperty("code", hasProperty("coding", everyItem(hasProperty("display", equalTo("Respiratory rate"))))))));+		assertThat(entries, everyItem(hasResource(hasProperty("category",+		    everyItem(hasProperty("coding", everyItem(hasProperty("code", equalTo("laboratory")))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 1), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenPatientReferenceIsPassedInPatientParameterAsJson() throws Exception {+		MockHttpServletResponse response = get(+		    "Observation/$lastn?max=2&patient=" + OBS_PATIENT_UUID + "&category=laboratory&code=5242")+		            .accept(FhirMediaTypes.JSON).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(7)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries,+		    everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(OBS_PATIENT_UUID))))));+		assertThat(entries, everyItem(hasResource(+		    hasProperty("code", hasProperty("coding", everyItem(hasProperty("display", equalTo("Respiratory rate"))))))));+		assertThat(entries, everyItem(hasResource(hasProperty("category",+		    everyItem(hasProperty("coding", everyItem(hasProperty("code", equalTo("laboratory")))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 2), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenPatientReferenceIsMissingAsJson() throws Exception {+		MockHttpServletResponse response = get("Observation/$lastn?max=2&category=laboratory&code=5242")+		        .accept(FhirMediaTypes.JSON).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(7)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries, everyItem(hasResource(+		    hasProperty("code", hasProperty("coding", everyItem(hasProperty("display", equalTo("Respiratory rate"))))))));+		assertThat(entries, everyItem(hasResource(hasProperty("category",+		    everyItem(hasProperty("coding", everyItem(hasProperty("code", equalTo("laboratory")))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 2), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenCategoryIsMissingAsJson() throws Exception {+		MockHttpServletResponse response = get("Observation/$lastn?max=2&patient=" + OBS_PATIENT_UUID + "&code=5242")+		        .accept(FhirMediaTypes.JSON).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(7)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries,+		    everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(OBS_PATIENT_UUID))))));+		assertThat(entries, everyItem(hasResource(+		    hasProperty("code", hasProperty("coding", everyItem(hasProperty("display", equalTo("Respiratory rate"))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 2), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenCodeIsMissingAsJson() throws Exception {+		MockHttpServletResponse response = get(+		    "Observation/$lastn?max=2&subject=" + OBS_PATIENT_UUID + "&category=laboratory").accept(FhirMediaTypes.JSON)+		            .go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(17)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries,+		    everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(OBS_PATIENT_UUID))))));+		assertThat(entries, everyItem(hasResource(hasProperty("category",+		    everyItem(hasProperty("coding", everyItem(hasProperty("code", equalTo("laboratory")))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 2), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenNoParamterIsGivenAsJson() throws Exception {+		MockHttpServletResponse response = get("Observation/$lastn?").accept(FhirMediaTypes.JSON).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(14)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 1), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsAsXml() throws Exception {+		MockHttpServletResponse response = get(+		    "Observation/$lastn?max=2&subject=" + OBS_PATIENT_UUID + "&category=laboratory&code=5242")+		            .accept(FhirMediaTypes.XML).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(7)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries,+		    everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(OBS_PATIENT_UUID))))));+		assertThat(entries, everyItem(hasResource(+		    hasProperty("code", hasProperty("coding", everyItem(hasProperty("display", equalTo("Respiratory rate"))))))));+		assertThat(entries, everyItem(hasResource(hasProperty("category",+		    everyItem(hasProperty("coding", everyItem(hasProperty("code", equalTo("laboratory")))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 2), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenMaxIsMissingAsXml() throws Exception {+		MockHttpServletResponse response = get(+		    "Observation/$lastn?subject=" + OBS_PATIENT_UUID + "&category=laboratory&code=5242").accept(FhirMediaTypes.XML)+		            .go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(2)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries,+		    everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(OBS_PATIENT_UUID))))));+		assertThat(entries, everyItem(hasResource(+		    hasProperty("code", hasProperty("coding", everyItem(hasProperty("display", equalTo("Respiratory rate"))))))));+		assertThat(entries, everyItem(hasResource(hasProperty("category",+		    everyItem(hasProperty("coding", everyItem(hasProperty("code", equalTo("laboratory")))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 1), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenPatientReferenceIsPassedInPatientParameterAsXml() throws Exception {+		MockHttpServletResponse response = get(+		    "Observation/$lastn?max=2&patient=" + OBS_PATIENT_UUID + "&category=laboratory&code=5242")+		            .accept(FhirMediaTypes.XML).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(7)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries,+		    everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(OBS_PATIENT_UUID))))));+		assertThat(entries, everyItem(hasResource(+		    hasProperty("code", hasProperty("coding", everyItem(hasProperty("display", equalTo("Respiratory rate"))))))));+		assertThat(entries, everyItem(hasResource(hasProperty("category",+		    everyItem(hasProperty("coding", everyItem(hasProperty("code", equalTo("laboratory")))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 2), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenPatientReferenceIsMissingAsXml() throws Exception {+		MockHttpServletResponse response = get("Observation/$lastn?max=2&category=laboratory&code=5242")+		        .accept(FhirMediaTypes.XML).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(7)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries, everyItem(hasResource(+		    hasProperty("code", hasProperty("coding", everyItem(hasProperty("display", equalTo("Respiratory rate"))))))));+		assertThat(entries, everyItem(hasResource(hasProperty("category",+		    everyItem(hasProperty("coding", everyItem(hasProperty("code", equalTo("laboratory")))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 2), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenCategoryIsMissingAsXml() throws Exception {+		MockHttpServletResponse response = get("Observation/$lastn?max=2&patient=" + OBS_PATIENT_UUID + "&code=5242")+		        .accept(FhirMediaTypes.XML).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(7)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries,+		    everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(OBS_PATIENT_UUID))))));+		assertThat(entries, everyItem(hasResource(+		    hasProperty("code", hasProperty("coding", everyItem(hasProperty("display", equalTo("Respiratory rate"))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 2), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenCodeIsMissingAsXml() throws Exception {+		MockHttpServletResponse response = get(+		    "Observation/$lastn?max=2&subject=" + OBS_PATIENT_UUID + "&category=laboratory").accept(FhirMediaTypes.XML).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(17)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));+		assertThat(entries,+		    everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(OBS_PATIENT_UUID))))));+		assertThat(entries, everyItem(hasResource(hasProperty("category",+		    everyItem(hasProperty("coding", everyItem(hasProperty("code", equalTo("laboratory")))))))));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 2), is(true));+	}+	+	@Test+	public void shouldReturnLastnObservationsWhenNoParamterIsGivenAsXml() throws Exception {+		MockHttpServletResponse response = get("Observation/$lastn?").accept(FhirMediaTypes.XML).go();+		+		assertThat(response, isOk());+		assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));+		assertThat(response.getContentAsString(), notNullValue());+		+		Bundle results = readBundleResponse(response);+		+		assertThat(results, notNullValue());+		assertThat(results.getType(), equalTo(Bundle.BundleType.COLLECTION));+		assertThat(results.hasEntry(), is(true));+		assertThat(results, hasProperty("total", equalTo(14)));+		+		List<Bundle.BundleEntryComponent> entries = results.getEntry();+		+		assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/Observation/"))));+		assertThat(entries, everyItem(hasResource(instanceOf(Observation.class))));+		assertThat(entries, everyItem(hasResource(validResource())));++		assertThat(checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(entries, 1), is(true));+	}+	+	private boolean checkDistinctObsDateTimeInEachCodeGroupIsSortedAndWithinMax(List<Bundle.BundleEntryComponent> entries, int max) {

This should probably be implemented as a custom matcher rather than a long test that only returns a boolean value. The advantage is that a custom matcher allows us to actually describe the error that caused the test to fail with as much detail as possible. See, e.g., this article or some of the custom matchers in the BaseFhirIntegrationTest class for what this might look like.

Medhavi-16

comment created time in 6 hours

Pull request review commentopenmrs/openmrs-module-fhir2

FM2-400: Support for $lastn-encounters in R4

 protected void setupSearchParams(Criteria criteria, SearchParameterMap theParams 			} 		}); 	}+	+	private int getMaxParameter(SearchParameterMap theParams) {

It would maybe be a good idea to try to refactor this and getTopNRankedUuids() into utility classes so we can prevent code duplication. Maybe instead of having a LastnEncountersResults and LastnObservationResult we can get away with a LastnResult object which holds the UUID and relevant date then something like a HashMap to store other properties (e.g., concept)

Medhavi-16

comment created time in 6 hours

pull request commentopenmrs/openmrs-distro-referenceapplication

RATEST-91:Failing Test:Book Request Appointment Test https://issues.o…

@insookwa have you tested locally on all instances and the test is passing ?

insookwa

comment created time in 6 hours

PR opened openmrs/openmrs-ocl-client

OCLOMRS-989: Create a feature file for Create dictionary for automated test

JIRA TICKET NAME:

Create a feature file for Create dictionary for automated test

Summary:

I created feature files and step description for create dictionary ready for automated testing.

+252 -0

0 comment

2 changed files

pr created time in 6 hours

Pull request review commentopenmrs/openmrs-module-coreapps

RA-1926: Merge Visits: Remove visitId from URL to prevent NPE if that visit was merged

 public Object controller(@RequestParam("patientId") Patient patient,      public String post(@RequestParam("patientId") Patient patient,                        @RequestParam("mergeVisits") List<Integer> mergeVisits,-					   @RequestParam(value = "returnUrl", required = false) String returnUrl,+                       @RequestParam(value = "returnUrl", required = false) String returnUrl,                        @SpringBean AdtService service,                        UiUtils ui,-                       HttpServletRequest request, PageModel model){+                       HttpServletRequest request, PageModel model) { +        List<String> mergedVisitIds = new ArrayList<String>();         if (patient.isVoided() || patient.isPersonVoided()) {             return "redirect:" + ui.pageLink("coreapps", "patientdashboard/deletedPatient",-					SimpleObject.create("patientId", patient.getId().toString() ));+                    SimpleObject.create("patientId", patient.getId().toString()));         } -        if (mergeVisits!=null && mergeVisits.size() > 0 ){+        if (mergeVisits != null && mergeVisits.size() > 0) {             Visit mergedVisit = service.mergeConsecutiveVisits(mergeVisits, patient);-            if (mergedVisit != null){+            if (mergedVisit != null) {                 request.getSession().setAttribute(AppUiConstants.SESSION_ATTRIBUTE_INFO_MESSAGE, ui.message("coreapps.task.mergeVisits.success"));                 request.getSession().setAttribute(AppUiConstants.SESSION_ATTRIBUTE_TOAST_MESSAGE, "true");-            }else{+            } else {                 request.getSession().setAttribute("emr.errorMessage", ui.message("coreapps.task.mergeVisits.error"));                 request.getSession().setAttribute(AppUiConstants.SESSION_ATTRIBUTE_TOAST_MESSAGE, "true");             }++            for (int i = 1; i < mergeVisits.size(); i++) {

Did you intentionally start with index 1 instead of 0?

icrc-jfigueiredo

comment created time in 6 hours

Pull request review commentopenmrs/openmrs-sdk

SDK-288 SDK build-distro should build SPA application

 private String buildDistro(File targetDirectory, Artifact distroArtifact, Distro             try {                 ZipFile warfile = new ZipFile(new File(web, OPENMRS_WAR));                 File tempDir = new File(web, "WEB-INF");+                tempDir.mkdir();                 moduleInstaller.installModules(distroProperties.getModuleArtifacts(distroHelper, targetDirectory),                         new File(tempDir, WAR_FILE_MODULES_DIRECTORY_NAME).getAbsolutePath());                  File owasDir = new File(tempDir, "bundledOwas");-                owasDir.mkdirs();

Was the change from mkdirs to mkdir intentional?

brandones

comment created time in 6 hours

PR opened openmrs/openmrs-distro-referenceapplication

RATEST-91:Failing Test:Book Request Appointment Test https://issues.o…

I deleted the other pull request and all the changes are covered already. I have removed the @ignore
kindly review https://issues.openmrs.org/browse/RATEST-91 @k-joseph @kdaud

+0 -2

0 comment

1 changed file

pr created time in 7 hours

PR closed openmrs/openmrs-distro-referenceapplication

Ratest 91:RATEST-91:Failing Test: Book Request Appointment Test

Fixed this test. please kindly review https://issues.openmrs.org/browse/RATEST-91

+0 -0

2 comments

0 changed file

insookwa

pr closed time in 7 hours