Skip to content

Commit

Permalink
Merge branch 'release-0.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Tan committed Apr 18, 2017
2 parents d04e9ae + 39d8514 commit 879b2fd
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 56 deletions.
44 changes: 34 additions & 10 deletions src/Pmi/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,38 @@ public function homeAction(Application $app, Request $request)
// metrics attributes are hard-coded as we don't have human-readable names in the API yet
$metrics_attributes = $this->getMetricsDisplayNames();

// assemble list of centers for filter controls
try {
$all_centers = $app['db']->fetchAll("SELECT * FROM recruitment_center_codes");
$center_codes = $this->getMetricsFieldDefinitions($app, 'Participant.hpoId');
} catch (\Exception $e) {
$all_centers = [];
$center_codes = [];
}

// remove UNSET value as we don't care about this for the filters
if(($key = array_search('UNSET', $center_codes)) !== false) {
unset($center_codes[$key]);
}

$all_centers = array();
$recruitment_centers = array();
$i = 5;

// build up array of centers with categories, lat/long and provisional targets
foreach($center_codes as $code) {
try {
$center = $app['db']->fetchAssoc("SELECT * FROM recruitment_center_codes WHERE code = ?", array($code));
} catch (\Exception $e) {
$center = ['code' => $code, 'label' => $code, 'latitude' => '33.0000', 'longitude' => '-71.' . $i . '000', 'category' => 'Unknown', 'recruitment_target' => 10000];
$i++;
}

if (!$center) {
// in case center isn't found in DB
$center = ['code' => $code, 'label' => $code, 'latitude' => '33.0000', 'longitude' => '-71.' . $i . '000', 'category' => 'Unknown', 'recruitment_target' => 10000];
$i++;
}
array_push($all_centers, $center);
}

foreach($all_centers as $center) {
$category = $center['category'];
if (!array_key_exists($category, $recruitment_centers)) {
Expand All @@ -40,7 +65,6 @@ public function homeAction(Application $app, Request $request)
$recruitment_centers[$category][] = $center;
}
}

