# Market Vision

The connector calls the [Market Vision API](https://reporting.marketvision-spring.com/api/v1/documentation), starting from its
[projects](https://reporting.marketvision-spring.com/api/v1/documentation#List_of_Projects_150) endpoint.

The data is extracted incrementally, so only data that has been changed since the last run is fetched. 
The component has backfill implemented, meaning that if not all data could be fetched in the first run due to large 
amounts of data, it will be fetched in the following runs.

**Before you start**

You need:

- **The user name and password of a Market Vision user.** The connector signs in with them and reads all projects the user can see.

What each tab needs:

- **Prompt tab:** Kai, the **Kai Agent** button in the top bar, on supported stacks. A new Free Plan project has it from the start; elsewhere an organization admin turns it on once: Get started with Kai (/kai/getting-started/).
- **UI tab:** a browser.
- **CLI / API tab:** kbagent (/cli/getting-started/), connected to your project. The checks only read.

## Configuration
[Create a new configuration](https://help.keboola.com/components/configurations/#create-a-configuration) of the **Market Vision** connector.
Then fill in your Market Vision **Username** and **Password**.

Once the credentials are filled in, save the configuration and you can run the component. If you have a lot of data in
Market Vision, it might take a couple of runs to extract all the data. You can see that the backfill has finished by not seeing
the message "MAX RUNTIME of component has almost been reached, saving data. Rerun the component to let backfill fetch all of your data"

**Check:**

### Prompt

```text title="Prompt" wrap
Did the latest job of my Market Vision configuration succeed, and which tables did it load, with row counts?
```

Kai only reads here, so it asks for no approval, and its answer links to what it found in your project.

### UI

The job ends with status **Success** and Storage has the tables listed under [Data output](https://help.keboola.com/components/extractors/marketing-sales/market-vision/#data-output),
such as `project_form_detail`. If the job log shows the MAX RUNTIME message, run it again until it doesn't.

### CLI / API

```bash
kbagent job list --component-id kds-team.ex-market-vision --config-id 123456789 --limit 1
kbagent storage tables --bucket-id in.c-kds-team-ex-market-vision-123456789
```

Replace `123456789` with your configuration ID: `status` shows whether the job succeeded, and `id` and `rows_count` list the tables it loaded.

---

## Data output

The data is extracted into the following tables:

[Table Form Details](https://reporting.marketvision-spring.com/api/v1/documentation#Form_Detail_231):
 - project_form_detail_questions
 - project_form_detail_index
 - project_form_detail

[Project Form Fieldsets](https://reporting.marketvision-spring.com/api/v1/documentation#Fieldsets_Structure_515):
 - project_form_fieldsets
   
[Project Form Categories](https://reporting.marketvision-spring.com/api/v1/documentation#Categories_Structure_465):
 - project_form_categories

[Project Form Questions](https://reporting.marketvision-spring.com/api/v1/documentation#Questions_Structure_317):
 - project_form_questions
