# Project export: AtlasAI

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 10.0
- Tagline: Take back control of your lives with our data-supported, individualized solutions!
- Devpost: https://devpost.com/software/atlasai
- GitHub: https://github.com/TJun-Jie/AtlasAI-
- Result: winner (Best Use of Convex)
- Team: 3 GitHub contributor(s) — TJun-Jie (18 commits), Melvin-Leo2000 (11 commits), Aaron Ang (6 commits)

## Devpost submission (written by the team)

### Inspiration

In today's fast-paced world, highly driven individuals often overwork themselves without regard for how it impacts their health, only experiencing the consequences when it is too late. AtlasAI aims to bring attention to these health issues at an early stage, such that our users are empowered to live their best lives in a way that does not negatively impact their health.

### What it does

We realized that there exists a gap between today's abundance of wearable health data and meaningful, individualized solutions which users can implement. For example, many smart watches today are saturated with metrics such as sleep scores and heart rate variability, many of which actually mean nothing to their users in practice. Therefore, AtlasAI aims to bridge this gap to finally empower our users to use this health data to enhance the quality of their lives. Using our users' individual health data, AtlasAI is able to: suggest event rescheduling provide targeted, actionable feedback recommend Spotify playlists depending on user mood

### How we built it

Our frontend was built with NextJS, with styling from Tailwind and MaterialUI. Our backend was built with Convex, which integrates technologies from TerraAPI, TogetherAI and SpotifyAPI. We used a two-phase approach to fine-tune our model. First, we utilized TogetherAI's base models to generate test data (a list of rescheduled JSON event objects for the day). Then, we picked logically sound examples to fine-tune our model.

### Challenges we ran into

In the beginning, our progress was extremely slow as AtlasAI integrates so many new technologies. We only had prior experience with NextJS, Tailwind and MaterialUI, which essentially meant that we had to learn how to create our entire backend from scratch. AtlasAI also went through many integrations throughout this weekend as we strove to provide the best recommendations for our users. This involved long hours spent in fine-tuning our TogetherAI models and testing out features until we were satisfied with our product.

### Accomplishments we're proud of

We are extremely proud that we managed to integrate so many new technologies into AtlasAI over the course of three short days.

### What we learned

In the development realm, we successfully mastered the integration of several valuable third-party applications such as Convex and TogetherAI. This expertise significantly accelerated our ability to construct lightweight prototypes that accurately embody our vision. Furthermore, we honed our collaborative skills through engaging in sprint cycles and employing agile methodologies, which collectively enhanced our efficiency and expedited our workflow.

### What's next

Research indicates that health data can reveal critical insights into health symptoms like depression and anxiety. Our goal is to delve deeper into leveraging this data to furnish enhanced health insights as proactive measures against potential health ailments. Additionally, we aim to refine lifestyle recommendations for the user's calendar to foster better recuperation.

## README (from the GitHub repository)

<img src="public/newnewlogo.jpg" alt="AtlasAI Logo" width="150" height="150"/>

# AtlasAI
> Take back control of your lives with our data-supported, individualized solutions!

AtlasAI bridges the gap between today's abundance of wearable health data and meaningful, actionable recommendations for our users.

