Skip to content

Commit 7e4850e

Browse files
Merge pull request #37 from vathes/dev
merging dev to master for official deploy
2 parents ab3ff35 + fd45787 commit 7e4850e

File tree

6 files changed

+48
-36
lines changed

6 files changed

+48
-36
lines changed

backend/iblapi.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
API_PREFIX = '/v{}'.format(API_VERSION)
2525
is_gunicorn = "gunicorn" in os.environ.get("SERVER_SOFTWARE", "")
2626

27-
2827
def mkvmod(mod):
2928
return dj.create_virtual_module(
3029
mod, dj.config.get('database.prefix', '') + 'ibl_{}'.format(mod))
@@ -243,9 +242,14 @@ def handle_q(subpath, args, proj, fetch_args=None, **kwargs):
243242
# expected format of brain_regions = ["AB", "ABCa", "CS of TCV"]
244243
if regions is not None and len(regions) > 0:
245244
region_restr = [{'acronym': v} for v in regions]
246-
brain_restriction = histology.ProbeBrainRegionTemp() & region_restr
247-
# keep the temp table for internal site since temp table has more entries for internal users to see
248-
# for public site replace ProbeBrainRegionTemp() with ProbeBrainRegion() table.
245+
246+
if os.environ.get('API_MODE') in ['private', None]:
247+
brain_restriction = histology.ProbeBrainRegionTemp() & region_restr
248+
elif os.environ.get('API_MODE') == 'public':
249+
brain_restriction = histology.ProbeBrainRegion() & region_restr
250+
else:
251+
raise Exception('Invalid API_MODE, it should either be not defined / private / public, please check your environment variables.')
252+
249253
else:
250254
brain_restriction = {}
251255
# q = ((acquisition.Session() * sess_proj * psych_curve * ephys_data * subject.Subject()*
@@ -323,17 +327,19 @@ def handle_q(subpath, args, proj, fetch_args=None, **kwargs):
323327
q = (ephys.DefaultCluster & args).proj(..., *exclude_attrs) * ephys.DefaultCluster.Metrics.proj('firing_rate')
324328
print(q)
325329
elif subpath == 'probetrajectory':
326-
# keep the provenance and temp table for internal site
327-
traj = histology.ProbeTrajectoryTemp * histology.Provenance
330+
if os.environ.get('API_MODE') in ['private', None]:
331+
traj = histology.ProbeTrajectoryTemp * histology.Provenance
328332

329-
traj_latest = traj * (dj.U('subject_uuid', 'session_start_time', 'probe_idx', 'provenance') & \
330-
(ephys.ProbeInsertion & args).aggr(traj, provenance='max(provenance)'))
333+
traj_latest = traj * (dj.U('subject_uuid', 'session_start_time', 'probe_idx', 'provenance') & \
334+
(ephys.ProbeInsertion & args).aggr(traj, provenance='max(provenance)'))
331335

332-
q = traj * (dj.U('subject_uuid', 'session_start_time', 'probe_idx', 'provenance') & \
333-
(ephys.ProbeInsertion & args).aggr(traj, provenance='max(provenance)'))
336+
q = traj * (dj.U('subject_uuid', 'session_start_time', 'probe_idx', 'provenance') & \
337+
(ephys.ProbeInsertion & args).aggr(traj, provenance='max(provenance)'))
338+
elif os.environ.get('API_MODE') == 'public':
339+
q = histology.ProbeTrajectory & args
340+
else:
341+
raise Exception('Invalid API_MODE, it should either be not defined / private / public, please check your environment variables.')
334342

335-
# for public site we don't need the trajectory source info (uses provenance) anymore so -> traj = histology.ProbeTrajectory
336-
# or basically for public -> q = histology.ProbeTrajectory & args
337343
elif subpath == 'rasterlight':
338344
# q = plotting_ephys.RasterLinkS3 & args
339345
q = plotting_ephys.Raster & args # temp test table
@@ -430,12 +436,6 @@ def post_process(ret):
430436
parsed_items.append(parsed_item)
431437
return parsed_items
432438
elif subpath == 'depthbrainregions':
433-
# depth_region = histology.DepthBrainRegionTemp * histology.Provenance
434-
435-
# q = depth_region * (dj.U('subject_uuid', 'session_start_time', 'probe_idx', 'provenance') &
436-
# (ephys.ProbeInsertion & args).aggr(depth_region, provenance='max(provenance)'))
437-
438-
# NEW: test this before deploy to internal
439439
q = histology.DepthBrainRegion & args
440440
elif subpath == 'spinningbrain':
441441
q = plotting_histology.SubjectSpinningBrain & args

