Skip to content

Commit

Permalink
Merge branch 'main' into chore_add_more_userflow_integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
jctello authored Sep 5, 2024
2 parents 9392306 + 45ab732 commit 9941e87
Show file tree
Hide file tree
Showing 8 changed files with 1,587 additions and 3,167 deletions.
4,650 changes: 1,555 additions & 3,095 deletions report-builder/package-lock.json

Large diffs are not rendered by default.

27 changes: 13 additions & 14 deletions report-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^18.0.1",
"@angular/cdk": "^18.0.1",
"@angular/common": "^18.0.1",
"@angular/compiler": "^18.0.1",
"@angular/core": "^18.0.1",
"@angular/forms": "^18.0.1",
"@angular/material": "^18.0.1",
"@angular/platform-browser": "^18.0.1",
"@angular/router": "^18.0.1",
"@angular/animations": "^18.2.3",
"@angular/cdk": "^18.2.3",
"@angular/common": "^18.2.3",
"@angular/compiler": "^18.2.3",
"@angular/core": "^18.2.3",
"@angular/forms": "^18.2.3",
"@angular/material": "^18.2.3",
"@angular/platform-browser": "^18.2.3",
"@angular/router": "^18.2.3",
"@apidevtools/json-schema-ref-parser": "^11.6.2",
"@codemirror/autocomplete": "^6.11.1",
"@codemirror/commands": "^6.3.3",
Expand Down Expand Up @@ -48,12 +48,12 @@
"tslib": "^2.3.0",
"userflow.js": "^2.12.1",
"util": "^0.12.5",
"zone.js": "~0.14.0"
"zone.js": "~0.14.10"
},
"devDependencies": {
"@angular/build": "^18.0.2",
"@angular/cli": "^18.0.2",
"@angular/compiler-cli": "^18.0.1",
"@angular/build": "^18.2.3",
"@angular/cli": "^18.2.3",
"@angular/compiler-cli": "^18.2.3",
"@types/jasmine": "~5.1.0",
"@types/node": "^16.18.105",
"@types/three": "^0.164.0",
Expand All @@ -68,7 +68,6 @@
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"postcss": "^8.4.38",
"protractor": "~7.0.0",
"tailwindcss": "^3.4.3",
"ts-node": "~10.9.0",
"typescript": "~5.4.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}
<mat-form-field class="w-full mt-0 rounded-0" floatLabel="always">
<mat-label>Generate chart</mat-label>
<textarea matInput placeholder="What do you want to see..." [(ngModel)]="question"></textarea>
<textarea matInput placeholder="What do you want to see..." [(ngModel)]="question" (keyup.enter)="generateChart()"></textarea>
</mat-form-field>
<div class="flex justify-end">
<button mat-flat-button color="primary" (click)="generateChart()" [disabled]="(question ?? '').length === 0 || _status.generating">Generate</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class AiChartInputComponent {
generateChart() {
this._status.generating = true;
this.status.emit(this._status);
this.dataService.generateChart(this.question, '30ee4df6-b311-4774-bbbd-3bdc52753f4a')
this.dataService.generateChart(this.question)
.pipe(
takeUntilDestroyed(this.destroyRef),
tap((data) => {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export class DataPanelComponent implements OnInit {
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((dataset) => {
this.updateColumnList([dataset.datasetId]);
this.dataService.setDatasetIdForAI(dataset.datasetId);
});

this.selectedDatasets.valueChanges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class DataService {
private readonly authService = inject(AuthService);
authKey: string;
authToken?: string;
datasetIdForAI = '70902e57-8c32-4890-a728-650c686c1f5d';
// cache: Record<string, any> = {};

client: Luzmo;
Expand All @@ -27,10 +28,14 @@ export class DataService {
});
}

generateChart(question: string, datasetId: string): Observable<any> {
setDatasetIdForAI(datasetId: string) {
this.datasetIdForAI = datasetId;
}

generateChart(question: string): Observable<any> {
return from(this.client.create(('aichart' as any), {
type: 'generate-chart',
dataset_id: datasetId,
dataset_id: this.datasetIdForAI,
question: question,
model_preference: 'performance'
}));
Expand Down
12 changes: 9 additions & 3 deletions wearables-dashboard/src/components/Analytics/Analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ export default function Analytics() {
setSleepScoreYesterday(
sleepScores.lastNightSleepScore > -1
? Math.round(sleepScores.lastNightSleepScore * 100)
: undefined
: -1
);

setSleepScoreDayBefore(
sleepScores.previousNightSleepScore > -1
? Math.round(sleepScores.previousNightSleepScore * 100)
: undefined
: -1
);
});
}, [user]);
Expand All @@ -115,7 +115,7 @@ export default function Analytics() {

setStepsToday(undefined);

// Fetch sleep score from yesterday
// Fetch number of steps per day
getStepsPerDay(user.id).then((stepsPerDay) => {
// Check if the first entry is from today & set the steps
setStepsToday(
Expand Down Expand Up @@ -268,6 +268,7 @@ export default function Analytics() {
>
{hasSleepData &&
sleepScoreYesterday !== undefined &&
sleepScoreYesterday !== -1 &&
sleepScoreDayBefore !== undefined && (
<Paper elevation={2} sx={TEXTUAL_INSIGHTS_STYLE}>
Your sleep score was <strong>{sleepScoreYesterday}%</strong>{" "}
Expand All @@ -285,6 +286,11 @@ export default function Analytics() {
Loading sleep insights...
</Paper>
)}
{hasSleepData && sleepScoreYesterday === -1 && (
<Paper elevation={2} sx={TEXTUAL_INSIGHTS_STYLE}>
No sleep insights yet for yesterday's night
</Paper>
)}
{hasStepsData && stepsToday !== undefined && (
<Paper elevation={2} sx={TEXTUAL_INSIGHTS_STYLE}>
Based on your walking history, you should have used about{" "}
Expand Down

0 comments on commit 9941e87

Please sign in to comment.