return $app['twig']->render('dashboard/index.html.twig', [
'color_profiles' => $color_profiles,
'metrics_attributes' => $metrics_attributes,
Expand Down Expand Up @@ -286,7 +310,7 @@ public function metrics_load_regionAction(Application $app, Request $request)

// make sure metrics data exists first, if metrics cache or API fail return value will be false
if (!empty($metrics)) {
if ($map_mode == 'Participant.state') {
if ($map_mode == 'FullParticipant.state') {
$state_registrations = [];
$hover_text = [];
$state_names = [];
Expand Down Expand Up @@ -349,7 +373,7 @@ public function metrics_load_regionAction(Application $app, Request $request)
"titleside" => 'right'
)
);
} else if ($map_mode == 'Participant.censusRegion') {
} else if ($map_mode == 'FullParticipant.censusRegion') {
$states_by_region = [];
$registrations_by_state = [];
$region_text = [];
Expand Down Expand Up @@ -421,7 +445,7 @@ public function metrics_load_regionAction(Application $app, Request $request)
"titleside" => 'right'
)
);
} else if ($map_mode == 'Participant.hpoId') {
} else if ($map_mode == 'FullParticipant.hpoId') {
$i = 0;
try {
$recruitment_centers = $app['db']->fetchAll("SELECT * FROM recruitment_center_codes");
Expand Down Expand Up @@ -551,6 +575,8 @@ public function metrics_load_lifecycleAction(Application $app, Request $request)
$lookup = $metric_val . '.FULL_PARTICIPANT';
} elseif ($metric_val == 'Participant.physicalMeasurements') {
$lookup = $metric_val . '.COMPLETED';
} elseif ($metric_val == 'Participant.numCompletedBaselinePPIModules') {
$lookup = $metric_val . '.3';
} else {
$lookup = $metric_val . '.SUBMITTED';
}
Expand Down Expand Up @@ -587,15 +613,13 @@ public function metrics_load_lifecycleAction(Application $app, Request $request)
// now that we have counts (in order), go back through to determine what the elibible numbers are
// this is based off of external logic, so cannot be done while assembling counts

$completed_consent = $completed[2];
$completed_consent = $completed[1];

foreach($metrics_keys as $index => $val) {
if ($val == 'Participant') {
$eligible[] = 0;
} elseif ($val == 'Participant.consentForStudyEnrollment') {
$eligible[] = $completed[0] - $completed[$index];
} elseif ($val == 'Participant.consentForStudyEnrollmentAndEHR') {
$eligible[] = $completed[1] - $completed[$index];
} else {
$eligible[] = $completed_consent - $completed[$index] < 0 ? 0 : $completed_consent - $completed[$index];
}
Expand Down
47 changes: 31 additions & 16 deletions src/Pmi/Controller/HelpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class HelpController extends AbstractController
['videos', '/videos'],
['faq', '/faq'],
['sop', '/sop'],
['sopPdf', '/sop/viewer/{filename}']
['sopPdf', '/sop/viewer/{filename}'],
['sopDownload', '/sop/download/{filename}']
];

private function getStoragePath(Application $app)
Expand Down Expand Up @@ -43,19 +44,19 @@ public function sopAction(Application $app)
'title' => 'Physical Measurements for DVs and HPOs',
'documents' => [
[
'title' => 'SOP-012 HPO Blood Pressure Measurement',
'title' => 'SOP-012.01 HPO Blood Pressure Measurement',
'filename' => 'SOP-012.01 HPO Blood Pressure Measurement.pdf'
],
[
'title' => 'SOP-013 HPO Heart Rate Measurement',
'title' => 'SOP-013.01 HPO Heart Rate Measurement',
'filename' => 'SOP-013.01 HPO Heart Rate Measurement.pdf'
],
[
'title' => 'SOP-014 HPO Height and Weight Measurement',
'title' => 'SOP-014.01 HPO Height and Weight Measurement',
'filename' => 'SOP-014.01 HPO Height and Weight Measurement.pdf'
],
[
'title' => 'SOP-015 HPO Waist-Hip Circumference Measurement',
'title' => 'SOP-015.01 HPO Waist-Hip Circumference Measurement',
'filename' => 'SOP-015.01 HPO Waist-Hip Circumference Measurement.pdf'
]
]
Expand All @@ -64,56 +65,65 @@ public function sopAction(Application $app)
'title' => 'Biobank Standard Operating Procedures for HPO',
'documents' => [
[
'title' => 'SOP-001 HPO Creating a PMI Biobank Order and Printing Specimen Label and Test Requisition',
'title' => 'SOP-001.02 HPO Creating a PMI Biobank Order and Printing Specimen Label and Test Requisition',
'filename' => 'SOP-001.02 HPO Creating a PMI Biobank Order and Printing Specimen Labels and Test Requisition.pdf'
],
[
'title' => 'SOP-003 HPO Blood Specimens Collection and Processing',
'title' => 'SOP-003.02 HPO Blood Specimens Collection and Processing',
'filename' => 'SOP-003.02 HPO Blood Specimens Collection and Processing.pdf'
],
[
'title' => 'SOP-005 HPO Urine Specimen Collection',
'title' => 'SOP-005.02 HPO Urine Specimen Collection',
'filename' => 'SOP-005.02 HPO Urine Specimen Collection.pdf'
],
[
'title' => 'SOP-007 HPO Saliva Oragene Collection',
'title' => 'SOP-007.02 HPO Saliva Oragene Collection',
'filename' => 'SOP-007.02 HPO Saliva Oragene Collection.pdf'
],
[
'title' => 'SOP-009 HPO Packaging and Shipping PMI Specimens',
'title' => 'SOP-009.02 HPO Packaging and Shipping PMI Specimens',
'filename' => 'SOP-009.02 HPO Packaging and Shipping PMI Specimens.pdf'
],
[
'title' => 'SOP-010 HPO Ordering Supplies from MML',
'title' => 'SOP-010.02 HPO Ordering Supplies from MML',
'filename' => 'SOP-010.02 HPO Ordering Supplies from MML.pdf'
],
[
'title' => 'HPO SOP Changes Presentation 04-12-2017',
'filename' => 'HPO SOP Changes Presentation 04-12-2017.pptx'
]
]
],
[
'title' => 'Biobank Standard Operating Procedures for DV',
'documents' => [
[
'title' => 'SOP-002 DV Registering a PMI Kit and Creating a PMI Biobank Order',
'title' => 'SOP-002.02 DV Registering a PMI Kit and Creating a PMI Biobank Order',
'filename' => 'SOP-002.02 DV Registering a PMI Kit and Creating a PMI Biobank Order.pdf'
],
[
'title' => 'SOP-004 DV Blood Specimens Collection and Processing',
'title' => 'SOP-004.02 DV Blood Specimens Collection and Processing',
'filename' => 'SOP-004.02 DV Blood Specimens Collection and Processing.pdf'
],
[
'title' => 'SOP-006 DV Urine Specimen Collection',
'title' => 'SOP-006.02 DV Urine Specimen Collection',
'filename' => 'SOP-006.02 DV Urine Specimen Collection.pdf'
],
[
'title' => 'SOP-011 DV Packaging and Shipping PMI Specimens',
'title' => 'SOP-011.02 DV Packaging and Shipping PMI Specimens',
'filename' => 'SOP-011.02 DV Packaging and Shipping PMI Specimens.pdf'
],
[
'title' => 'DV SOP Changes Presentation 04-12-2017',
'filename' => 'DV SOP Changes Presentation 04-12-2017.pptx'
]
]
]
];

return $app['twig']->render('help/sop.html.twig', [
'documentGroups' => $documentGroups
'documentGroups' => $documentGroups,
'path' => $this->getStoragePath($app)
]);
}

Expand All @@ -131,4 +141,9 @@ public function sopPdfAction(Application $app, $filename)
'path' => $this->getStoragePath($app)
]);
}

