Jordan Taqi-Eddin - jgte29@berkeley.edu; GitHub: jgte29
Khadija Arslan - khadija2002@berkeley.edu; GitHub: KHADIJAARSLAN
Xiang Wu - xiangwu@berkeley.edu; GitHub: xiangwu08
Yingyin Li - yingyinli2001@berkeley.edu; GitHub: yingyinlii
Marc Bonnot - mpb0614@berkeley.edu; GitHub: marcpb0614
Jane Wang - janeyjwang@berkeley.edu; GitHub username: janeyjwang
Welcome to the Project 02 GitHub Repository for Team Casimir Funk. Our code for the project is organized in the following format:
git clone https://github.com/jgte29/team-casimir-funk-proj02.git
api_key = 'my_USDA_API_Key_1234' # Enter your API key here
fooddatacentral
& pint
Packages:
fooddatacentral
& pint
Packages, you will likely have to pip
install them. We have provided the code to do so in the notebook. All you have to do is uncomment the code to download such packages. Recommended Alternatively, you can download the packages by copying the code below in a terminal.fooddatacentral
:
pip install fooddatacentral
pint
:
pip install pint
2.`price_master` Dataset:
When originally going about our research, we utilized the functions handle_query_nc_calc
& compile_ncs
to query the USDA FoodData Central API and pull the requisite nutritional contents for our food products. However, doing so takes a considerable amount of time. Therefore, in order to speed up and faciliate the usage of this notebook, especially when using the widgets in the master notebook, we have provided and read in a .csv
file called price_master.csv
that contains all of the information we compiled from the API. If you wish, feel free to run the code that we used to create price_master.csv
by uncommenting the code in the cell that reads in file.
Warning: The code may take up to a couple of minutes to run, so re-comment the code after running it in order to avoid unintentionally re-running it.
price_master = pd.read_csv('./data/price_master.csv', dtype=str)
### Only uncomment if using, otherwise, DO NOT UNCOMMENT!
### Code takes a lot of time to run and do not want to
### exceed API call rate limits
# ncs_master = pd.DataFrame()
# search_col = 'GTIN/UPC'
# API_KEY = ... # Enter your own API Key
# fp_arr = price_rf[search_col]
# for i in range(len(fp_arr)):
# ncs_master = compile_ncs(ncs_master, fp_arr, i, API_KEY)
# price_master = pd.concat([price_rf, ncs_master], axis = 1)
# price_master = price_master.dropna().reset_index(drop = True)
# price_master['Vitamin A, RAE'] = price_master['Vitamin A, RAE'] + price_master['Vitamin A, IU']*0.3
# price_master = price_master.drop(columns = ['Vitamin A, IU'])