> ## Documentation Index
> Fetch the complete documentation index at: https://docs.highailabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Export Data

> Download your complete cannabis history -- orders, stash, collections, reports, stats, and session journal -- in standard formats for full data ownership.

<Note>
  **Status:** Planned
  **Tier:** Pro
</Note>

## Overview

Your cannabis data is yours. Every order you logged, every stash item you tracked, every strain you rated, every session you journaled, every report that was generated for you -- it all belongs to you. High IQ's privacy promise is not just about not selling your data. It is about giving you complete control over it, including the ability to take it with you.

Export Data lets you download your entire High IQ history in standard, portable formats. CSV for spreadsheets. JSON for developers and data analysis tools. This is not a grudging compliance feature buried in settings. It is a first-class data ownership tool that reinforces the trust at the core of the High IQ brand. When users know they can leave with their data at any time, they are more likely to stay -- because they are staying by choice, not by lock-in.

Full GDPR and CCPA compliance is a side effect of building this feature right. The primary motivation is that respecting user autonomy is a core principle, and data portability is how you prove it.

## What It Does

* **Complete data export** -- Download everything: orders, stash items, dispensaries, strain ratings, favorites, collections, session journal entries, report data, badges, and stats
* **Selective export** -- Choose which data categories to include. Export just your orders, just your session journal, or any combination
* **CSV format** -- Flat, tabular format that opens in Excel, Google Sheets, Numbers, or any spreadsheet application
* **JSON format** -- Structured, nested format for developers, data scientists, or import into other tools
* **Relationship preservation** -- Exported data maintains relationships between records (e.g., sessions linked to stash items, orders linked to dispensaries) via consistent IDs
* **Human-readable** -- CSV column headers and JSON field names use plain English, not internal database identifiers
* **Export history** -- See a log of past exports with timestamps and sizes
* **Scheduled exports** -- Optionally schedule automatic monthly exports that are emailed to you as a backup
* **Immediate download** -- Export files are generated on-demand and available for immediate download, not emailed later
* **Secure delivery** -- Export files are encrypted in transit and available for download for 24 hours before automatic deletion from our servers

## User Value

<Tip>
  The "aha moment" is opening the exported CSV in a spreadsheet and seeing your complete cannabis history -- every purchase, every session, every rating -- organized and yours to analyze however you want. It is the moment you realize this app respects your autonomy.
</Tip>

## What Gets Exported

### Data Categories

| Category            | Records Included                                                            | Format Notes                                          |
| ------------------- | --------------------------------------------------------------------------- | ----------------------------------------------------- |
| **Orders**          | All orders with date, dispensary, items, prices, strain names               | One row per order item in CSV                         |
| **Stash Items**     | All current and historical stash items with strain, quantity, status, dates | Includes consumption history                          |
| **Dispensaries**    | All saved dispensaries with name, address, rating, notes, visit count       | Includes menu URLs                                    |
| **Strain Ratings**  | Star ratings and ranking data for all rated strains                         | Includes ELO scores                                   |
| **Favorites**       | All favorited strains with date added                                       | Simple list                                           |
| **Collections**     | All strain collections with names and member strains                        | Nested in JSON; flattened in CSV                      |
| **Session Journal** | All session entries with strain, method, dosage, mood, effects, notes       | One row per session in CSV                            |
| **Reports**         | AI-generated report data (section content, generation date, strain context) | Full text in JSON; summary in CSV                     |
| **Badges**          | All earned badges with date earned and progress data                        | Includes progress toward unearned badges              |
| **Stats**           | Computed analytics: spending summaries, consumption frequency, top strains  | Snapshot at export time                               |
| **Health Data**     | If Health Sync is connected: exported health metrics linked to sessions     | Only data collected by High IQ, not raw wearable data |

### What Is NOT Exported

| Excluded                        | Reason                                                        |
| ------------------------------- | ------------------------------------------------------------- |
| AI model weights or embeddings  | Proprietary platform data, not user data                      |
| Other users' reviews or data    | Privacy of other users                                        |
| Strain database records         | Licensed/proprietary data (users can access via the API)      |
| Internal IDs or system metadata | Not useful to users; replaced with human-readable identifiers |

## How It Works

<Steps>
  <Step title="Open Export Data">
    Navigate to Settings, then "Export My Data" in the Account & Privacy section.
  </Step>

  <Step title="Select Categories">
    Choose which data categories to include in the export. Default is "everything." Uncheck any categories you do not need.
  </Step>

  <Step title="Choose Format">
    Select CSV or JSON. A brief description explains the difference: "CSV for spreadsheets, JSON for developers."
  </Step>

  <Step title="Generate Export">
    Tap "Generate Export." A progress indicator shows the export being assembled. For most users, this completes in under 30 seconds.
  </Step>

  <Step title="Download">
    The export file (or ZIP archive if multiple CSVs) is available for immediate download. A share sheet allows saving to Files, AirDrop, email, or cloud storage.
  </Step>

  <Step title="Cleanup">
    The export file is stored securely on our servers for 24 hours in case you need to re-download, then permanently deleted.
  </Step>