public function sopDownloadAction(Application $app, $filename)
{
return $app->redirect($this->getStoragePath($app) . '/' . rawurlencode($filename));
}
}
29 changes: 14 additions & 15 deletions views/dashboard/dashboard_help.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,18 @@
metrics include:</p>
<ul>
<li><strong>Total Participants</strong> (registered)</li>
<li><strong>Registration Status</strong> (registered vs. consented vs. full participants)</li>
<li><strong>Registration Status</strong> (interested vs. registered vs. full participants)</li>
<li><strong>Gender Identity</strong></li>
<li><strong>Age Range</strong></li>
<li><strong>Ethinicity</strong></li>
<li><strong>Race</strong></li>
</ul>
<p>The Total Progress to date plot has an additional start date to specify a discrete range of dates to calculate
(this defaults to one week from the current date). You can also choose to see of rollup of values bucketed
by days, weeks, or months by using the <strong>Interval</strong> dropdown. On bar charts, you can display
column totals above each bar by clicking <strong>Show Column Totals</strong>.</p>
<p>Registrations Status is a composite metrics that is determined by taking counts of consented</p>
<h4 class="text-primary">Participants by Region</h4>
<p>The Participants by Region plot is a choropleth map of the United States showing several participant
metrics that correspond to geographic locations. These include:</p>
<p>The Participants by Region plot is a choropleth map of the United States showing counts of consented participants
that correspond to geographic locations. These include:</p>
<ul>
<li><strong>State</strong> of residence</li>
<li><strong>Census Region</strong> of residence</li>
Expand All @@ -52,7 +50,7 @@
<p>The values shown on the map are calculated as a percentage against that particular metric's target goal for
the current year. For States & Census Regions, this is one-third of one percent (0.333%) of the total
population recorded in the 2010 United States Census. For Recruitment Origin, this is the target
registration goal for the associated center.</p>
total registration goal for the associated center.</p>
<p>The <strong>Color Profile</strong> dropdown allows you to re-color the map in a variety of shades (this
only applies to the State and Census Region metrics).</p>
<h4 class="text-primary">Participants by Lifecycle Phase</h4>
Expand All @@ -61,21 +59,22 @@
how many participants have completed the upstream events. The time points show are:</p>
<ul>
<li><strong>Registered</strong></li>
<li><strong>Consent for Enrollment</strong></li>
<li><strong>Consent for Health Records</strong></li>
<li><strong>PPI Module on Sociodemographics</strong></li>
<li><strong>PPI Module on Overall Health</strong></li>
<li><strong>PPI Module on Medical History</strong></li>
<li><strong>Physical Measurements</strong></li>
<li><strong>Sample Collection</strong></li>
<li><strong>Full Participants</strong></li>
<li><strong>Consent for enrollment</strong></li>
<li><strong>Consent completed (both enrollment and health records)</strong></li>
<li><strong>PPI module on lifestyle</strong></li>
<li><strong>PPI module on overall health</strong></li>
<li><strong>PPI module on 'the basics'</strong></li>
<li><strong>Baseline PPI modules completed (3 previous PPI modules)</strong></li>
<li><strong>Physical measurements recorded</strong></li>
<li><strong>Samples received</strong></li>
<li><strong>Full participants</strong></li>
</ul>
<p>For the Registration, Consent, PPI modules, and Physical Measurements milestones, we are counting participants
who have completed these milestones. Sample collection is defined as participants
for whom <em>4ml of blood or saliva</em> has been collected and received. Full Participants are defined as any
participant that has completed all of the above milestones.</p>
<p>Eligibility for Consent is defined as any participant that has registered. Eligibility for any milestone
from PPI modules onward is defined as any participant that has completed both Consent milestones.</p>
from PPI modules onward is defined as any participant that has completed the primary consent for enrollment.</p>
</div>
<div class="modal-footer">
<button class="close" data-dismiss="modal">×</button>
Expand Down
16 changes: 6 additions & 10 deletions views/dashboard/filters.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@
<h4>Recruitment Origin <a href="javascript:;" class="toggle-all-filters label label-primary pull-right">All <span class="fa fa-toggle-on"></span></a></h4>
{% for group, centers in recruitment_centers %}
<ul class="list-group {{ group }}-center-filters">
{% if group != 'Misc' %}
<li class="list-group-item"><h4 class="list-group-item-heading">{{ group }}
{% if centers|length > 1 %}
<a href="javascript:;" class="toggle-center-filters label label-primary pull-right" data-identifier="{{ group }}-center-filters">Group <span class="fa fa-toggle-on"></span></a>
{% endif %}
</h4>
</li>
{% endif %}
<li class="list-group-item"><h4 class="list-group-item-heading">{{ group }}
{% if centers|length > 1 %}
<a href="javascript:;" class="toggle-center-filters label label-primary pull-right" data-identifier="{{ group }}-center-filters">Group <span class="fa fa-toggle-on"></span></a>
{% endif %}
</h4>
</li>
{% for center in centers %}
<li class="list-group-item">
{% if center['code'] is defined %}
{% set identifier = center['code'] %}
{% else %}
{% set identifier = center['id'] %}
{% endif %}
<label><input type="checkbox" name="recruitment_centers[]" value="{{ identifier }}" class="center-filter" checked> {{ center['label'] }}</label>
</li>
Expand Down
Loading

0 comments on commit 879b2fd

Please sign in to comment.