Created for [CalHacks 10.0](https://www.calhacks.io/). View our Devpost submission [here](https://devpost.com/software/atlasai)!


## Detected evidence (automated analysis)

Indexed codebase: 33 recognized source files, 94 KB.
- CSS (language) — detected in the code
- JavaScript (language) — detected in the code
- Next.js (technology) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code

## Codebase structure (from repository index)

### Files (46 of 46)

```
.env.example
.eslintrc.json
.gitignore
convex/_generated/api.d.ts
convex/_generated/api.js
convex/_generated/dataModel.d.ts
convex/_generated/server.d.ts
convex/_generated/server.js
convex/http.ts
convex/predictedMetrics.ts
convex/README.md
convex/recommendedTasks.ts
convex/schedule_tasks.ts
convex/schema.ts
convex/sleepScores.ts
convex/stressScores.ts
convex/tasks.ts
convex/tsconfig.json
next.config.js
package.json
postcss.config.js
predictedMetricsSample.jsonl
README.md
sampleData.jsonl
sampleReccos.jsonl
src/app/components/Recommended.tsx
src/app/components/RecommendedCard.tsx
src/app/components/SpotifyDrawer.tsx
src/app/components/SpotifyEmbedded.tsx
src/app/components/TaskItem.tsx
src/app/ConvexClientProvider.tsx
src/app/globals.css
src/app/layout.tsx
src/app/page.tsx
src/app/recs/route.ts
src/app/stats/page.tsx
tailwind.config.ts
together/.env.example
together/.gitignore
together/data.py
together/finetune.py
together/finetune.sh
together/requirements.txt
together/samples.py
together/test_prompt.txt
tsconfig.json
```

### Dependencies

- package.json: @mui/icons-material@^5.14.15, @mui/lab@^5.0.0-alpha.149, @mui/material@^5.14.14, @mui/x-date-pickers@^6.16.3, @types/node@^20, @types/react@^18, @types/react-dom@^18, autoprefixer@^10, axios@^1.6.0, chart.js@^4.4.0, convex@^1.5.1, dayjs@^1.11.10, eslint@^8, eslint-config-next@14.0.0, luxon@^3.4.3, next@14.0.0, overlayscrollbars-react@^0.5.3, postcss@^8, react@^18, react-chartjs-2@^5.2.0, react-dom@^18, tailwindcss@^3, typescript@^5

### Recent commits (newest first)

- Create .env.example
- styling
- Update README.md
- recs on add event
- fix carfd
- - fixed removal of pm and am from schedule
- add useeffect
- - fixed commands
- Merge branch 'main' of https://github.com/TJun-Jie/AtlasAI-
- - new changes
- cleaned JSON for `/recs` route (#8)
- Edited README and data
- Merge branch 'main' of github.com:TJun-Jie/AtlasAI- into main
- Minor styling
- add cards
- Added modal for high current stress
- add styles
- change sample data
- styel
- create `/recs` route (#7)

## Key source files (fetched from GitHub, selected and truncated for size)

### package.json

```
{
  "name": "atlas",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@mui/icons-material": "^5.14.15",
    "@mui/lab": "^5.0.0-alpha.149",
    "@mui/material": "^5.14.14",
    "@mui/x-date-pickers": "^6.16.3",
    "axios": "^1.6.0",
    "chart.js": "^4.4.0",
    "convex": "^1.5.1",
    "dayjs": "^1.11.10",
    "luxon": "^3.4.3",
    "next": "14.0.0",
    "overlayscrollbars-react": "^0.5.3",
    "react": "^18",
    "react-chartjs-2": "^5.2.0",
    "react-dom": "^18"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10",
    "eslint": "^8",
    "eslint-config-next": "14.0.0",
    "postcss": "^8",
    "tailwindcss": "^3",
    "typescript": "^5"
  }
}

```

### together/requirements.txt

```
��c e r t i f i = = 2 0 2 3 . 7 . 2 2  
 c h a r s e t - n o r m a l i z e r = = 3 . 3 . 1  
 c l i c k = = 8 . 1 . 7  
 c o l o r a m a = = 0 . 4 . 6  
 i d n a = = 3 . 4  
 p y t h o n - d o t e n v = = 1 . 0 . 0  
 r e q u e s t s = = 2 . 3 1 . 0  
 s s e c l i e n t - p y = = 1 . 8 . 0  
 t a b u l a t e = = 0 . 9 . 0  
 t o g e t h e r = = 0 . 2 . 6  
 t q d m = = 4 . 6 6 . 1  
 t y p e r = = 0 . 9 . 0  
 t y p i n g - e x t e n s i o n s = = 4 . 8 . 0  
 u r l l i b 3 = = 2 . 0 . 7  
 
```

### src/app/layout.tsx

```typescript
import "./globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import ConvexClientProvider from "./ConvexClientProvider";
import Image from "next/image";

import "overlayscrollbars/overlayscrollbars.css";
import SpotifyDrawer from "./components/SpotifyDrawer";

const inter = Inter({ subsets: ["latin"] });

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body className={inter.className}>
        <div className="tw-flex tw-flex-col tw-min-h-screen tw-bg-gray-900 tw-text-gray-100">
          <header className="tw-p-4 tw-bg-gray-800">
            <div className="tw-flex tw-justify-left tw-items-center">
              <Image src="/newnewlogo.jpg" alt="logo" width={70} height={70} />
              <a href="/" className="tw-text-2xl tw-font-semibold">
                AtlasAI
              </a>
              <a href="/stats" className="tw-text-xl tw-ml-8">
                Stats
              </a>
            </div>
          </header>
          <main className="tw-flex-grow tw-p-4">
            <ConvexClientProvider>{children}</ConvexClientProvider>
          </main>
        </div>
      </body>
    </html>
  );
}

```

### convex/_generated/server.js

```javascript
/* eslint-disable */
/**
 * Generated utilities for implementing server-side Convex query and mutation functions.
 *
 * THIS CODE IS AUTOMATICALLY GENERATED.
 *
 * Generated by convex@1.5.1.
 * To regenerate, run `npx convex dev`.
 * @module
 */

import {
  actionGeneric,
  httpActionGeneric,
  queryGeneric,
  mutationGeneric,
  internalActionGeneric,
  internalMutationGeneric,
  internalQueryGeneric,
} from "convex/server";

/**
 * Define a query in this Convex app's public API.
 *
 * This function will be allowed to read your Convex database and will be accessible from the client.
 *
 * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
 * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
 */
export const query = queryGeneric;

/**
 * Define a query that is only accessible from other Convex functions (but not from the client).
 *
 * This function will be allowed to read from your Convex database. It will not be accessible from the client.
 *
 * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
 * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
 */
export const internalQuery = internalQueryGeneric;

/**
 * Define a mutation in this Convex app's public API.
 *
 * This function will be allowed to modify your Convex database and will be accessible from the client.
 *
 * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
 * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
 */
export const mutation = mutationGeneric;

/**
 * Define a mutation that is only accessible from other Convex functions (but not from the client).
 *
 * This function will be allowed to modify your Convex database. It will not be accessible from the client.
 *
 * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
 * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
 */
export const internalMutation = internalMutationGeneric;

/**
 * Define an action in this Convex app's public API.
 *
 * An action is a function which can execute any JavaScript code, including non-deterministic
 * code and code with side-effects, like calling third-party services.
 * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
 * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
 *
 * @param func - The action. It receives an {@link ActionCtx} as its first argument.
 * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
 */
export const action = actionGeneric;

/**
 * Define an action that is only accessible from other Convex functions (but not from the client).
 *
 * @param func - The function. It receives an {@link ActionCtx} as its first argument.
 * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
 */
export const internalAction = internalActionGeneric;

/**
 * Define a Convex HTTP action.
 *
 * @param func - The function. It receives an {@link ActionCtx} as its first argument, and a `Request` object
 * as its second.
 * @returns The wrapped endpoint function. Route a URL path to this function in `convex/http.js`.
 */
export const httpAction = httpActionGeneric;

```

### src/app/recs/route.ts

```typescript
import axios from "axios";

export async function GET(request: Request) {
  let ret = "";
  try {
    const req = await request.text();
    const res = await axios.post(
      "https://api.together.xyz/inference",
      {
        model:
          "aarona@bu.edu/CodeLlama-13b-Instruct-atlasAI-finetune-2023-10-29-04-24-24",
        // "togethercomputer/CodeLlama-34b-Instruct",
        max_tokens: 2043,
        prompt:
          "[INST] " +
          "Based on the following tasks and stress scores, generate a new schedule that contains JSON parseable list of event objects" +
          "Include a comma between each event object. Please follow this template." +
          `output: [
            {
                "startTime": "2023-11-13T20:00:00",
                "deadline": "2023-11-18T12:00:00",
                "isFixed": false,
                "title": "Math Problem Set 1",
                "duration": 240,  
                "priority": 1,
                "reason": "You appear to always be stressed around this time :(. Consider doing homework later on when you are less stressed!"
            }, 
            {
                "startTime": "2023-11-13T15:00:00",
                "deadline": null,
                "isFixed": true,
                "title": "Basketball Training",
                "duration": 120, 
                "priority": 2,  
                "reason": "You appear more stressed in the morning. How about exercising later in the afternoon instead?"
            },
            {
                "startTime": "2023-11-13T14:00:00",
                "deadline": null,
                "isFixed": true,
                "title": "Coding class",
                "duration": 60, 
                "priority": 1,
                "reason": null
            },
            {
                "startTime": "2023-11-13T18:00:00",
                "deadline": null,
                "isFixed": false,
                "title": "Team Standup",
                "duration": 120,
                "priority": 2,
                "reason": "You appear to always be stressed around this time :(. Consider doing this task later on when you are less stressed!"
            }].` +
          "If the current schedule makes sense, you do not need to change it." +
          "If there is a difference between the new schedule and the old schedule, " +
          "add a new reason field to each rescheduled task and describe the reason for the change.\n" +
          req +
          " [/INST]",
        temperature: 0.7,
        top_p: 0.7,
        top_k: 50,
        repetition_penalty: 1,
        stream_tokens: true,
        stop: ["</s>", "[INST]"],
        negative_prompt: "",
        sessionKey: "a73e3e0bd6ffd65d9e488c3160c8984009265d87",
        type: "chat",
      },
      {
        headers: {
          Authorization: "Bearer " + process.env.TOGETHER_API_KEY,
        },
      }
    );
    let re = /"text":"(.*?)"/g;
    let match;
    while ((match = re.exec(res.data)) !== null) {
      ret += match[1];
    }
    ret = ret
      .replace(/\\n/g, "")
      .replace(/\\/g, `\"`)
      .replace(/\" \"/g, '":"')
      .replace(/\" \:/g, '":"')
      .replace(/isFixed"/g, 'isFixed":')
      .replace(/deadline" null/g, 'deadline": null')
      .replace(/duration"/g, 'duration":')
      .replace(/priority"/g, 'priority":')
      .replace(/reason" null/g, 'reason": null')
      .replace(/\s\s+/g, " ")
      .replace(/\" \"/g, '", "')
      .replace(/\"\":/g, '", "');
    console.log(ret);

    re = /(\[.*?\])/;
    match = ret.match(re);
    if (match) {
      ret = JSON.parse(match[1]);
    }
  } catch (e: unknown) {
    console.log(e);
    if (e instanceof Error) {
      return new Response(e.message, {
        status: 500,
      });
    }
  }

  return Response.json(ret);
}

```

### src/app/stats/page.tsx

```typescript
"use client";

// React ChartJS 2 Charting Library.
import {
  Chart as ChartJS,
  CategoryScale,
  LinearScale,
  BarElement,
  Title,
  Tooltip,
  Legend,
} from "chart.js";
import { useQuery } from "convex/react";
import { Bar } from "react-chartjs-2";
import { getCurrentHourInSanFrancisco } from "../../../convex/stressScores";
import { api } from "../../../convex/_generated/api";
import utc from "dayjs/plugin/utc"; // UTC plugin
import timezone from "dayjs/plugin/timezone";
import dayjs from "dayjs";
import RecommendedCard from "../components/RecommendedCard";
import SpotifyDrawer from "../components/SpotifyDrawer";
import { Typography } from "@mui/material";

ChartJS.register(
  CategoryScale,
  LinearScale,
  BarElement,
  Title,
  Tooltip,
  Legend
);

dayjs.extend(utc);
dayjs.extend(timezone);
export default function Stats() {
  const options = {
    responsive: true,
    plugins: {
      legend: {
        display: false,
      },

      title: {
        display: false,
      },
    },
    maintainAspectRatio: false,
  };

  const stressData = useQuery(api.stressScores.getStressScores, {
    hour: getCurrentHourInSanFrancisco(),
  });
  const stressScore = stressData ? stressData[0]?.score : 0;
  const stressLastUpdated = stressData ? stressData[0]?._creationTime : 0;

  const sleepData = useQuery(api.sleepScores.getSleepScores, {
    hour: getCurrentHourInSanFrancisco(),
  });
  const sleepScore = sleepData ? sleepData[0]?.score : 0;
  const sleepLastUpdated = sleepData ? sleepData[0]?._creationTime : 0;

  const pastMetrics = useQuery(api.predictedMetrics.getPredictedMetrics);

  const pastSleepScores = pastMetrics
    ? pastMetrics[0]?.predictedSleepScores
    : [];
  const pastStressScores = pastMetrics
    ? pastMetrics[0]?.predictedStressScores
    : [];

  const dateTimeUTCStress = dayjs(stressLastUpdated);

  const dateTimeSFStress = dateTimeUTCStress.tz("America/Los_Angeles");

  const formattedStressDateTime = dateTimeSFStress.format("YYYY-MM-DD h:mm A");

  const dateTimeUTCSleep = dayjs(sleepLastUpdated);

  const dateTimeSFSleep = dateTimeUTCSleep.tz("America/Los_Angeles");

  const formattedSleep = dateTimeSFSleep.format("YYYY-MM-DD h:mm A");

  //   Convert to San Francisco time
  //   const dateTimeSF = dateTimeUTC.tz("America/Los_Angeles");

  const labels = [
    "00",
    "01",
    "02",
    "03",
    "04",
    "05",
    "06",
    "07",
    "08",
    "09",
    "10",
    "11",
    "12",
    "13",
    "14",
    "15",
    "16",
    "17",
    "18",
    "19",
    "20",
    "21",
    "22",
    "23",
  ];

  const dataSet = pastStressScores.map((value) => value.score);

  const data = {
    labels,
    datasets: [
      {
        data: dataSet,
        backgroundColor: dataSet.map((value) =>
          value > 27 ? "rgba(255, 99, 132, 0.5)" : "rgba(53, 162, 235, 0.5)"
        ),
      },
    ],
  };

  // Recommended Tasks.
  interface Recommendation {
    title: string;
    recommendation: string;
  }

  interface StressRecommendation {
    title: string;
    recommendation: string;
  }

  const stressRecommendations: StressRecommendation[] = [
    {
      title: "High Stress During Work Hours",
      recommendation:
        "We've noticed a pattern of elevated stress levels during your typical working hours. Consider taking short breaks to step away from your workstation, practice deep-breathing exercises, or take a walk to reset your mind.",
    },

    {
      title: "Post-Exercise Stress Increase",
      recommendation:
        "An increase in stress levels is observed post-workout. While exercise generally lowers stress, intense workouts can temporarily have the opposite effect. Consider a mix of cardio and relaxation-based exercises like yoga.",
    },
    {
      title: "Morning Stress",
      recommendation:
        "High stress levels are observed in the mornings. A structured morning routine including light exercise, a balanced breakfast, and planning for the day can set a positive tone.",
    },
  ];

  const sleepRecommendations: Recommendation[] = [
    {
      title: "Weekday vs Weekend Variance",
      recommendation:
        "Our analysis shows that your sleep quality varies between weekdays and weekends, which can be disruptive to your natural circadian rhythm. To maintain a balanced work-life cycle, aim to standardize your sleep hours across the week. Consider stress-relief activities during weekdays and avoid oversleeping on weekends.",
    },
    {
      title: "Inconsistent Sleep Scores",
      recommendation:
        "We've noticed fluctuations in your sleep scores throughout the month. This inconsistency can lead to long-term sleep debt. Establish a stable bedtime and wake-up routine, including on weekends, to improve overall sleep quality.",
    },

    {
      title: "Mid-Sleep Wakefulness",
      recommendation:
        "Your sleep score shows a dip in quality midway through your sleep cycle. This could be indicative of disrupted REM sleep. Avoid alcohol or heavy meals before bed, and consider using blackout curtains to create a sleep-conducive environment.",
    },
  ];

  return (
    <div>
      <div className=" tw-mx-auto tw-h-[50vh] tw-w-[80%]">
        <h1 className="tw-text-4xl tw-font-bold tw-text-center">
          Daily Stress Score
        </h1>
        <Bar options={options} data={data} />
      </div>

      <div className="tw-grid tw-grid-cols-2 tw-justify-items-center tw-items-center tw-mt-10">
        <div>
          <h3 className="tw-text-2xl tw-font-semibold">Latest Sleep Score:</h3>
          <h4 className="tw-text-xl tw-text-center">{sleepScore} </h4>
          <h5 className="tw-text-sm tw-text-center">{formattedSleep}</h5>
        </div>
        <div>
          <h3 className="tw-text-2xl tw-font-semibold">Latest Stress Score:</h3>
          <h4 className="tw-text-xl tw-text-center">{stressScore} </h4>
          <h5 className="tw-text-sm tw-text-center">
            {formattedStressDateTime}
          </h5>
        </div>

[truncated — 1347 more characters]
```

### src/app/page.tsx

```typescript
"use client";
import { useQuery, useMutation } from "convex/react";
import SendIcon from "@mui/icons-material/Send";
import {
  Box,
  Modal,
  TextField,
  Typography,
  Button,
  IconButton,
  CircularProgress,
} from "@mui/material";
import { Delete, DoneAll, AddReaction } from "@mui/icons-material";
import { useState, useEffect } from "react";
import dayjs from "dayjs";
import TaskItem from "./components/TaskItem";
import FormControl from "@mui/material/FormControl";
import InputLabel from "@mui/material/InputLabel";
import Select, { SelectChangeEvent } from "@mui/material/Select";
import MenuItem from "@mui/material/MenuItem";
import FormHelperText from "@mui/material/FormHelperText";
import utc from "dayjs/plugin/utc"; // UTC plugin
import timezone from "dayjs/plugin/timezone";
import { OverlayScrollbarsComponent } from "overlayscrollbars-react";

import { api } from "../../convex/_generated/api";
import RecommendedCard from "./components/RecommendedCard";
import { Doc } from "../../convex/_generated/dataModel";
import Recommended from "./components/Recommended";

const daysOfWeek = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];

import { ThemeProvider, createTheme } from "@mui/material/styles";
import { getCurrentHourInSanFrancisco } from "../../convex/stressScores";
import SpotifyDrawer from "./components/SpotifyDrawer";

const darkTheme = createTheme({
  palette: {
    mode: "dark",
  },
});

dayjs.extend(utc);
dayjs.extend(timezone);
export default function Home() {
  const tasks = useQuery(api.tasks.get);
  const reccos = useQuery(api.recommendedTasks.get);
  const sendTasks = useMutation(api.schedule_tasks.send);

  const [input, setInput] = useState("");
  const [error, setError] = useState(false);
  const [value, setValue] = useState<string | number>("");
  const [touched, setTouched] = useState(false);
  const [newEventDayOfWeek, setNewEventDayOfWeek] = useState<number>(-1);
  const [recIndex, setRecIndex] = useState<number>(0);
  const [refreshing, setRefreshing] = useState<boolean>(false);

  useEffect(() => {
    const i = newEventDayOfWeek === -1 ? 0 : newEventDayOfWeek === 1 ? 1 : 2;
    setRecIndex(i);
  }, [newEventDayOfWeek]);

  const insights: string[][] = [
    [
      "Your stress levels are peaking during the early hours of the day. Consider incorporating mindfulness techniques such as meditation or deep-breathing exercises to start your day more calmly.",
      "You seem to have a significant drop in stress levels in the afternoon. Use this time to tackle more challenging tasks that require focus.",
      "Your sleep quality has been consistently poor. This can affect your stress levels and overall well-being. Consider improving your sleep hygiene.",
      "The stress levels seem to taper off late at night. Try to avoid stimulating activities that could potentially increase stress before bedtime.",
      "Your stress and sleep scores indicate that you might be experiencing burnout. It's crucial to address this before it impacts your physical and mental health.",
      "You have a period of decreased stress mid-day. This could be an optimal time for a short, rejuvenating nap to make up for poor sleep.",
      "High stress levels can directly impact sleep quality. Consider engaging in relaxing activities like a warm bath, light reading, or listening to calming music before bed.",
      "Your lowest stress levels are in the late evening. Use this time to prepare for sleep by winding down and disconnecting from electronic devices.",
      "Poor sleep can exacerbate stress. If you're having trouble sleeping, avoid caffeine and heavy meals in the evening.",
      "Your data suggests that your current routine is affecting your stress and sleep negatively. Consider consulting a healthcare provider for a comprehensive wellness check.",
    ],
    [
      "You already have 2 high-stress tasks on Monday (Board Meeting and Contract Negotiation).",
      "Consider taking a break in between tasks to relax and recharge, especially before and after the Board Meeting.",
    ],
    ["Your schedule looks great. Keep up the good work!"],
  ];

  const handleChange = (event: SelectChangeEvent<string | number>) => {
    const prior = ["Low", "Medium", "High"];
    setValue(event.target.value);
    for (let i = 0; i < 10; i++) {
      if (prior[i] == value) {
        setValue(i + 1);
      }
    }
  };

  const hasError = touched && value === "";

  const [isModalOpen, setIsModalOpen] = useState(false);
  const [isInsightModalOpen, setIsInsightModalOpen] = useState(false);

  function cleanString(str: string) {
    const stopwords = [
      "schedule",
      "around",
      "hour",
      "need",
      "hours",
      "Monday",
      "Mon",
      "help",
      "Tuesday",
      "Tue",
      "got",
      "Wednesday",
      "Wed",
      "Thursday",
      "Thu",
      "Friday",
      "Fri",
      "Saturday",
      "Sat",
      "Sunday",
      "Sun",
      "pm",
      "takes",
      "mon",
      "am",
      "i",
      "me",
      "my",
      "myself",
      "we",
      "our",
      "ours",
      "ourselves",
      "you",
      "your",
      "yours",
      "yourself",
      "yourselves",
      "he",
      "him",
      "his",
      "himself",
      "she",
      "her",
      "hers",
      "herself",
      "it",
      "its",
      "itself",
      "they",
      "them",
      "their",
      "theirs",
      "themselves",
      "what",
      "which",
      "who",
      "whom",
      "this",
      "that",
      "these",
      "those",
      "am",
      "is",
      "are",
      "was",
      "were",
      "be",
      "been",
      "being",
      "have",
      "has",
      "had",
      "having",
      "do",
      "does",
      "did",
      "doing",
      "a",
      "an",
      "the",
      "and",
      "but",
      "if",
      "or",
      "because",
      "as",
      "until",
      "while",
      "of",
      "at",
      "by",
      "for",
      "about",
      "against",
      "between",
      "in
[truncated — 33246 more characters]
```

### postcss.config.js

```javascript
module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
}

```

### next.config.js

```javascript
/** @type {import('next').NextConfig} */
const nextConfig = {}

module.exports = nextConfig

```

### tailwind.config.ts

```typescript
import type { Config } from "tailwindcss";

const config: Config = {
  content: [
    "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
  ],
  theme: {
    extend: {
      backgroundImage: {
        "gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
        "gradient-conic":
          "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
      },
    },
  },
  plugins: [],
  prefix: "tw-",
};
export default config;

```

[23 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]