</Steps>

## Technical Approach

### Architecture

| Component             | Technology                | Notes                                                               |
| --------------------- | ------------------------- | ------------------------------------------------------------------- |
| **Data assembly**     | Convex action             | Queries all user data tables and assembles into a structured object |
| **CSV generation**    | Server-side serialization | Flattens nested data into tabular format with proper escaping       |
| **JSON generation**   | Native serialization      | Preserves nested structure with human-readable field names          |
| **File packaging**    | ZIP compression           | Multiple CSVs (one per category) are bundled into a single ZIP      |
| **Temporary storage** | Supabase Storage          | Signed URL with 24-hour expiry for secure download                  |
| **Delivery**          | iOS share sheet           | Native share sheet for download, AirDrop, email, or cloud save      |

### Data Assembly Pipeline

```
Export Request → Convex Action
                      ↓
        Query All User Data Tables in Parallel
        (orders, stash, dispensaries, ratings, etc.)
                      ↓
        Field Name Humanization
        (internal_field_name → "Human Readable Name")
                      ↓
        Format Conversion (CSV or JSON)
                      ↓
        ZIP Packaging (if CSV with multiple categories)
                      ↓
        Upload to Supabase Storage (signed URL, 24h TTL)
                      ↓
        Return Download URL to Client
```

### Field Name Mapping

Internal database field names are mapped to human-readable column headers:

| Internal       | Exported As                                  |
| -------------- | -------------------------------------------- |
| `strainId`     | Strain Name (resolved to display name)       |
| `dispensaryId` | Dispensary Name (resolved)                   |
| `createdAt`    | Date Created (formatted as YYYY-MM-DD HH:MM) |
| `moodBefore`   | Mood Before Session (1-5)                    |
| `effectTags`   | Effects (comma-separated)                    |

All IDs are resolved to human-readable names. Cross-references use consistent naming so users can join tables in a spreadsheet if desired.

### Performance Considerations

* **Parallel queries** -- All data tables are queried in parallel to minimize generation time
* **Streaming for large exports** -- For users with thousands of orders, the CSV is generated in a streaming fashion to avoid memory issues
* **Progress indicator** -- The UI shows category-by-category progress: "Exporting orders... Exporting stash... Packaging..."
* **Background generation** -- If the export takes more than 10 seconds, it moves to background processing with a push notification when ready

## Tier Impact

| Tier | Access                                                                                    |
| ---- | ----------------------------------------------------------------------------------------- |
| Free | Not available                                                                             |
| Pro  | Full data export in CSV and JSON, selective categories, scheduled exports, export history |

## Dependencies

* [x] Convex data storage for all user data -- **built and live**
* [x] Supabase Storage for file hosting -- **built and live**
* [ ] Convex export action (parallel data assembly)
* [ ] CSV serializer with proper escaping and field name humanization
* [ ] JSON serializer with human-readable field names
* [ ] ZIP packaging for multi-file CSV exports
* [ ] Supabase Storage signed URL generation (24h TTL)
* [ ] Export UI screen (category selector, format picker, progress indicator)
* [ ] Share sheet integration for download delivery
* [ ] Export history table (Convex)
* [ ] Scheduled export system (optional, for monthly auto-export)

## Open Questions

1. **PDF option?** -- Should we offer a PDF export for reports? AI-generated research reports are rich documents that lose formatting in CSV/JSON. A beautifully formatted PDF export of reports could be valuable, but it adds significant complexity (PDF generation on mobile).
2. **Export frequency limit** -- Should there be a cooldown between exports to prevent abuse (e.g., scripted data scraping)? One export per 24 hours seems reasonable.
3. **Incremental export** -- Should we support "export new data since last export" for users who want regular backups without re-downloading everything? This is useful but adds complexity (tracking export watermarks).
4. **GDPR "right to be forgotten"** -- Export is one half of GDPR. The other half is deletion. The existing [Delete Account](/help/account/delete-account) feature handles this, but the two should be presented together: "Export your data, then delete your account if you wish."
5. **Cross-platform import** -- If a user exports their data, could they import it into a different app? Should we design the export format with portability in mind (e.g., a standardized cannabis data schema)? This is forward-thinking but may be over-engineering for v1.

## Related Features

* [Data Privacy](/help/account/data-privacy) -- The privacy policy that governs data handling
* [Delete Account](/help/account/delete-account) -- The companion to export: take your data and leave if you choose
* [Session Journal](/planning/features/session-journal) -- Session data is a key export category
* [Notebooks](/help/features/notebooks/overview) -- Notebook content is included in exports
