USDA Food Data Central (FDC) Python Client

User Guide

  • Installation
    • Requirements
    • Installing from PyPI
    • Installing from Source
    • Development Installation
    • Django Integration
    • Documentation Installation
    • Installing All Dependencies
  • Quickstart
    • Basic Setup
    • Searching for Foods
    • Getting Food Details
    • Getting Multiple Foods
    • Listing Foods
    • Filtering by Data Type
    • Analyzing Nutrient Content
    • Comparing Foods
    • Analyzing Recipes
    • Command Line Interface
    • Error Handling
  • Configuration
    • Environment Variables
    • .env File
    • Client Configuration
    • Django Settings
    • CLI Configuration
  • Django Integration
    • Setup
    • Using the Cache
    • Django Models
    • Admin Integration
    • Management Commands
    • Background Tasks
    • Views and URLs
  • Command-Line Interface
    • FDC Client CLI
      • Commands
        • search
        • food
        • nutrients
        • list
    • Nutrient Analysis Tool (NAT)
      • Commands
        • analyze
        • compare
        • recipe
    • Configuration
    • Examples
  • Nutrient Analysis
    • Basic Nutrient Analysis
    • Comparing Foods
    • Recipe Analysis
      • Creating and Analyzing Recipes
      • Working with Ingredients
    • Visualization
    • Dietary Reference Intakes (DRIs)
    • Command-Line Interface
  • Examples
    • Basic Examples
      • Basic Search
      • Food Details
    • Nutrient Analysis Examples
      • Nutrient Analysis
      • Compare Foods
      • Recipe Analysis
    • Advanced Examples
      • Django Integration
      • Advanced Analysis
      • Command-Line Interface
      • Meal Planning
      • Visualization
    • Running the Examples
  • Advanced Usage
    • Custom API Requests
    • Unit Conversion
    • Batch Processing
    • Custom Data Processing
    • Rate Limiting
  • Error Handling
    • Exception Hierarchy
    • Basic Error Handling
    • Handling Specific HTTP Status Codes
    • Retry Logic
    • Logging Errors

