Skip to content

Commit 6fb5ce4

Browse files
author
Phillip Weller
committed
R1.5RC
1 parent 31a2da1 commit 6fb5ce4

39 files changed

Lines changed: 60077 additions & 100 deletions

app/Actionability.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,15 @@ public function assertions()
238238
{
239239
if ($assertion->attributed_to->label == "Adult Actionability Working Group")
240240
{
241-
$new->adult_report_date = Carbon::parse($assertion->report_date)->format('Y-m-d H:i:s.0000');
241+
$new->adult_report_date = (empty($assertion->report_date) ? null : Carbon::parse($assertion->report_date)->format('Y-m-d H:i:s.0000'));
242242
$new->adult_source = $assertion->source;
243243
$new->adult_attributed_to = $assertion->attributed_to->label;
244244
$new->adult_classification = $assertion->classification->label;
245245

246246
}
247247
if ($assertion->attributed_to->label == "Pediatric Actionability Working Group")
248248
{
249-
$new->pediatric_report_date = Carbon::parse($assertion->report_date)->format('Y-m-d H:i:s.0000');
249+
$new->pediatric_report_date = (empty($assertion->report_date) ? null : Carbon::parse($assertion->report_date)->format('Y-m-d H:i:s.0000'));
250250
$new->pediatric_source = $assertion->source;
251251
$new->pediatric_attributed_to = $assertion->attributed_to->label;
252252
$new->pediatric_classification = $assertion->classification->label;
@@ -304,15 +304,15 @@ public function assertions()
304304
}
305305
if ($assertion->attributed_to->label == "Adult Actionability Working Group")
306306
{
307-
$new->adult_report_date = Carbon::parse($assertion->report_date)->format('Y-m-d H:i:s.0000');
307+
$new->adult_report_date = (empty($assertion->report_date) ? null : Carbon::parse($assertion->report_date)->format('Y-m-d H:i:s.0000'));
308308
$new->adult_source = $assertion->source;
309309
$new->adult_attributed_to = $assertion->attributed_to->label;
310310
$new->adult_classification = $assertion->classification->label;
311311

312312
}
313313
if ($assertion->attributed_to->label == "Pediatric Actionability Working Group")
314314
{
315-
$new->pediatric_report_date = Carbon::parse($assertion->report_date)->format('Y-m-d H:i:s.0000');
315+
$new->pediatric_report_date = (empty($assertion->report_date) ? null : Carbon::parse($assertion->report_date)->format('Y-m-d H:i:s.0000'));
316316
$new->pediatric_source = $assertion->source;
317317
$new->pediatric_attributed_to = $assertion->attributed_to->label;
318318
$new->pediatric_classification = $assertion->classification->label;

app/Change.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,29 @@ public function scopeFilters($query, $filters)
306306
});
307307
}
308308

309+
// panels
310+
$groups = preg_grep('/^\!.*/', $genes);
311+
foreach ($groups as $group)
312+
{
313+
// get list genes
314+
$panel = Panel::ident(substr($group, 1))->first();
315+
316+
// if this is a non-recurrent report, build a psuedo region
317+
if ($panel === null)
318+
{
319+
continue;
320+
}
321+
322+
323+
$genes = $panel->genes();
324+
325+
$items = $genes->collection->pluck('name');
326+
327+
$query = $query->orWhereHas('element', function ($query) use ($items) {
328+
$query->whereIn('name', $items);
329+
});
330+
}
331+
309332
}
310333

311334
/*$a = vsprintf(str_replace('?', '%s', $query->toSql()), collect($query->getBindings())->map(function ($binding) {

app/Console/Commands/QueryJira.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use DB;
88

9-
use App\Gene;
109
use App\Jira;
1110

1211
class QueryJira extends Command
@@ -47,7 +46,17 @@ public function handle()
4746

4847

4948
$record = Jira::getIssue('ISCA-4799');
49+
$record = Jira::getHistory('ISCA-4799');
5050

51+
/*$response = Jira::getIssues('project = ISCA AND issuetype in ("ISCA Region Curation") AND Resolution = Complete');
52+
53+
if (empty($response))
54+
return $collection;
55+
;
56+
foreach ($response->issues as $issue)
57+
{
58+
dd($issue);
59+
}*/
5160
dd($record);
5261