docker-compose-base.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ x-net: &net
88
services:
99
iblapi:
1010
<<: *net
11-
image: registry.vathes.com/ibl-navigator/iblapi:v0.5.0 # for internal demo
11+
image: registry.vathes.com/ibl-navigator/iblapi:v0.5.1 # for internal demo
1212
# image: registry.vathes.com/ibl-navigator/iblapi:v0.1.0-public # for public demo
1313
environment:
1414
- DJ_USER=maho
@@ -31,7 +31,7 @@ services:
3131
#cpu_period: 100ms
3232
ibl-navigator:
3333
<<: *net
34-
image: registry.vathes.com/ibl-navigator/frontend:v0.4.0 # for internal demo
34+
image: registry.vathes.com/ibl-navigator/frontend:v0.4.1 # for internal demo
3535
# image: registry.vathes.com/ibl-navigator/frontend:v0.1.0-public # for public demo
3636
healthcheck:
3737
test: curl --fail http://localhost:9000 || exit 1

ibl-frontend/frontend-content/src/app/cell-list/cell-list.component.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@ td span.oi {
122122
margin-top: 15px;
123123
}
124124

125+
.depth-peth-not-available {
126+
border: 1px solid gray;
127+
margin: 12px;
128+
width: 400px;
129+
height: 300px;
130+
display: flex;
131+
justify-content: center;
132+
align-items: center;
133+
}
134+
125135
.order-button-content .radio-option,
126136
.alternative_plot_buttons .radio-option {
127137
padding-right: 15px;
@@ -154,6 +164,9 @@ td span.oi {
154164
padding-right: 10px;
155165
}
156166

167+
.cluster-nav-plot-area {
168+
padding-left: 12px;
169+
}
157170
.cluster-nav-plot-area > .yaxis-selector-plot-area {
158171
display: flex;
159172
flex-direction: row;

ibl-frontend/frontend-content/src/app/cell-list/cell-list.component.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h6>(Total clusters for probe {{probeIndex}}: {{cellsByProbeIns.length}})</h6>
6767

6868
<div class="row">
6969
<br />
70-
<div class="cluster-nav-plot-area col-10 col-xl-6">
70+
<div class="cluster-nav-plot-area">
7171
<div *ngIf="plot_data_processed && plot_data_processed[0]" class="yaxis-selector-plot-area">
7272
<div class="alternative_plot_buttons y_axis">
7373
<label for="y_label"><b>y axis</b></label>
@@ -106,7 +106,7 @@ <h6>(Total clusters for probe {{probeIndex}}: {{cellsByProbeIns.length}})</h6>
106106
</div>
107107
</div>
108108

109-
<div class="depth-peth-plot-area col-10 col-xl-4" *ngIf="depthPethLookup[eventType]['layout']">
109+
<div class="depth-peth-plot-area">
110110
<div class="order-buttons col-10">
111111

112112
<div class="order-button-content">
@@ -125,9 +125,12 @@ <h6>(Total clusters for probe {{probeIndex}}: {{cellsByProbeIns.length}})</h6>
125125
</div>
126126
</div>
127127
</div>
128-
<div>
128+
<div *ngIf="!depthPethIsLoading && depthPethLookup[eventType] && depthPethLookup[eventType]['data']">
129129
<plotly-plot [data]="depthPethLookup[eventType]['data']" [layout]="depthPethLookup[eventType]['layout']" [config]="depthPethLookup[eventType]['config']"></plotly-plot>
130130
</div>
131+
<div *ngIf="!depthPethIsLoading && (!depthPethLookup[eventType] || !depthPethLookup[eventType]['data'])" class="depth-peth-not-available">
132+
<p>Depth PETH plot not available for this session</p>
133+
</div>
131134
</div>
132135
<div [class]="minimizeController? 'plots-navigator minimize': 'plots-navigator'" *ngIf="showController">
133136
<div *ngIf="cells" class="clusterListContainer">
@@ -160,7 +163,7 @@ <h3><span class="oi oi-arrow-circle-top" (click)="navigate_cell_plots($event, 'u
160163
<h3><span class="oi oi-arrow-circle-bottom" (click)="navigate_cell_plots($event, 'down')"></span></h3>
161164
</div>
162165
</div>
163-
166+
<br />
164167
<div class="rasterPlotSelectors col-8">
165168
<div class="order-buttons col-4">
166169
<label for="event"><b>Event</b></label>

ibl-frontend/frontend-content/src/app/cell-list/cell-list.component.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export class CellListComponent implements OnInit, OnDestroy, DoCheck {
9292
depthPETH;
9393
depthPethTemplates = {};
9494
depthPethLookup = {};
95+
depthPethIsLoading = false;
9596

9697
spikeAmpTimeLookup = {};
9798
spikeAmpTime;
@@ -674,6 +675,7 @@ export class CellListComponent implements OnInit, OnDestroy, DoCheck {
674675

675676
/////++++++///// start of grabbing depth PETH plot info /////++++++/////
676677
this.cellListService.getDepthPethTemplate();
678+
this.depthPethIsLoading = true;
677679
this.depthPethTemplateSubscription = this.cellListService.getDepthPethTemplateLoadedListener()
678680
.subscribe((dpTemplates) => {
679681
// console.log('depth PETH templates retrieved: ', dpTemplates[0]);
@@ -691,12 +693,8 @@ export class CellListComponent implements OnInit, OnDestroy, DoCheck {
691693
}
692694
this.depthPethSubscription = this.cellListService.getDepthPethLoadedListener()
693695
.subscribe((plotInfo) => {
694-
this.depthPETHtimeB = new Date()
695-
// console.log('retrieved depth PETH data - took ', this.depthPETHtimeB-this.depthPETHtimeA, 'ms')
696696
this.depthPETH = deepCopy(plotInfo);
697-
// console.log('depth PETH retrieved for session: ', plotInfo);
698697
for (let plot of Object.values(plotInfo)) {
699-
// console.log("this.depthPethTemplates[plot['depth_peth_template_idx']]: ", this.depthPethTemplates)
700698
this.depthPethLookup[plot['event']]['data'] = deepCopy(this.depthPethTemplates[plot['depth_peth_template_idx']]['data'])
701699
this.depthPethLookup[plot['event']]['layout'] = deepCopy(this.depthPethTemplates[plot['depth_peth_template_idx']]['layout'])
702700
let depth_peth_config_copy = {...this.depthPETH_config};
@@ -724,15 +722,12 @@ export class CellListComponent implements OnInit, OnDestroy, DoCheck {
724722

725723
this.depthPethLookup[plot['event']]['config'] = depth_peth_config_copy
726724
}
727-
// console.log('this.DepthPethLookup: ', this.depthPethLookup)
728725
if (this.depthPethLookup['movement'] && Object.keys(this.depthPethLookup['movement']).length == 0) {
729726
this.depthPethEventLacksMovement = true;
730727
} else {
731728
this.depthPethEventLacksMovement = false;
732729
}
733-
// console.log('depthPethEventLacksMovement: ', this.depthPethEventLacksMovement);
734-
this.depthPETHtimeC = new Date()
735-
// console.log('depth PETH done plotting - took: ', this.depthPETHtimeC-this.depthPETHtimeB, 'ms')
730+
this.depthPethIsLoading = false;
736731
});
737732

738733

ibl-frontend/frontend-content/src/app/session-list/session-list.component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,6 @@ export class SessionListComponent implements OnInit, OnDestroy {
532532
* @returns
533533
*/
534534
getFiltersRequests(focusedField?: string) {
535-
// console.log("shoulnd't be using getFIltersREquest anymore returning")
536535
return;
537536
const filterList = Object.entries(this.session_filter_form.getRawValue());
538537
const brainRegionRequest = this.requested_BR;
@@ -786,7 +785,6 @@ export class SessionListComponent implements OnInit, OnDestroy {
786785
* @returns
787786
*/
788787
async applyFilter(focusFieldKey?: string) {
789-
let t0 = performance.now()
790788
if (!this.allSessions) {
791789
return [];
792790
}
@@ -801,7 +799,7 @@ export class SessionListComponent implements OnInit, OnDestroy {
801799

802800
// Check if there is a brain region request, if so override the tupleToRestrict reference
803801
const brainRegionRequest = this.requested_BR;
804-
if (brainRegionRequest !== []) {
802+
if (brainRegionRequest.length !== 0) {
805803
// BrainRegionRequest is not empty, thus query the backend for it
806804
let requestFilter = {}
807805
let BR_JSONstring = '';
@@ -822,6 +820,9 @@ export class SessionListComponent implements OnInit, OnDestroy {
822820
requestFilter['__json_kwargs'] = '{ "brain_regions": ' + BR_JSONstring + '}';
823821
}
824822

823+
// Add the default sorting for the api request
824+
requestFilter['__order'] = 'session_start_time DESC';
825+
825826
// Query back end
826827
tupleToRestrict = await this.allSessionsService.fetchSessions(requestFilter).toPromise();
827828
}
@@ -1089,7 +1090,7 @@ export class SessionListComponent implements OnInit, OnDestroy {
10891090
return newData;
10901091
}
10911092

1092-
filterNode(node, word, selectAll){
1093+
filterNode(node, word, selectAll) {
10931094
let children = []
10941095
let newNode = {
10951096
display: node.display,

0 commit comments

Comments
 (0)