Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,8 @@
<dataset name="BehaviorAbstract" id="5015" category="ColonyManagement" type="Standard">
<tags/>
</dataset>
<dataset name="cases" id="6020" category="Clinical" type="Standard">
<tags/>
</dataset>
</datasets>
</datasets>
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<tables xmlns="http://labkey.org/data/xml">
<!-- Case dataset added just to clear errors for common EHR components -->
<table tableName="cases" tableDbType="TABLE">
<columns>
<column columnName="Id">
<datatype>varchar</datatype>
<propertyURI>http://cpas.labkey.com/Study#ParticipantId</propertyURI>
<importAliases>
<importAlias>ptid</importAlias>
</importAliases>
</column>
<column columnName="date">
<datatype>timestamp</datatype>
<propertyURI>http://cpas.labkey.com/Study#VisitDate</propertyURI>
<conceptURI>http://cpas.labkey.com/Study#VisitDate</conceptURI>
</column>
<column columnName="enddate">
<datatype>timestamp</datatype>
<propertyURI>urn:ehr.labkey.org/#EndDate</propertyURI>
</column>
<column columnName="caseid">
<datatype>varchar</datatype>
<propertyURI>urn:ehr.labkey.org/#CaseId</propertyURI>
</column>
<column columnName="reviewdate">
<datatype>timestamp</datatype>
</column>
<column columnName="category">
<datatype>varchar</datatype>
</column>
<column columnName="problemCategory">
<datatype>varchar</datatype>
</column>
<column columnName="problemSubcategory">
<datatype>varchar</datatype>
</column>
<column columnName="plan">
<datatype>varchar</datatype>
</column>
<column columnName="vetreview">
<datatype>varchar</datatype>
<propertyURI>urn:ehr.labkey.org/#VetReview</propertyURI>
</column>
<column columnName="vetreviewdate">
<datatype>timestamp</datatype>
<propertyURI>urn:ehr.labkey.org/#VetReviewDate</propertyURI>
</column>
</columns>
<tableTitle>Cases</tableTitle>
</table>
<!-- -->
<table tableName="breeding_encounters" tableDbType="TABLE">
<description>Contains one row for each breeding pairing/assignment for a dam at the center.</description>
<columns>
Expand Down
1 change: 0 additions & 1 deletion WNPRC_EHR/resources/views/dataAdmin.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
{queryName: 'dental_teeth', schemaName: 'ehr_lookups', title: 'Dental Teeth Field'},

