## Building a Structured Use Case

Hyperscience extracts data from documents and converts them into a machine-readable format. We support Structured, Semi-structured, and Additional documents. To learn how to differentiate between the document types, see [Understanding Document Types](https://help.hyperscience.ai/v42/docs/understanding-document-types).

### Structured use cases
Use Structured layouts for documents that follow a consistent, predefined format. The pages in these documents have a clear visual design with fixed fields and standardized, repetitive patterns.

**Key aspects of Structured layouts**

- **Fixed field locations** - The fields are always in the same place on the document.
- **Standardized formats** - The format of the forms is consistent across all documents.
- **Predictable patterns** - The structure of the document remains consistent. To learn more about layout types, see [Determining Layout Type](https://help.hyperscience.ai/v42/docs/determining-layout-type).

In this article, you’ll learn how to build and evaluate your Structured models in Hyperscience for efficient document processing.

## Step 1 - Sample your documents

Reviewing your documents is the first step in creating a robust, structured model.

- **Gather document samples:** Collect examples of the document type you want to process. Include different variations if available. Learn more in the [Layout Variations](https://help.hyperscience.ai/v42/docs/training-a-structured-model#layout-variations) section of this article.
- **Review field data:** Analyze the information in each field. Ensure the data fits the expected format and doesn’t include unusual or unsupported characters. Learn more in our [Supported Characters and Default Data Types](https://help.hyperscience.ai/v42/docs/supported-characters-and-default-data-types).
  - **Example:** Check if the field “Date” follows the same format throughout your dataset.
- **Check for patterns and consistency:** Consistent documents are crucial for your Structured model performance. Ensure all fields across the documents have the same position and format. That way, you will set the proper data type for each field when creating the Structured layout. Learn more about data types in [What is a Data Type?](https://help.hyperscience.ai/v42/docs/what-is-a-data-type) and [Choosing a Data Type](https://help.hyperscience.ai/v42/docs/choosing-a-data-type).
- **Document quality:** Remove documents that would reduce model performance (e.g., documents containing unrelated information or highly distorted, skewed, noisy, pixelated, or duplicated pages).
- **Edge cases:** Check for documents that don’t fit your sample. Examples of edge cases are documents with unexpected formats.

## Layout variations

Sometimes, your documents have small differences in their visual design. In Hyperscience, these differences are handled seamlessly by using layout variations within Structured layouts.

### Example

- The position of fields (like names, dates, or totals) might be different from one document to another, or some fields might be missing in one document and present in another.
- In the two documents below, notice how the “Home Phone” and “Cell Phone” fields remain the same, but additional fields like “Have you ever been convicted of a felony?” appear in one document and not the other.

## Step 2 - Upload a blank form

To process filled documents with the same visual design through Hyperscience, you need to create a Structured layout based on a non-filled (blank) form.

### Upload a blank form

To upload a blank form:

1. Go to **Library** > **Layouts**.
2. Click **Add Layout**.
3. Click **Structured Layout**, and then click **Next**.
4. Upload a PDF, TIFF, JPG, or PNG file in one of the following ways:
   - Drag and drop the image file in the dialog box, or
   - click **Choose File** to upload from your machine.
5. Click **Next**.
6. Enter a name for your layout in the **Layout Name** field.
7. Choose the language you expect people to use when filling out the documents from the **Language** drop-down menu.
8. Click **Create**.

Once the blank form is added, you need to create a Structured layout in the Layout Editor. The Layout Editor is where you define what information Hyperscience should extract from the document.

## Step 3 - Create a Structured layout

### Field types

Create a layout that shows Hyperscience where to find the data you need in the **Layout Editor**. It helps you map fields on the form to the information you want to extract. You can extract data from the following data points:

- **Fields** - The individual elements of a document that contain key information, such as names, dates, addresses, or amounts.
- **Checkboxes** - A checkbox is used to capture two-option answers, like “Yes”/”No” or “True”/”False.”
- **Signatures** - This field shows where a handwritten or digital signature is required or present. Hyperscience can detect if a signature is present or missing.

### Data types

Data types help the system understand what kind of information to expect in a specific field. For example:

- The _Numeric_ data type is used for fields that contain only numbers.
- The _Generic Text_ data type is for fields with sentences or general text.
- Some data types like _Date_, _Currency Amount_, or _Email Address_ expect specific formats or lengths.

### Creating a Structured layout

To access the Layout Editor:
1. Go to **Library** > **Layouts** and click on the name of your layout.
2. Once in the **Layout Variations** tab, click on the name of the variation.

### Layout Editor best practices

#### Drawing bounding boxes
- Use your cursor to draw bounding boxes around each field you want to extract.
- Ensure the bounding boxes are precise to avoid cutting off text.

### Field names and data types
- Assign a clear and descriptive name for each field.
- Select the appropriate data type (e.g., _Numeric_, _Generic Text_, _Date_) based on the field’s content.

### Configure field settings
- Set the field properties, such as Transcription Supervision, Output Names, or specific data validations for each field.

| Setting | Description | Example |
| **Field Name** | This name is used to label the field in the system and should be easy to read. | If the form label says _Name (Last, First)_, you might name the field _Applicant Name (Last, First)_ or _Name_LastFirst_. |
| **Data Type** | Defines the kind of data the field should contain. | If the field is meant to capture a date of birth, select _Date_ as a data type. |
| **Output Name** | Defines a programmatic name for each field. | If the display name is _Applicant Name (Last, First)_, the output name might be _applicant_name_last_first_. |
| **Required** | When a field is marked as “Required,” the system will apply special logic to the processing. | If the transcription of a required field is determined to be blank, or if the field is marked illegible, an exception will be generated stating that the value of the required field was missing. |

## Step 4 - Adjust your layout variations

When creating a new variation in the Layout Editor, you can choose to start from an existing variation. You must have at least one existing variation in the layout. If no variations are available, you'll need to create a new layout from scratch.

### Shared fields
Shared fields are the ones included in all of a layout’s variations.

### Active and Inactive Items
If you want to remove a field from one variation but keep it in others, you should deactivate the field instead of deleting it.

## Step 5 - Commit changes and deploy

- To commit your changes to the draft version of the layout variation, click **Commit Changes** on the right side of the page.

## Step 6 - Evaluate Structured models

After you’ve committed changes and deployed your Structured layout, it is Live and ready to process documents. The next step is to upload your filled documents and monitor the model’s performance.

### Upload your completed documents
Upload your documents as submissions by following the steps below:

1. Go to **Submissions**.
2. Click **Create Submission**.
3. Upload the filled documents. If you’re uploading multiple documents at once, select **One Submission per file** to evaluate the performance of each document.
4. Click **Next** and follow the prompts.

### Using QA to improve accuracy
Use the **Documents** tab to review the extracted data and identify potential issues. Field Transcription QA allows you to sample and review individual fields from submitted documents.

To enable Field Transcription QA:
1. Go to **Flows** and click on the flow you want to enable QA for.
2. Click **Edit Flows** to access the Flow Studio.
3. Select the **Transcription Quality Assurance** checkbox.
4. Click **Save** to confirm the changes.
