Home - CSC4790-Fall2024-Org/Dream-Interpreter GitHub Wiki

  1. Final Artifact links

1.1 Abstract

1.2 Poster

1.3 Lightning Talk

1.4 Project Management

1.5 Video Link

  1. Requirements 2.1 Key User Stories
User story Status
As a general user, I would like to use the app on my phone, so that I can input right when I wake up. Completed *Shallow Trench
As a general user, I would like a log feature ( a history feature of 100+ dreams) so that I can view my previous dreams and their interpretations. Completed *Shallow Trench
As a general user, I would like to create an account so that everything I input is confidential. Completed *Shallow Trench
As a general user, I want to be able to revise my prompts and iterate so that I can get a more accurate image/interpretation. Deferred
As a general user I want a graphical analysis of my dreams, so that I can see trends over time. Removed
As a researcher and a general user, I would like to be able to upload my sleep data(heart rate, quality of sleep etc.) to each dream so that I can better understand how dreams relate to sleep quality. Removed

2.2 Project Abstract including changes to original project

  1. Scope Adjustments The project was originally planned to be the continuation of our web app dream interpreter, but as a mobile app. Additionally, we hoped to create a log feature which could store dreams for a user and allow them to view previous dreams. As such, we would need a backend with account authentication. Transferring the app and debugging took most of our time, which forced us to reduce scope on the user feature. Instead of being fully secure and allowing login from all users, the app allows for only project owners to have an account at this time. This helped us focus on the user experience and leave security for once the features were finalized.

  2. Risks (from Trello)

4.1 A risk be User satisfaction because dream interpretation is highly nuanced and individual-specific, it might be difficult to generate accurate dream representations in video/analysis with consistency. The severity would be high if the software isn't producing good content then users would get bored and leave. To prevent this we could use user feedback and test the accuracy of out outputs to actively improve our application.

4.2 A risk would be an AI failure because depending on the AI tool we use, there is a possibility that the tool changes or gets shut down making our app dysfunctional or altogether nonfunctional. Offline periods for an AI tool would also lead to offline periods where our software would not be able to run properly. The severity is high because it would make users unlikely to use our application if we cant provide consistency. A strategy would be that we can experiment with multiple AI tools to have backups in place in case the tool we choose fails.

4.3 Data privacy is another risk because people may use the app as an external journal and they don't want people to know personal information about them. Likelihood is low because there wouldn't be any real incentive to intercept someone's data. However, the severity would be high because consumers would lose trust in our security and ultimately refrain from using the app. To prevent this we could add 2FA and use encryption processes to secure data.

  1. Design

5.1 The design diagram shows the user logging into the app on their phone which is based on an Expo React Native framework. From there, supabase authenticates the user and connects to the Postgres backend to retrieve stored dreams. The Gemini and Gooey pages call to the abstraction layer, which in turn calls on the Gemini and Gooey APIs. Gooey returns a link to an animation, which is immediately stored in supabase's Postgres database. Gemini returns text, which is formatted and shown to the user and stored on the database. GitHub is used for coding and updating the app.

5.2 Design Diagram

  1. Implementation

6.1 Tech Stack

6.2 During the development of the Nocturnal Navigator Dream Interpreter, we faced several challenges that required careful planning and problem-solving to create a smooth and reliable app.

One of the first challenges was transitioning the app from its original prototype, built with Streamlit in Python, to a mobile-friendly version using Expo and React Native. This required completely rethinking the app’s structure, adapting features for mobile, and setting up a development environment with tools like Expo. While this was a big shift, it allowed us to create a cross-platform app with a much better user experience.

Another challenge was finding the right database for the backend. We needed a solution that supported user authentication, real-time syncing, and offline functionality. After exploring options, we chose Supabase. Setting it up and integrating it with the app took some work, especially ensuring that user data synced correctly and securely, even when users were offline. Through trial and error and referencing Supabase’s documentation, we successfully implemented a reliable system.

We also ran into issues related to using Expo Go for development and testing. While Expo made it easy to preview the app during development, its frequent updates and occasional bugs sometimes caused unexpected issues. To handle this, we kept our dependencies up-to-date, tested the app thoroughly after each Expo update, and implemented workarounds to ensure the app remained stable.

