a live sample version of this site if viewable here
US obesity prevalence was 42% in 2017 – 2018 (source).
This app seeks to provide a tool to manage obesity.
I have a blog post which has more details about how and why this was made here
This app uses a dataset for its graphs involving BMI.
The dataset can be found in CDCs National Health and Nutrition Examination Survey (NHANES) page under the "Body Measures" Data file.
This uses an XPT file format, which may require downloading software. For this the software "Datasly" can be used.
The column Body Mass Index (BMXBMI) was used, filtering out empty values and rows which contained any value for BMI Category - Children/Youth (BMDBMIC).
Filtering out rows which contain BMDBMIC effectively removes all data collected from youth ages 1-18.
This leaves 8388 usable rows of adult data which was then processed to generate a BMI histogram viewable within the application.
- git
- node
- supabase account with a PostgreSQL instance
- Google reCAPTCHA account
- Google cloud account
- GitHub account
- The application can be cloned locally with a
git clone https://github.com/CodaBool/CS6440.git
- go into the new CS6440 folder
cd CS6440
- install the necessary dependencies
npm install
- create a
.env
file in the root of application - Follow the steps to generate values for all the necessary environment variables
DATABASE_URL
- Create a Supabase account at https://app.supabase.io
- create a new project > wait for the database to be provisioned > select the Database tab
- Database > Connection Pooling > Connection string
- store the values in .env for
DATABASE_URL
GOOGLE_ID
andGOOGLE_SECRET
- sigin to Google and go to https://console.cloud.google.com/apis/credentials
- create a new project
- create credentials > OAuth client ID > Web application
- set the URIs for origin and redirect
- store the values in .env for
GOOGLE_ID
andGOOGLE_SECRET
GITHUB_ID
andGITHUB_SECRET
- sigin to Google and go to https://github.com/settings/developers
- create a new OAuth app, you will need to create separate apps for local and production
- fill all required fields, use
https://YOUR_DOMAIN/api/auth/callback/github
for prod andhttp://localhost:3000/api/auth/callback/github
for local in the callback URL field - store the values in .env for
GITHUB_ID
andGITHUB_SECRET
NEXTAUTH_URL
andNEXTAUTH_SECRET
- add the line
NEXTAUTH_URL=http://localhost:3000/api/auth
to the .env. follow the documentation if any issues arrise - generate a secure (use 40 character length) value. You can use generator sites like lastpass to generator this value.
- Store the value in .env for
NEXTAUTH_SECRET
NEXT_PUBLIC_CAPTCHA_SITE_KEY
andCAPTCHA_SECRET
- signin to Google and go to https://www.google.com/recaptcha/admin
- click the plus icon, use the v2 reCAPTCHA add a localhost domain
- store the values in .env for the
NEXT_PUBLIC_CAPTCHA_SITE_KEY
andCAPTCHA_SECRET
This application is built using Next.js and the recommended deployment host is Vercel.
An account can be created easily by using the GitHub OAuth at https://vercel.com.
After creating a project and linking to your repository you will have automatic deployments on push.
Add all local environment variables to the project. Ensure to update NEXTAUTH_URL to the canatical domain vercel provides.
Also update the Google and GitHub OAuth apps to allow your new domain.
- Google reCAPTCHA = https://www.google.com/recaptcha/admin
- OAuth Github = https://github.com/settings/applications/1631352
- OAuth Google = https://console.cloud.google.com/apis/credentials?authuser=1&project=market-mongo-314800
- Prisma CLI = https://www.prisma.io/docs/reference/api-reference/command-reference
- use
npx prisma db push
to migrate
- use
- Threejs Docs = https://docs.pmnd.rs/react-three-fiber/getting-started
import gltf to https://gltf.pmnd.rs to generated code.Not working atm, use gltfjsx cli instead- use
npx gltfjsx MODEL_FILE_NAME.gltf --shadows -T -a -D
to convert a gltf to a react function