{queryName: 'encounter_types', schemaName: 'ehr_lookups', title: 'Encounter Types'},
{queryName: 'error_types', schemaName: 'ehr_lookups', title: 'Error Report Error Types'},
{queryName: 'gender_codes', schemaName: 'ehr_lookups', title: 'Gender Codes'},
{queryName: 'geographic_origins', schemaName: 'ehr_lookups', title: 'Geographic Origin Codes'},
{queryName: 'hematology_method', schemaName: 'ehr_lookups', title: 'Hematology Method'},
Expand Down
10 changes: 0 additions & 10 deletions WNPRC_EHR/resources/views/ehrAdmin.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
items: [
{name: 'Client Errors', url: '<%=contextPath%>' + '/shared/query-executeQuery.view?schemaName=auditlog&query.queryName=Client%20API%20Actions'},
{name: 'EHR Backups', url: '<%=contextPath%><%=containerPath%>/Backups/project-begin.view'},
{name: 'ETL Admin', url: '<%=contextPath%><%=containerPath%>/onprc_ehr-etlAdmin.view'},
{name: 'Genetics Calculations', url: '<%=contextPath%><%=containerPath%>/ehr-geneticCalculationSettings.view'},
//{name: 'ETL Duration', url: '<%=contextPath%><%=containerPath%>/query-executeQuery.view?schemaName=core&query.queryName=Sync Duration'},
//{name: 'ETL History', url: '<%=contextPath%><%=containerPath%>/query-executeQuery.view?schemaName=core&query.queryName=Sync History'},
Expand Down Expand Up @@ -41,15 +40,6 @@
{header: 'Logs',
items: [
{name: 'All Logs', url: '<%=contextPath%><%=containerPath%>/Logs/project-begin.view'},
{name: 'Labkey.log', url: '<%=contextPath%>/files<%=containerPath%>/Logs/%40filesets/Tomcat%20Logs/labkey.log'},
{name: 'Labkey-errors.log', url: '<%=contextPath%>/files<%=containerPath%>/Logs/%40filesets/Tomcat%20Logs/labkey-errors.log'},
{name: 'ETL Log', url: '<%=contextPath%>/files<%=containerPath%>/Logs/%40filesets/Tomcat%20Logs/ehr-etl.log'},
{name: 'ETL Errors Log', url: '<%=contextPath%>/files<%=containerPath%>/Logs/%40filesets/Tomcat%20Logs/ehr-etl-errors.log'},
{name: 'ActiveMQ.log', url: '<%=contextPath%>/files<%=containerPath%>/Logs/%40filesets/ActiveMQ/activemq.log'},
{name: 'Monit.log', url: '<%=contextPath%>/files<%=containerPath%>/Logs/%40filesets/Monit/monit.log'},
{name: 'Munin.log', url: '<%=contextPath%>/files<%=containerPath%>/Logs/%40filesets/Munin/munin.log'},
{name: 'Inbreeding Coefficients Reload Cron Job Log', url: '<%=contextPath%>/files<%=containerPath%>/Logs/%40filesets/Kinship/kinshipOut.txt'},
{name: 'Kinship Reload Cron Job Log', url: '<%=contextPath%>/files<%=containerPath%>/Logs/%40filesets/Kinship/inbreedingOut.txt'}
]
},
{header: 'Notifications',
Expand Down
1 change: 0 additions & 1 deletion WNPRC_EHR/resources/views/moreReports.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
header: 'Reports',
items: [
{name: 'Blood Needlesticks', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/query-executeQuery.view?schemaName=study&query.queryName=bloodNeedlesticks'},
{name: 'Housing By Room and Cage', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/query-executeQuery.view?schemaName=study&query.queryName=housingByRoomCage'},
{name: 'Per Diems (in testing)', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/query-executeQuery.view?schemaName=study&query.queryName=PerDiems'},
{name: 'Per Diems Raw Data (in testing)', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/query-executeQuery.view?schemaName=study&query.queryName=PerDiemsByDay'},
{name: 'Restraints Used', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/query-executeQuery.view?schemaName=study&query.queryName=restraintUsed'},
Expand Down
5 changes: 5 additions & 0 deletions WNPRC_EHR/src/org/labkey/wnprc_ehr/WNPRC_EHRModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@
import org.labkey.api.query.DetailsURL;
import org.labkey.api.query.QuerySchema;
import org.labkey.api.resource.Resource;
import org.labkey.api.security.Directive;
import org.labkey.api.security.User;
import org.labkey.api.security.roles.RoleManager;
import org.labkey.api.view.WebPartFactory;
import org.labkey.api.view.template.ClientDependency;
import org.labkey.filters.ContentSecurityPolicyFilter;
import org.labkey.wnprc_ehr.bc.BCReportRunner;
import org.labkey.wnprc_ehr.buttons.ChangeBloodQCButton;
import org.labkey.wnprc_ehr.buttons.CreateTaskButton;
Expand Down Expand Up @@ -193,6 +195,9 @@ protected void init() {
addController(CONTROLLER_NAME, WNPRC_EHRController.class);
addController(TEST_CONTROLLER_NAME, WNPRC_EHRTestController.class);

ContentSecurityPolicyFilter.registerAllowedSources("bs_style", Directive.Style, "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css");
ContentSecurityPolicyFilter.registerAllowedSources("bs_font", Directive.Font, "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/fonts/");

registerRoles();
registerPermissions();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,36 +135,46 @@ public TreeMap<LocalDate, PopulationInstant> getPopulationOverTimeForSpecies(Pop
Map<LocalDate, Integer> deltasPerDate = new HashMap<>();
Integer animalsAtStart = 0;

for( String id : animalsBySpeciesId.get(species)) {
AnimalEventSet animalEventSet = animalEventSetsById.get(id);
for( StintAtPrimateCenter stint: animalEventSet.getStints() ) {
// Null startdate is okay...
LocalDate startDate = (stint.getStartDay() == null) ? null : new LocalDate(stint.getStartDay());
LocalDate endDate = ( stint.getEndDay() == null) ? null : new LocalDate(stint.getEndDay());


// Increment the counter for start of stints, if there was a start
if (startDate != null) {
Integer currentStartDelta = deltasPerDate.get(startDate);
if (currentStartDelta == null) {
currentStartDelta = 0;
if (animalsBySpeciesId.get(species) != null)
{
for (String id : animalsBySpeciesId.get(species))
{
AnimalEventSet animalEventSet = animalEventSetsById.get(id);
for (StintAtPrimateCenter stint : animalEventSet.getStints())
{
// Null startdate is okay...
LocalDate startDate = (stint.getStartDay() == null) ? null : new LocalDate(stint.getStartDay());
LocalDate endDate = (stint.getEndDay() == null) ? null : new LocalDate(stint.getEndDay());


// Increment the counter for start of stints, if there was a start
if (startDate != null)
{
Integer currentStartDelta = deltasPerDate.get(startDate);
if (currentStartDelta == null)
{
currentStartDelta = 0;
}
deltasPerDate.put(startDate, currentStartDelta + 1);
}
else
{
// If there wasn't a start, assume the animal was always in the colony
animalsAtStart++;
}
deltasPerDate.put(startDate, currentStartDelta + 1);
}
else {
// If there wasn't a start, assume the animal was always in the colony
animalsAtStart++;
}

// Decrement the counter for end of stints, if there was an end
if ( endDate != null) {
Integer currentEndDelta = deltasPerDate.get(endDate);
if ( currentEndDelta == null ) {
currentEndDelta = 0;
// Decrement the counter for end of stints, if there was an end
if (endDate != null)
{
Integer currentEndDelta = deltasPerDate.get(endDate);
if (currentEndDelta == null)
{
currentEndDelta = 0;
}
deltasPerDate.put(endDate, currentEndDelta - 1);
}
deltasPerDate.put(endDate, currentEndDelta - 1);
}

}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
dependencies.add("fullcalendar");
}
%>
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js" nonce="<%=getScriptNonce()%>" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<%--<script src='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.6.0/fullcalendar.js'></script>--%>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" nonce="<%=getScriptNonce()%>">
<%--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css">--%>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.min.js" integrity="sha512-HWlJyU4ut5HkEj0QsK/IxBCY55n5ZpskyjVlAoV9Z7XQwwkqXoYdCIC93/htL3Gu5H3R4an/S0h2NXfbZk3g7w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js" integrity="sha512-eYSzo+20ajZMRsjxB6L7eyqo5kuXuS2+wEbbOkpaur+sA2shQameiJiWEzCIDwJqaB0a4a6tCuEvCOBHUg3Skg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.min.js" nonce="<%=getScriptNonce()%>" integrity="sha512-HWlJyU4ut5HkEj0QsK/IxBCY55n5ZpskyjVlAoV9Z7XQwwkqXoYdCIC93/htL3Gu5H3R4an/S0h2NXfbZk3g7w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js" nonce="<%=getScriptNonce()%>" integrity="sha512-eYSzo+20ajZMRsjxB6L7eyqo5kuXuS2+wEbbOkpaur+sA2shQameiJiWEzCIDwJqaB0a4a6tCuEvCOBHUg3Skg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js" nonce="<%=getScriptNonce()%>"></script>
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.min.js" nonce="<%=getScriptNonce()%>"></script>
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed

<%
SimpleQueryFactory queryFactory = new SimpleQueryFactory(getUser(), getContainer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

%>

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />

<style type="text/css">
/* Full Calendar heading */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void renderGridCellContents(RenderContext ctx, HtmlWriter out)
String formType = (String) ctx.get(new FieldKey(getBoundColumn().getFieldKey().getParent(), "formtype"));
String qcState = (String) ctx.get(new FieldKey(getBoundColumn().getFieldKey().getParent(), "QCState$Label"));

if (isExt4Form("form", formType))
if (formType != null && isExt4Form("form", formType))
{
ActionURL url = new ActionURL("ehr", "dataEntryForm.view", us.getContainer());
if ("Research Ultrasounds".equalsIgnoreCase(formType))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ public static void doSetup() throws Exception

initTest.updateEHRFormFrameworkTypes();

initTest.addWnprcEHRWebparts();
initTest._containerHelper.createSubfolder(EHR_FOLDER_PATH, "About The EHR", "Collaboration");
initTest._containerHelper.createSubfolder(EHR_FOLDER_PATH, "Backups", "Collaboration");
initTest._containerHelper.createSubfolder(EHR_FOLDER_PATH + "/Backups", "Gems Backups", "Collaboration");
initTest.addWNPRCGroups();

initTest.createEHRLinkedSchema("/" + EHR_FOLDER_PATH); // Needed for query validation
initTest._schemaHelper.createLinkedSchema("/" + EHR_FOLDER_PATH, "PublicSOPs", "/" + EHR_FOLDER_PATH, null, "lists", null, null);

Expand Down Expand Up @@ -281,7 +287,9 @@ public static void doSetup() throws Exception

initTest.checkUpdateProgramIncomeAccount();

initTest.notificationRevampSetup(); //TODO: to uncomment, fix issue mentioned here - https://www.labkey.org/WNPRC/support%20tickets/issues-details.view?issueId=51256
initTest.notificationRevampSetup();

initTest.populateAnimalRequestTableLookups();
}

private void billingSetup() throws Exception
Expand Down Expand Up @@ -389,6 +397,40 @@ private void addProcedureQueries() throws IOException, CommandException
log("Inserted " + numRows + " into ehr_billing.procedureQueryChargeIdAssoc table.");
}

@Override
protected List<String> skipLinksForCrawling()
{
List<String> links = new ArrayList<>(super.skipLinksForCrawling());
links.add("wnprc_ehr-PerDiems.view");
links.add("wnprc_ehr-WaterCalendar.view");
Comment on lines +406 to +407
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain why these actions are skipped

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

links.add("wnprc_ehr-NecropsySchedule.view");
return links;
}

@Override
protected List<String> skipLinksForValidation()
{
List<String> links = new ArrayList<>(super.skipLinksForValidation());
links.add("query-executeQuery.view?query.queryName=Current%20Colony%20Condition&schemaName=study");
links.add("query-executeQuery.view?schemaName=col_dump&query.queryName=mysql_check");
// links.add("ehr-dataEntryFormDetails.view?formtype=Enter%20Water%20Orders&taskid=");
links.add("wnprc_ehr-UnscheduleBCReports.view");
links.add("wnprc_ehr-ScheduleBCReports.view");
links.add("Documentation/Admin/project-begin.view");
links.add("Documentation/Data Management/project-begin.view");
links.add("Development Notes/project-begin.view");
links.add("/Logs/project-begin.view");
Comment on lines +413 to +429
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain why these actions are skipped

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return links;
}

private void addWNPRCGroups()
{
_permissionsHelper.createGlobalPermissionsGroup("veterinarians (LDAP)");
_permissionsHelper.createGlobalPermissionsGroup("compliance (LDAP)");
_permissionsHelper.createGlobalPermissionsGroup("animalcare (LDAP)");
_permissionsHelper.createGlobalPermissionsGroup("pathology (LDAP)");
}

@LogMethod
@Override
protected void createTestSubjects() throws Exception
Expand Down Expand Up @@ -655,6 +697,18 @@ private void addFinanceRelatedWebParts(String container)
(new PortalHelper(this)).addWebPart("WNPRC Finance Admin");
}

private void addWnprcEHRWebparts()
{
log("Add WNPRC EHR Webparts.");

//enable Page Admin Mode
new SiteNavBar(getDriver()).enterPageAdminMode();

(new PortalHelper(this)).removeAllWebParts();
(new PortalHelper(this)).addWebPart("WNPRC Electronic Health Record ");
(new PortalHelper(this)).addWebPart("wnprcUnits");
Comment thread
labkey-martyp marked this conversation as resolved.
Outdated
}

private void addBillingPublicWebParts()
{
log("Add WNPRC Billing PI Portal Section to PI Portal page.");
Expand Down Expand Up @@ -3185,6 +3239,7 @@ public void populateLookupValsDirect(String setName, String valName, String val)

public void populateAnimalRequestTableLookups() throws IOException, CommandException
{
goToEHRFolder();

populateLookupSet("animal_requests_sex");
populateLookupVals("animal_requests_sex", "value", "M");
Expand Down Expand Up @@ -3317,7 +3372,7 @@ public void testAnimalRequestFormSubmit() throws IOException, CommandException
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter);
goToEHRFolder();
populateAnimalRequestTableLookups();

navigateToAnimalRequestForm();
waitForText("Comments:");
//it's a timing issue. we have to wait until the form is loaded for it to be clickable.
Expand Down Expand Up @@ -3425,6 +3480,7 @@ public void updateProgramIncomeAccountWithValidPermissions() throws UnhandledAle
fillAnInputByName("newCreditToAccountField", "testString");
click(Locator.tagWithId("button","updateCreditToAccountButton"));

sleep(2000);
//Verifies the value has been changed, then continues. If value has not been changed, the test fails here.
assertEquals("Updated Program Income Account with invalid permissions.", "testString", Locator.id("ctaCell1").findElement(getDriver()).getText());
Comment thread
labkey-martyp marked this conversation as resolved.
Outdated

Expand Down