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 Command-Line Interface
      • Basic Usage
      • Global Options
      • Commands
        • search
        • food
        • nutrients
        • list
    • Nutrient Analysis Command-Line Interface
      • Basic Usage
      • Global Options
      • Commands
        • analyze
        • compare
        • recipe
    • Examples
    • Using Environment Variables
  • Nutrient Analysis
    • Basic Usage
    • Comparing Foods
    • Recipe Analysis
    • Dietary Reference Intakes
    • Visualization
    • Command-Line Interface
    • 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.from_api_data()
        • Nutrient.__init__()
    • FoodPortion
      • FoodPortion
        • FoodPortion.id
        • FoodPortion.amount
        • FoodPortion.gram_weight
        • FoodPortion.portion_description
        • FoodPortion.modifier
        • FoodPortion.measure_unit
        • 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.nutrients
        • NutrientAnalysis.dri_type
        • NutrientAnalysis.gender
        • NutrientAnalysis.serving_size
        • NutrientAnalysis.calories_per_serving
        • NutrientAnalysis.macronutrient_distribution
        • NutrientAnalysis.food
        • NutrientAnalysis.nutrients
        • NutrientAnalysis.dri_type
        • NutrientAnalysis.gender
        • NutrientAnalysis.serving_size
        • NutrientAnalysis.calories_per_serving
        • NutrientAnalysis.macronutrient_distribution
        • NutrientAnalysis.get_nutrient()
        • NutrientAnalysis.get_nutrients_by_group()
        • NutrientAnalysis.get_macronutrients()
        • NutrientAnalysis.get_vitamins()
        • NutrientAnalysis.get_minerals()
        • NutrientAnalysis.get_amino_acids()
        • NutrientAnalysis.get_nutrient_density()
        • NutrientAnalysis.to_dict()
      • NutrientValue
        • NutrientValue.nutrient
        • NutrientValue.amount
        • NutrientValue.unit
        • NutrientValue.dri_percent
        • NutrientValue.nutrient
        • NutrientValue.amount
        • NutrientValue.unit
        • NutrientValue.dri_percent
      • 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
      • DietaryReferenceIntakes
        • DietaryReferenceIntakes.data
        • DietaryReferenceIntakes.metadata
        • DietaryReferenceIntakes.__init__()
        • DietaryReferenceIntakes.get_dri()
        • DietaryReferenceIntakes.get_all_dris()
      • DriType
        • DriType.RDA
        • DriType.AI
        • DriType.UL
      • Gender
        • Gender.MALE
        • Gender.FEMALE
      • get_dri()
    • Recipe Analysis
      • Recipe
        • Recipe.name
        • Recipe.ingredients
        • Recipe.servings
        • Recipe.instructions
        • Recipe.total_weight_g
        • Recipe.name
        • Recipe.ingredients
        • Recipe.servings
        • Recipe.instructions
        • Recipe.total_weight_g
        • Recipe.add_ingredient()
        • Recipe.get_weight_per_serving()
      • Ingredient
        • Ingredient.food
        • Ingredient.amount
        • Ingredient.unit
        • Ingredient.weight_g
        • Ingredient.food
        • Ingredient.amount
        • Ingredient.unit
        • Ingredient.weight_g
      • RecipeAnalysis
        • RecipeAnalysis.recipe
        • RecipeAnalysis.total_analysis
        • RecipeAnalysis.per_serving_analysis
        • RecipeAnalysis.ingredient_analyses
        • RecipeAnalysis.recipe
        • RecipeAnalysis.total_analysis
        • RecipeAnalysis.per_serving_analysis
        • RecipeAnalysis.ingredient_analyses
      • parse_ingredient()
      • create_recipe()
      • analyze_recipe()
    • Visualization
      • generate_macronutrient_chart_data()
      • generate_dri_chart_data()
      • generate_nutrient_comparison_chart_data()
      • generate_nutrient_radar_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
    • Version Numbering
    • Release Process
      • 1. Update Version
      • 2. Update Changelog
      • 3. Create Release Commit
      • 4. Create Git Tag
      • 5. Push to GitHub
      • 6. Build Distribution
      • 7. Upload to PyPI
      • 8. Create GitHub Release
      • 9. Update Documentation
    • Post-Release
USDA Food Data Central (FDC) Python Client
  • Search


© Copyright 2025, Your Name.

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