Lastly, setting up Supabase Auth for user authentication came with its own challenges. We had to handle social logins, session management, and error handling to make sure users could log in and use the app without interruptions. Updating the Supabase SDK and refining our login workflows helped solve these issues.

Despite these challenges, each step made the app stronger, and we documented our solutions to help guide future improvements. This journey has equipped the app with a solid foundation for further development and user success.

6.3 Code Samples

  1. Supabase Integration:
import AsyncStorage from '@react-native-async-storage/async-storage'
import { createClient } from '@supabase/supabase-js'

const supabaseUrl = 'URL';
const supabaseAnonKey = 'KEY';

export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
    auth: {
      storage: AsyncStorage,
      autoRefreshToken: true,
      persistSession: true,
      detectSessionInUrl: false,
    },
  })
  1. Supabase Backend Setup

  2. Abstraction Layer:

import { model } from "./gemini-api";
import { generateAnimationLink } from './gooey-api'; 
import { supabase } from "../supabase/supabase";

export const textModel = async (prompt) => {
  const textModel = model;

  try {
    const result = await textModel.generateContent(prompt);
    return await result.response.text(); 
  } catch (error) {
    console.error('Error generating Gemini content:', error);
    throw error;
  }
};

export function generateVideo(dreamInput) {
  try {
    return generateAnimationLink(dreamInput);
  } catch (error) {
    console.error('Error generating Gooey animation:', error);
    throw error;
  }
};

export async function insertDream({
  username,
  time,
  date,
  input,
  output,
  theme = null,
  rating = null,
}) {
  try {
    const { data, error } = await supabase.from("Dream").insert([
      {
        username,
        time,
        date,
        input,
        output,
        theme,
        rating,
      },
    ]);

    if (error) {
      console.error("Error inserting into Dream table:", error);
      return { success: false, error };
    }

    console.log("Dream log successfully inserted:", data);
    return { success: true, data };
  } catch (err) {
    console.error("Unexpected error during Dream log insertion:", err);
    return { success: false, error: err };
  }
}
  1. User Account and Authentication

6.4 User Interface

  1. Home Page
  2. Textual Interpretation
  3. Dream Log
  4. All Pages

Here are some main pages from our UI.

  1. Testing

7.1 Test Scenarios

7.2 Alpha Testing

7.3 Known Issues

  1. Future Plans for the Project

Looking ahead, we envision expanding the Nocturnal Navigator Dream Interpreter to make it even more advanced and user-friendly. Potential advancements include integrating more sophisticated natural language processing features, such as advanced sentiment analysis or thematic clustering for dreams, and enhancing the UI/UX with additional customization options for dream logs. We also aim to implement robust data visualization tools that allow users to track patterns in their dreams over time. Our ultimate goal is to release the app on the App Store and Google Play, making it accessible to a broader audience. This will involve setting up app distribution workflows, ensuring compliance with app store guidelines, and potentially monetizing the app through premium features or in-app purchases. Since we plan to continue developing this project independently, we would rather keep this project to only us but encourage other seniors to get inspired.

  1. Project Retrospective

9.1 We set our scope well and were able to achieve most of our goals we set out at the beginning of the semester. Our product works as intended and fulfills many key user stories. We learned about how cross-compatibility can be challenging and we have to check more requirements than you would think. We also stayed consistent with our progress. The timeline of the project could be improved: even though we finished everything on time, in the optimal scenario, we would not have as much work left for the last minute. This was due to unexpected technical difficulties that arose due to the Expo update.

9.2 2053 was very useful for giving us the background in Expo/React Native. This helped us switch to Expo quickly at the start of the semester and we were able to build on our skills as we developed the product. 4480 was helpful in understanding the backend database requirements, we were able to easily create our SQL schema on Supabase which made our backend development more streamlined. 4700 was obviously very useful as this was the first half of our project and helped our team to establish Agile principles and teamwork. Further, we were better able to plan our next steps and gain a better understanding of our timeline and scope due to having worked on the project in 4700 previously.

9.3 Make sure to prioritize requirements engineering- plan ahead, chart out steps, and assign tasks. This will make you more able to stay on track over the semester. Further, aim to start early as often as possible.