# `PhoenixKit.Modules.Shop.Import.CSVAnalyzer`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/shop/import/csv_analyzer.ex#L1)

Analyze Shopify CSV files to extract option metadata.

Extracts all Option1..Option10 names and unique values from CSV
for use in the import mapping UI.

## Usage

    CSVAnalyzer.analyze_options("/path/to/products.csv")
    # => %{
    #   options: [
    #     %{name: "Size", position: 1, values: ["Small", "Medium", "Large"]},
    #     %{name: "Color", position: 2, values: ["Red", "Blue", "Green"]}
    #   ],
    #   total_products: 150,
    #   total_variants: 450
    # }

# `analyze_option_names`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/shop/import/csv_analyzer.ex#L103)

Quick analysis - only extracts option names without values.

Faster than full analysis, useful for initial UI display.

# `analyze_options`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/shop/import/csv_analyzer.ex#L47)

Analyzes a CSV file and extracts option metadata.

Returns a map with:
- `options` - List of option definitions with name, position, and unique values
- `total_products` - Number of unique product handles
- `total_variants` - Total number of variant rows

## Examples

    CSVAnalyzer.analyze_options("/tmp/products.csv")
    # => %{
    #   options: [
    #     %{name: "Size", position: 1, values: ["S", "M", "L", "XL"]},
    #     %{name: "Cup Color", position: 2, values: ["Red", "Blue"]},
    #     %{name: "Liquid Color", position: 3, values: ["Clear", "Amber"]}
    #   ],
    #   total_products: 50,
    #   total_variants: 200
    # }

# `compare_with_global_option`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/shop/import/csv_analyzer.ex#L132)

Compares CSV option values with global option values.

Returns a map showing which values are new (not in global option).

## Examples

    CSVAnalyzer.compare_with_global_option(csv_values, global_option)
    # => %{
    #   existing: ["Red", "Blue"],
    #   new: ["Yellow", "Purple"]
    # }

---

*Consult [api-reference.md](api-reference.md) for complete listing*