5362
echo "Update Complete\n";

app/Console/Commands/QueryOMS.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,16 @@ public function handle()
8989
$alternate_id = (intval($entry['affiliation_id']) >= 40000 && intval($entry['affiliation_id']) < 50000) ?
9090
intval($entry['affiliation_id']) - 30000 : null;
9191

92-
//echo $entry['affiliation_id'] . "\n";
92+
// cleanup the html apostrophe
93+
$entry['title'] = str_replace('&#039;', "'", $entry['title']);
94+
95+
if(!empty($entry['title_short']))
96+
$entry['title_short'] = str_replace('&#039;', "'", $entry['title_short']);
97+
98+
if(!empty($entry['title_abbreviated']))
99+
$entry['title_abbreviated'] = str_replace('&#039;', "'", $entry['title_abbreviated']);
100+
101+
93102
Panel::updateOrCreate(
94103
['affiliate_id' => $entry['affiliation_id']],
95104
[

app/Console/Commands/RunCheck.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use App\GeneLib;
1111
use App\Health;
1212
use App\Validity;
13+
use App\Actionability;
14+
use App\Sensitivity;
15+
use App\Variantpath;
1316

1417
class RunCheck extends Command
1518
{
@@ -113,12 +116,29 @@ public function handle()
113116

114117
echo "Genegraph OK ($hash)\n";
115118

116-
// update validy table (this is a trial to see impact during production)
119+
echo "Checking for Validity changes...";
120+
// update validy table
117121
$model = new Validity();
118122
$model->assertions();
123+
echo "DONE\n";
119124

125+
echo "Checking for actionability changes...";
126+
// update actionability
127+
$model = new Actionability();
128+
$model->assertions();
129+
echo "DONE\n";
130+
131+
echo "Checking for dosage changes...";
132+
// update actionability
133+
$model = new Sensitivity();
134+
$model->assertions();
135+
echo "DONE\n";
120136

121-
// now check and update dosage related tables
137+
//echo "Checking for variant changes...";
138+
// update variant
139+
//$model = new Variantpath();
140+
//$model->assertions();
141+
//echo "DONE\n";
122142

123143
}
124144
}

app/Console/Commands/UpdateFollow.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ public function handle()
5757
foreach ($moreusers as $moreuser)
5858
$users->push($moreuser);
5959

60+
$moreusers = User::doesntHave('genes')->doesntHave('groups')->has('panels')->with('panels')->get();
61+
62+
foreach ($moreusers as $moreuser)
63+
$users->push($moreuser);
64+
65+
// run unique to remove unintended duplication
66+
$users = $users->unique('id');
67+
6068
$history = [];
6169

6270
foreach ($users as $user)
@@ -118,7 +126,7 @@ public function handle()
118126
$cc = preg_split('/[\s,;]+/', $notify->secondary['email']);
119127
$mail->cc($cc);
120128
}
121-
129+
122130
$mail->send(new NotifyFrequency(['report' => $title->ident, 'date' => $date, 'genes' => $genes, 'name' => $user->name, 'content' => 'this is the custom message']));
123131
}
124132
}

app/Graphql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ classification {
631631
}
632632

633633
$node->dosage_curation_map = $dosage_curation_map;
634-
634+
//dd($node);
635635
return $node;
636636
}
637637

app/Http/Controllers/Api/FollowController.php

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use App\Gene;
1616
use App\Notification;
1717
use App\Group;
18+
use App\Panel;
1819

