Skip to content

Instantly share code, notes, and snippets.

@csain
Last active July 29, 2025 17:47
Show Gist options
  • Save csain/2c09368bcde85b7da6debe7a759cc82c to your computer and use it in GitHub Desktop.
Save csain/2c09368bcde85b7da6debe7a759cc82c to your computer and use it in GitHub Desktop.

Revisions

  1. csain revised this gist Jul 29, 2025. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions SCHEMA.md
    Original file line number Diff line number Diff line change
    @@ -28,9 +28,6 @@ Data access is managed using the **Room persistence library**. This is optimal f
    ## ER Diagram


    ![ER Diagram](https://i.imgur.com/8hpERuy.png)


    ```mermaid
    erDiagram
    CHALLENGES {
  2. csain revised this gist Jul 29, 2025. 2 changed files with 78 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -10,9 +10,11 @@
    - Back-end: Kotlin

    ## Features
    -
    - personalized challenge with fixed number of days
    - custom units for daily progress tracking
    - full progress tracking view


    ## Links
    - [Repo]( ) (private)
    - [Repo]( https://github.com/csain/flex-75-android ) (private)
    - [Colleen's Projects](https://gist.github.com/csain/20ff7a32d2bc13d8a24597d54db9d630)
    74 changes: 74 additions & 0 deletions SCHEMA.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,74 @@
    # Habit Challenge Schema

    This schema supports a simple habit challenge app where users commit to completing a set of tasks daily over a fixed number of days.

    ---

    ## Database Overview

    A **Challenge** is a fixed-length commitment of a set of **ChallengeTasks**. For example, the **Challenge** may last 21 days and include 3 **ChallengeTasks**:

    - Walk 10K steps
    - Drink 8 glasses of water
    - Study 45 minutes

    Each day, the user sees the same list of tasks, **DailyTaskItems**, which are grouped in the **DailyTaskList** for that day.

    The schema is designed to record consistency and progress without changing the challenge once it starts.

    ---

    ## Database Details

    This schema is implemented using **SQLite**, the native local database engine on Android devices.
    Data access is managed using the **Room persistence library**. This is optimal for offline-first, local storage of structured data in Android apps.

    ---

    ## ER Diagram


    ![ER Diagram](https://i.imgur.com/8hpERuy.png)


    ```mermaid
    erDiagram
    CHALLENGES {
    Long id PK
    Int numDays
    Date startDate
    Date stoppedAt
    Date completedAt
    }
    CHALLENGE_TASKS {
    Long id PK
    Long challengeId FK
    String title
    String unit
    Float amount
    }
    DAILY_TASK_LISTS {
    Long id PK
    Long challengeId FK
    Date date
    Int numDay
    Date completedAt
    }
    DAILY_TASK_ITEMS {
    Long id PK
    Long dailyTaskListId FK
    Long challengeTaskId FK
    Float progressAmount
    Date completedAt
    }
    CHALLENGES ||--o{ CHALLENGE_TASKS : has
    CHALLENGES ||--o{ DAILY_TASK_LISTS : contains
    DAILY_TASK_LISTS ||--o{ DAILY_TASK_ITEMS : includes
    CHALLENGE_TASKS ||--o{ DAILY_TASK_ITEMS : used_by
    ```
  3. csain created this gist Jul 22, 2025.
    18 changes: 18 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # Daily Habit Challenge

    ## Overview

    **What**: A daily habit challenge app for Android.


    ## Tech Stack
    - Front-end: Jetpack Compose (Kotlin)
    - Back-end: Kotlin

    ## Features
    -


    ## Links
    - [Repo]( ) (private)
    - [Colleen's Projects](https://gist.github.com/csain/20ff7a32d2bc13d8a24597d54db9d630)