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

# Advanced Data Modeling: Creating Context

This article, intended for Admin users and Data Administrators, details the three primary methods for creating and curating Context to improve AI-powered analytics in responses. The main goal of this page is to explain the following concepts:

* [Formal Semantic Modeling: Model data using a formal semantic layer.](#formal-semantic-modeling)
* [Natural Language Knowledge: Enrich the AI's understanding with natural language.](#natural-language-knowledge)
* [Feedback-Based Context: Improve accuracy by directly incorporating user feedback.](#feedback-based-context)

## Formal Semantic Modeling

This section outlines the core concepts behind translating raw database structures into a well-defined, business-friendly semantic layer. This allows users to interact with data in familiar business terms.

### Table and column documentation

Properly documenting tables and columns provides foundational context to enable effective analytics. For each table, provide a clear, plain-English description of what the table represents, and include a statement of what each row's granularity represents, such as, "*Each row represents a single sales transaction from a point-of-sale system*". For each column, define a user-friendly Display Name, a Description in business terms, and a Display Format.

<Note>
  For a detailed guide on this topic, please refer to our article [Document Tables and Columns](/setting-up-wisdom-ai/manage-tables-columns/document-tables-and-columns).
</Note>

<Frame>
  <img alt="Image showing the Document Tables interface" lightAlt="Image showing the Document Tables interface" darkAlt="Image showing the Document Tables interface" src="https://mintcdn.com/wisdomai/35VaoX0QDbIt5GJg/images/new-ui-document-table.png?fit=max&auto=format&n=35VaoX0QDbIt5GJg&q=85&s=cb33645e817fbb3af35b315892c978d0" className="dark:hidden" width="1813" height="1025" data-path="images/new-ui-document-table.png" />

  <img alt="Image showing the Document Tables interface" lightAlt="Image showing the Document Tables interface" darkAlt="Image showing the Document Tables interface" src="https://mintcdn.com/wisdomai/FPeFp9c8fz1r_sxU/dark-img/dark-new-ui-document-table.png?fit=max&auto=format&n=FPeFp9c8fz1r_sxU&q=85&s=6c05ffaed71fe6657f12e76cec0748fd" className="hidden dark:block" width="1813" height="1025" data-path="dark-img/dark-new-ui-document-table.png" />
</Frame>

### Defining Entities

An Entity is a business-critical object, such as "Account" or "Product," represented within the Data Graph. In WisdomAI, these entities are prioritized in the chat experience to enhance user understanding and interaction.

When an entity is defined, WisdomAI automatically improves the chat response by:

* Replacing unintuitive ID columns with human-readable names.
* Displaying related columns to provide a more complete Context.
* Providing direct, automatically resolved answers.
* Generating external links to source systems, like Salesforce for an "Opportunity" or Zendesk for a "Case."

Creating an entity involves grouping columns from one or more data source tables into a logical business object that mirrors a real-world concept. This process includes naming the entity, mapping it to its underlying data tables, and configuring its properties, such as its primary key and the field that will serve as its default display name.

<Frame>
  <img alt="Image showing the Entity Mapping option" lightAlt="Image showing the Entity Mapping option" darkAlt="Image showing the Entity Mapping option" src="https://mintcdn.com/wisdomai/oq67V3T9jhHN9WJO/images/entity-mapping.png?fit=max&auto=format&n=oq67V3T9jhHN9WJO&q=85&s=f9ec86ff4d46b9a38982de0d5af1de00" className="dark:hidden" width="1247" height="660" data-path="images/entity-mapping.png" />

  <img alt="Image showing the Entity Mapping option" lightAlt="Image showing the Entity Mapping option" darkAlt="Image showing the Entity Mapping option" src="https://mintcdn.com/wisdomai/FPeFp9c8fz1r_sxU/dark-img/entity-mapping.png?fit=max&auto=format&n=FPeFp9c8fz1r_sxU&q=85&s=5c699103a4a2ea8757d8247cbfd355ce" className="hidden dark:block" width="1247" height="660" data-path="dark-img/entity-mapping.png" />
</Frame>

### Establishing relationships

Define the connections between entities to enable precise data-model navigation. Create relationships by selecting the source and target tables and their corresponding attributes. You must configure the relationship's cardinality (1:1, 1:M, M:M). 

<Warning>
  Use join cardinality carefully, as incorrect settings can drastically change query results and lead to missing or duplicated data.
</Warning>

<Frame>
  <img alt="Image showing the Create Relationship modal" lightAlt="Image showing the Create Relationship modal" darkAlt="Image showing the Create Relationship modal" src="https://mintcdn.com/wisdomai/oq67V3T9jhHN9WJO/images/create-relationship.png?fit=max&auto=format&n=oq67V3T9jhHN9WJO&q=85&s=6b36ff20ae897e2e1ecf305aa1df087f" className="dark:hidden" width="1191" height="568" data-path="images/create-relationship.png" />

  <img alt="Image showing the Create Relationship modal" lightAlt="Image showing the Create Relationship modal" darkAlt="Image showing the Create Relationship modal" src="https://mintcdn.com/wisdomai/FPeFp9c8fz1r_sxU/dark-img/create-relationship.png?fit=max&auto=format&n=FPeFp9c8fz1r_sxU&q=85&s=0cae72d34131d9d3751a1ae9fae6028d" className="hidden dark:block" width="1191" height="568" data-path="dark-img/create-relationship.png" />
</Frame>

### Creating Metrics

Define standard calculations to enforce consistent business logic and simplify analysis for end-users. This involves creating Metrics, quantifiable business calculations such as Revenue or Conversion Rate, defined with SQL expressions and reusable across the organization.

<Note>
  For a comprehensive guide on this topic, including step-by-step instructions and detailed examples, please refer to our full article, [How to Create Metrics](/improve-wisdom-ai-responses/how-to-create-metrics).
</Note>

<Frame>
  <img alt="Image showing the Metrics Tab" lightAlt="Image showing the Metrics Tab" darkAlt="Image showing the Metrics Tab" src="https://mintcdn.com/wisdomai/VImBlkvAldiUjVTU/images/new-ui-metrics.png?fit=max&auto=format&n=VImBlkvAldiUjVTU&q=85&s=72e3170a4a70f849c1f16a585f35727b" className="dark:hidden" width="1657" height="772" data-path="images/new-ui-metrics.png" />

  <img alt="Image showing the Metrics Tab" lightAlt="Image showing the Metrics Tab" darkAlt="Image showing the Metrics Tab" src="https://mintcdn.com/wisdomai/FPeFp9c8fz1r_sxU/dark-img/dark-new-ui-metrics.png?fit=max&auto=format&n=FPeFp9c8fz1r_sxU&q=85&s=af0376bb26fe2472f193b50d9b027b2b" className="hidden dark:block" width="1657" height="772" data-path="dark-img/dark-new-ui-metrics.png" />
</Frame>

### Data model augmentation

Augment your data model with derived tables and columns using standard SQL syntax. Derived Columns and Tables are calculated fields or virtual tables created with SQL to clean, enrich, or simplify complex underlying data. These augmentations can be used to:

* **Clean Data:** Standardize formats, handle missing values, fix inconsistencies.
* **Enrich Data:** Add business context, derive new metrics, categorize values.
* **Simplify Analysis:** Create business-friendly views of complex underlying data.

<img alt="Image showing the Derived Table" lightAlt="Image showing the Derived Table" darkAlt="Image showing the Derived Table" src="https://mintcdn.com/wisdomai/oq67V3T9jhHN9WJO/images/derived-table.png?fit=max&auto=format&n=oq67V3T9jhHN9WJO&q=85&s=44e030756aaeee98a8d11d3a2856b3e2" className="dark:hidden" width="756" height="664" data-path="images/derived-table.png" />

<img alt="Image showing the Derived Table" lightAlt="Image showing the Derived Table" darkAlt="Image showing the Derived Table" src="https://mintcdn.com/wisdomai/FPeFp9c8fz1r_sxU/dark-img/customer-order-summary.png?fit=max&auto=format&n=FPeFp9c8fz1r_sxU&q=85&s=3ebdcbe03c65ee2f9683b8c993e83f16" className="hidden dark:block" width="847" height="655" data-path="dark-img/customer-order-summary.png" />

## Natural language Knowledge

This section covers the methods for providing the AI with unstructured, domain-specific knowledge that is difficult to capture in a formal data model, such as business rules or specific terminology.

### Manual Knowledge entry

Add domain-specific knowledge, rules, or naming conventions in natural language sentences to guide the AI’s understanding. An example is: "*Regions are the same as Territories*." This improves accuracy by helping the system interpret ambiguous terms and captures knowledge that does not exist in the database schema. It is crucial to validate the impact of manual entries by asking a question in the chat interface to see if the response is as expected.

<Note>
  To learn how to add Knowledge, read the article [Add Domain-Specific Knowledge](/setting-up-wisdom-ai/add-domain-specific-knowledge). There, you will find an example of how the response changes after you add Knowledge.
</Note>

<Frame>
  <img alt="Image showing the Knowledge Tab" lightAlt="Image showing the Knowledge Tab" darkAlt="Image showing the Knowledge Tab" src="https://mintcdn.com/wisdomai/ZEzcyvgnlN7dJoq-/images/NEW-knowledge-tab.png?fit=max&auto=format&n=ZEzcyvgnlN7dJoq-&q=85&s=03abef6031db310536053afc18ee107e" className="dark:hidden" width="1822" height="988" data-path="images/NEW-knowledge-tab.png" />

  <img alt="Image showing the Knowledge Tab" lightAlt="Image showing the Knowledge Tab" darkAlt="Image showing the Knowledge Tab" src="https://mintcdn.com/wisdomai/FPeFp9c8fz1r_sxU/dark-img/knowledge-tab.png?fit=max&auto=format&n=FPeFp9c8fz1r_sxU&q=85&s=6b0dfc6631e67887f6abd9263c5f0966" className="hidden dark:block" width="1822" height="988" data-path="dark-img/knowledge-tab.png" />
</Frame>

### Importing unstructured Context (beta)

Enhance the AI’s Context by importing knowledge directly from existing business and technical documents. This process is handled through the 'Chat' window, which provides an interactive interface for selectively extracting Context. Supported information types that can be imported include:

* **ERD Diagrams:** Extract entity relationships from diagram images.
* **dbt Files:** Import transformation logic and metric definitions.
* **SQL Queries**: Learn from existing queries and report definitions.
* **Data Dictionaries:** Import field descriptions and business definitions.
* **Business Glossaries:** Learn industry and company-specific terminology.
* **CSV files:** Import master data, mapping tables, or lists of business entities to learn categorical values and key dimensions (e.g., product catalogs, regional hierarchies, or customer segments).

<Note>
  To learn how to upload CSV files, read the [Basic Tutorial](https://docs.askwisdom.ai/setting-up-wisdom-ai/basic-tutorial-connect-and-test#upload-csv-files). Speak with your WisdomAI representative to enable any of the other features.
</Note>

## Feedback-based Context

This section describes the continuous learning loop, where direct user feedback on AI-generated responses is used to validate and refine the system's knowledge and accuracy over time.

### Creating Reviewed Queries

Create a library of pre-vetted queries by pairing a natural language question with its ideal SQL response. This is the most critical aspect of Context for the language model to understand your data. Reviewed Queries are created from the chat experience by giving a "thumbs up" to a correct response, then confirming the natural-language question that the SQL code answers. This process ensures accuracy and consistency for common business questions.

<Note>
  To learn more about validating your queries, refer to the [Reviewed Queries](/setting-up-wisdom-ai/feedback-mechanisms/reviewed-queries) article.
</Note>

<img alt="Image showing the Reviewed Queries tab" lightAlt="Image showing the Reviewed Queries tab" darkAlt="Image showing the Reviewed Queries tab" src="https://mintcdn.com/wisdomai/8tDBZnQ4e-AZeAWF/images/new-ui-reviewed-queries.png?fit=max&auto=format&n=8tDBZnQ4e-AZeAWF&q=85&s=48e9232a17f827a2c7e0934c3f08d814" className="dark:hidden" width="1818" height="991" data-path="images/new-ui-reviewed-queries.png" />

<img alt="Image showing the Reviewed Queries tab" lightAlt="Image showing the Reviewed Queries tab" darkAlt="Image showing the Reviewed Queries tab" src="https://mintcdn.com/wisdomai/FPeFp9c8fz1r_sxU/dark-img/new-ui-reviewed-queries.png?fit=max&auto=format&n=FPeFp9c8fz1r_sxU&q=85&s=aa27a582aa41d06bbd80ee4b859fa9f2" className="hidden dark:block" width="1818" height="991" data-path="dark-img/new-ui-reviewed-queries.png" />

### Advanced feedback and corrections

Provide direct feedback to correct the AI and allow power users to refine the underlying SQL, creating a robust knowledge base from user interactions. Users can mark responses as incorrect to flag them for review.

* [**SQL Editing for Power Users**](https://docs.askwisdom.ai/setting-up-wisdom-ai/feedback-mechanisms/provide-feedback-to-the-system#advanced-feedback-mechanisms-for-administrators): Each answer in the chat includes an "Edit" button that allows Admin users to modify the underlying SQL query directly to fix calculation issues, add joins, or modify filters. Edited queries become part of the system's knowledge base for handling similar questions in the future.
* [**Negative Feedback Workflow**](/setting-up-wisdom-ai/feedback-mechanisms/monitor-negative-feedback): Negative feedback is channeled to administrators for review. This is managed through visual indicators that highlight chats with negative feedback and automatic email notifications sent to administrators for prompt attention.

<img src="https://mintcdn.com/wisdomai/82xgEVWUP7cwhDHG/images/sql-editing.png?fit=max&auto=format&n=82xgEVWUP7cwhDHG&q=85&s=ed567c179636908d5fca8eb21fb3a876" alt="Image showing the Sql Editing Option" lightAlt="Image showing the Sql Editing Option" darkAlt="Image showing the Sql Editing Option" className="dark:hidden" width="1209" height="630" data-path="images/sql-editing.png" />

<img src="https://mintcdn.com/wisdomai/LpfNrjGbGtoOlAwH/dark-img/sql-editing.png?fit=max&auto=format&n=LpfNrjGbGtoOlAwH&q=85&s=c349d4fea300aa471903ac66bd740b16" alt="Image showing the Sql Editing Option" lightAlt="Image showing the Sql Editing Option" darkAlt="Image showing the Sql Editing Option" className="hidden dark:block" width="1624" height="874" data-path="dark-img/sql-editing.png" />

## **Next steps**

<CardGroup cols={3}>
  <Card title="Auditing" icon="clipboard-list" href="/using-wisdom-ai-everyday/auditing">
    Review query history and system activity to ensure compliance and accuracy.
  </Card>

  <Card title="Provide Feedback to the System" icon="thumbs-up" href="/setting-up-wisdom-ai/feedback-mechanisms/provide-feedback-to-the-system">
    Learn how to rate answers and provide corrections to improve the system's accuracy.
  </Card>

  <Card title="Validate and Test Answers" icon="check-double" href="/improve-wisdom-ai-responses/validate-and-test-answers">
    Understand the methods for verifying the correctness and reliability of generated answers.
  </Card>
</CardGroup>