API Reference

  • Client API
    • FdcClient
      • FdcClient
        • FdcClient.api_key
        • FdcClient.base_url
        • FdcClient.session
        • FdcClient.__init__()
        • FdcClient.search()
        • FdcClient.get_food()
        • FdcClient.get_foods()
        • FdcClient.get_nutrients()
        • FdcClient.list_foods()
  • Models API
    • Food
      • Food
        • Food.fdc_id
        • Food.description
        • Food.data_type
        • Food.publication_date
        • Food.food_class
        • Food.food_category
        • Food.scientific_name
        • Food.brand_owner
        • Food.brand_name
        • Food.ingredients
        • Food.serving_size
        • Food.serving_size_unit
        • Food.household_serving_fulltext
        • Food.nutrients
        • Food.food_portions
        • Food.from_api_data()
        • Food.__init__()
    • Nutrient
      • Nutrient
        • Nutrient.id
        • Nutrient.name
        • Nutrient.amount
        • Nutrient.unit_name
        • Nutrient.nutrient_nbr
        • Nutrient.rank
        • Nutrient.__str__()
        • Nutrient.from_api_data()
        • Nutrient.__init__()
    • FoodPortion
      • FoodPortion
        • FoodPortion.id
        • FoodPortion.amount
        • FoodPortion.gram_weight
        • FoodPortion.portion_description
        • FoodPortion.modifier
        • FoodPortion.measure_unit
        • FoodPortion.__str__()
        • FoodPortion.from_api_data()
        • FoodPortion.__init__()
    • SearchResult
      • SearchResult
        • SearchResult.foods
        • SearchResult.total_hits
        • SearchResult.current_page
        • SearchResult.total_pages
        • SearchResult.from_api_data()
        • SearchResult.__init__()
    • SearchResultFood
      • SearchResultFood
        • SearchResultFood.fdc_id
        • SearchResultFood.description
        • SearchResultFood.data_type
        • SearchResultFood.publication_date
        • SearchResultFood.food_category
        • SearchResultFood.brand_owner
        • SearchResultFood.brand_name
        • SearchResultFood.from_api_data()
        • SearchResultFood.__init__()
  • Django Integration API
    • FdcCache
    • Models
      • FoodModel
      • NutrientModel
      • FoodPortionModel
  • Analysis API
    • Nutrient Analysis
      • NutrientAnalysis
        • NutrientAnalysis.food
        • NutrientAnalysis.serving_size
        • NutrientAnalysis.nutrients
        • NutrientAnalysis.calories_per_serving
        • NutrientAnalysis.protein_per_serving
        • NutrientAnalysis.carbs_per_serving
        • NutrientAnalysis.fat_per_serving
        • NutrientAnalysis.macronutrient_distribution
        • NutrientAnalysis.get_nutrient()
      • NutrientValue
        • NutrientValue.nutrient
        • NutrientValue.amount
        • NutrientValue.unit
        • NutrientValue.dri
        • NutrientValue.dri_percent
        • NutrientValue.dri_type
      • analyze_food()
      • analyze_foods()
      • compare_foods()
    • Nutrients
      • Nutrient
        • Nutrient.id
        • Nutrient.name
        • Nutrient.display_name
        • Nutrient.unit
        • Nutrient.group
        • Nutrient.usda_id
        • Nutrient.id
        • Nutrient.name
        • Nutrient.display_name
        • Nutrient.unit
        • Nutrient.group
        • Nutrient.usda_id
      • NUTRIENTS
      • NUTRIENT_GROUPS
    • Dietary Reference Intakes
      • DriType
        • DriType.RDA
        • DriType.AI
        • DriType.UL
        • DriType.EAR
        • DriType.AMDR
      • Gender
        • Gender.MALE
        • Gender.FEMALE
      • get_dri()
    • Recipe Analysis
      • Recipe
        • Recipe.name
        • Recipe.ingredients
        • Recipe.servings
        • Recipe.description
        • Recipe.total_weight_g
        • Recipe.get_weight_per_serving()
      • Ingredient
        • Ingredient.food
        • Ingredient.weight_g
        • Ingredient.description
        • Ingredient.__str__()
      • RecipeAnalysis
        • RecipeAnalysis.recipe
        • RecipeAnalysis.per_serving_analysis
        • RecipeAnalysis.ingredient_analyses
      • parse_ingredient()
      • create_recipe()
      • analyze_recipe()
    • Visualization
      • generate_macronutrient_chart_data()
      • generate_dri_chart_data()
      • generate_html_report()
    • Command-Line Interface
      • main()
  • Utils API
    • Unit Conversion
      • parse_unit_and_value()
      • convert_to_grams()
      • convert_to_milliliters()
      • convert_measurement()
      • normalize_nutrient_value()
  • Exceptions API
    • FdcApiError
      • FdcApiError
    • FdcAuthError
      • FdcAuthError
    • FdcRateLimitError
      • FdcRateLimitError
    • FdcValidationError
      • FdcValidationError
    • FdcResourceNotFoundError
      • FdcResourceNotFoundError
  • CLI API
    • Main Entry Point
      • main()
    • Command Handlers
      • search_command()
      • food_command()
      • nutrients_command()
      • list_command()
    • Utility Functions
      • format_output()
      • pretty_print_object()

Development

  • Contributing
    • Setting Up Development Environment
    • Code Style
    • Testing
    • Running Specific Test Categories
    • Documentation
    • Pull Request Process
    • Code of Conduct
  • Testing
    • Test Framework
    • Running Tests
    • Integration Tests
    • Django Tests
    • VS Code Integration
    • Test Structure
    • Writing Tests
    • Example Test
  • Releasing
    • Release Process
      • 1. Update Version
      • 2. Update Changelog
      • 3. Run Tests
      • 4. Build Documentation
      • 5. Create Release Commit
      • 6. Create Git Tag
      • 7. Push to GitHub
      • 8. Build and Upload to PyPI
      • 9. Verify Installation
      • 10. Update Documentation
    • Post-Release
      • 1. Announce the Release
      • 2. Start Next Development Cycle
USDA Food Data Central (FDC) Python Client
  • Python Module Index

Python Module Index

u
 
u
- usda_fdc
    usda_fdc.analysis
    usda_fdc.analysis.cli
    usda_fdc.analysis.dri
    usda_fdc.analysis.nutrients
    usda_fdc.analysis.recipe
    usda_fdc.analysis.visualization
    usda_fdc.cli
    usda_fdc.client
    usda_fdc.django
    usda_fdc.django.models
    usda_fdc.exceptions
    usda_fdc.models
    usda_fdc.utils

© Copyright 2025, Michael McGarrah.

Built with Sphinx using a theme provided by Read the Docs.