Skip to content

Commit

Permalink
Merge pull request #73 from UST-QuAntiL/feature/-result-quality-timel…
Browse files Browse the repository at this point in the history
…ine-filter

feature: filter timeline steps by result quality
  • Loading branch information
infacc authored Oct 30, 2023
2 parents 487d430 + 2566c69 commit af5c307
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ <h1 class="t-page-headline align-arrow">Experiment Timeline</h1>
[value]="unclearedSubstepValue.value">{{unclearedSubstepValue.viewValue}}
</mat-radio-button>
</mat-radio-group>
<br>
<mat-form-field>
<mat-label>Result quality</mat-label>
<mat-select [(ngModel)]="resultQuality" (ngModelChange)="updatePageContent()">
<mat-option [value]="''">Not Selected</mat-option>
<mat-option *ngFor="let resultQualityValue of resultQualityValues"
[value]="resultQualityValue">{{resultQualityValue.charAt(0).toUpperCase() + resultQualityValue.slice(1).toLowerCase()}}
</mat-option>
</mat-select>
</mat-form-field>
</mat-expansion-panel>

<div class="page-item-list">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router';
import { Observable, Subscription, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { CurrentExperimentService } from 'src/app/services/current-experiment.service';
import { QhanaBackendService, TimelineStepApiObject } from 'src/app/services/qhana-backend.service';
import { ExperimentResultQuality, ExperimentResultQualityValues, QhanaBackendService, TimelineStepApiObject } from 'src/app/services/qhana-backend.service';
import { ServiceRegistryService } from 'src/app/services/service-registry.service';

interface SelectValue {
Expand Down Expand Up @@ -50,6 +50,8 @@ export class ExperimentTimelineComponent implements OnInit, OnDestroy {
{ value: 1, viewValue: "Only steps with uncleared substeps" },
{ value: -1, viewValue: "Only steps with cleared substeps" }
];
resultQuality: ExperimentResultQuality | "" = "";
resultQualityValues = ExperimentResultQualityValues;

constructor(private route: ActivatedRoute, private experiment: CurrentExperimentService, private backend: QhanaBackendService, private serviceRegistry: ServiceRegistryService) { }

Expand Down Expand Up @@ -99,6 +101,7 @@ export class ExperimentTimelineComponent implements OnInit, OnDestroy {
version: this.version ?? "",
stepStatus: this.stepStatus,
unclearedSubstep: this.unclearedSubstep,
resultQuality: this.resultQuality,
}).pipe(
map(value => {
if (this.currentPage !== currentRequest) {
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/timeline-step/timeline-step.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BehaviorSubject, Observable, Subject, Subscription, from, of, timer } f
import { catchError, concatMap, debounceTime, filter, mergeAll, mergeMap, take, throttleTime } from 'rxjs/operators';
import { ApiLink, CollectionApiObject, PageApiObject } from 'src/app/services/api-data-types';
import { CurrentExperimentService } from 'src/app/services/current-experiment.service';
import { QhanaBackendService, TimelineStepApiObject, TimelineSubStepApiObject } from 'src/app/services/qhana-backend.service';
import { ExperimentResultQuality, QhanaBackendService, TimelineStepApiObject, TimelineSubStepApiObject } from 'src/app/services/qhana-backend.service';
import { PluginRegistryBaseService } from 'src/app/services/registry.service';
import { TabDefinition } from '../timeline-step-nav/timeline-step-nav.component';

Expand Down Expand Up @@ -46,7 +46,7 @@ export class TimelineStepComponent implements OnInit, OnDestroy {
];

timelineStep: TimelineStepApiObject | null = null;
resultQuality: "UNKNOWN" | "NEUTRAL" | "GOOD" | "BAD" | "ERROR" | "UNUSABLE" = "UNKNOWN";
resultQuality: ExperimentResultQuality = "UNKNOWN";
stepProcessor: Promise<string | null> | null = null;
stepProgress: Progress | null = null;
substeps: TimelineSubStepApiObject[] | null = null;
Expand Down Expand Up @@ -248,7 +248,7 @@ export class TimelineStepComponent implements OnInit, OnDestroy {
});
}

saveResultQuality(newQuality: "UNKNOWN" | "NEUTRAL" | "GOOD" | "BAD" | "ERROR" | "UNUSABLE") {
saveResultQuality(newQuality: ExperimentResultQuality) {
if (this.stepId == null) {
return;
}
Expand Down
11 changes: 8 additions & 3 deletions src/app/services/qhana-backend.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import { Observable, Subject } from 'rxjs';
import { filter, map, mergeMap, take } from 'rxjs/operators';
import { ServiceRegistryService } from './service-registry.service';

export const ExperimentResultQualityValues = ["UNKNOWN", "NEUTRAL", "GOOD", "BAD", "ERROR", "UNUSABLE"] as const;
export type ExperimentResultQuality = typeof ExperimentResultQualityValues[number];

export interface ApiObject {
"@self": string;
}
Expand Down Expand Up @@ -142,7 +145,7 @@ export interface TimelineStepApiObject extends ApiObject {
start: string;
end: string;
status: string;
resultQuality: "UNKNOWN" | "NEUTRAL" | "GOOD" | "BAD" | "ERROR" | "UNUSABLE";
resultQuality: ExperimentResultQuality;
resultLog?: string;
notes: string;
processorName: string;
Expand Down Expand Up @@ -175,6 +178,7 @@ export interface TimelineStepPageOptions {
version?: string;
stepStatus?: "SUCCESS" | "PENDING" | "ERROR" | "";
unclearedSubstep?: number;
resultQuality?: ExperimentResultQuality | "";
}

export interface TemplateApiObject extends ApiObject {
Expand Down Expand Up @@ -446,12 +450,13 @@ export class QhanaBackendService {
);
}

public getTimelineStepsPage(experimentId: number | string, { page = 0, itemCount = 10, sort = 1, pluginName = "", version = "", stepStatus = "", unclearedSubstep = 0 }: TimelineStepPageOptions): Observable<ApiObjectList<TimelineStepApiObject>> {
public getTimelineStepsPage(experimentId: number | string, { page = 0, itemCount = 10, sort = 1, pluginName = "", version = "", stepStatus = "", unclearedSubstep = 0, resultQuality = "", }: TimelineStepPageOptions): Observable<ApiObjectList<TimelineStepApiObject>> {
const queryParams = new HttpParams()
.append("plugin-name", pluginName)
.append("version", version)
.append("status", stepStatus)
.append("uncleared-substep", unclearedSubstep)
.append("result-quality", resultQuality)
.append("page", page)
.append("item-count", itemCount)
.append("sort", sort);
Expand Down Expand Up @@ -486,7 +491,7 @@ export class QhanaBackendService {
);
}

public saveTimelineStepResultQuality(experimentId: number | string, step: number | string, newQuality: "UNKNOWN" | "NEUTRAL" | "GOOD" | "BAD" | "ERROR" | "UNUSABLE"): Observable<null> {
public saveTimelineStepResultQuality(experimentId: number | string, step: number | string, newQuality: ExperimentResultQuality): Observable<null> {
return this.callWithRootUrl<null>(
rootUrl => this.http.put<null>(`${rootUrl}/experiments/${experimentId}/timeline/${step}`, { resultQuality: newQuality })
);
Expand Down

0 comments on commit af5c307

Please sign in to comment.