1920
class FollowController extends Controller
2021
{
@@ -172,6 +173,24 @@ public function create(ApiRequest $request)
172173

173174
$notification->save();
174175
}
176+
else if ($input['gene'][0] == '!')
177+
{
178+
$name = $input['gene'];
179+
$panel = Panel::ident(substr($name, 1))->first();
180+
181+
$hasit = $user->panels()->where('panel.id', $panel->id)->exists();
182+
183+
if (($panel !== null) && ($hasit === false))
184+
{
185+
$user->panels()->attach($panel->id);
186+
}
187+
188+
$bucket = $notification->checkGroup($name);
189+
if ($bucket === false)
190+
$notification->addDefault($name);
191+
192+
$notification->save();
193+
}
175194
else
176195
{
177196

@@ -299,6 +318,30 @@ public function remove(ApiRequest $request)
299318
if ($bucket !== false)
300319
$notification->removeGroup($group->name, $bucket);
301320
}
321+
else if ($input['gene'][0] == '!')
322+
{
323+
$name = $input['gene'];
324+
325+
$ident = substr($input['gene'], 1);
326+
327+
$panel = Panel::ident($ident)->first();
328+
329+
if ($panel === null)
330+
return response()->json(['success' => 'false',
331+
'status_code' => 2021,
332+
'gene' => $ident,
333+
'message' => "Panel Lookup Error"],
334+
501);
335+
336+
$user->panels()->detach($panel->id);
337+
338+
$bucket = $notification->checkGroup($name);
339+
340+
if ($bucket !== false)
341+
$notification->removeGroup($name, $bucket);
342+
343+
$name = $panel->smart_title;
344+
}
302345
else
303346
{
304347

@@ -307,7 +350,7 @@ public function remove(ApiRequest $request)
307350
if ($gene === null)
308351
return response()->json(['success' => 'false',
309352
'status_code' => 2001,
310-
'gene' => $name,
353+
'gene' => $input['gene'],
311354
'message' => "Gene Lookup Error"],
312355
501);
313356

@@ -337,7 +380,7 @@ public function remove(ApiRequest $request)
337380
return response()->json(['success' => 'true',
338381
'status_code' => 200,
339382
'gene' => $name,
340-
'message' => 'Gene UnFollowed'],
383+
'message' => 'Item UnFollowed'],
341384
200);
342385

343386
}
@@ -410,8 +453,8 @@ public function reload()
410453

411454
foreach ($user->panels as $panel)
412455
{
413-
$gene = new Gene(['name' => $panel->name,
414-
'hgnc_id' => $panel->affiliate_id,
456+
$gene = new Gene(['name' => $panel->smart_title,
457+
'hgnc_id' => '!' . $panel->ident,
415458
'activity' => ['dosage' => false, 'pharma' => false, 'varpath' => false, 'validity' => false, 'actionability' => false],
416459
'type' => 4,
417460
'date_last_curated' => ''
@@ -451,6 +494,29 @@ public function dare_expand(Request $request, $group = null)
451494
->with('group', $region)
452495
->with('genes', $genes->collection);
453496
}
497+
498+
499+
/**
500+
* Expand a panel entry row.
501+
*
502+
* @return \Illuminate\Contracts\Support\Renderable
503+
*/
504+
public function dape_expand(Request $request, $group = null)
505+
{
506+
if (empty($group))
507+
return "Panel not found";
508+
509+
$panel = Panel::ident($group)->first();
510+
511+
if ($panel === null)
512+
return "Panel not found";
513+
514+
$genes = $panel->genes;
515+
516+
return view('dashboard.includes.expand-panel')
517+
->with('group', $panel)
518+
->with('genes', $genes);
519+
}
454520
/*
455521
@foreach ($genes as $gene)
456522
<tr data-hgnc="{{ $gene->hgnc_id }}">

app/Http/Controllers/Api/HomeController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ public function notify(Request $request)
8484
{
8585
$name = $input['gene'];
8686
}
87+
else if ($input['gene'][0] == '!')
88+
{
89+
$name = $input['gene'];
90+
}
8791
else if ($input['gene'][0] == '%')
8892
{
8993
$name = $input['gene'];

app/Http/Controllers/Api/SettingsController.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,28 @@ public function update(Request $request)
149149
$panel = Panel::ident($input['ident'])->first();
150150
if ($panel !== null)
151151
{
152+
$notification = $user->notification;
153+
152154
if ($input['value'] == 1){
153155
$user->panels()->syncWithoutDetaching([$panel->id]);
156+
157+
$bucket = $notification->checkGroup('!' . $input['ident']);
158+
159+
if ($bucket === false)
160+
$notification->addDefault('!' . $input['ident']);
161+
154162
}
155163
else {
156164
$user->panels()->detach($panel->id);
165+
166+
$bucket = $notification->checkGroup('!' . $input['ident']);
167+
168+
if ($bucket !== false)
169+
$notification->removeGroup('!' . $input['ident'], $bucket);
170+
157171
}
172+
173+
$notification->save();
158174
}
159175
break;
160176

0 commit comments

Comments
 (0)