docx-datacorpus / schema.md
ashliontimeless's picture
Duplicate from ashliontimeless/doc-datacorpus
f83ab7c
# Data Corpus Schema Documentation
**Version:** 1.0
---
## Overview
Each record in this corpus represents a single annotated case file — a real-world professional communication thread, enriched with structured metadata and associated document artifacts. Records are JSON objects stored as elements within a top-level array.
The corpus is intended for post-training of large language models on professional, domain-specific reasoning tasks — particularly legal drafting, document review, multi-turn client-lawyer dialogue, and expert question-answering.
---
## Top-Level Record Structure
```
Record (Object)
├── trace_id string Unique identifier for the record
├── metadata object Classification and provenance signals
└── data object The core content payload
```
### Field: `trace_id`
| Property | Detail |
|---|---|
| Type | `string` |
| Required | Yes |
| Format | Alphanumeric string (e.g., `"fd1748286"`, `"era1711548"`, `"cqa153562872"`) |
| Description | Globally unique identifier for this record. Used for deduplication, lineage tracking, and cross-referencing attachments. Attachment `file_path` values typically embed this ID (e.g., `/document/SAFEv1-trace_id-fd1748287`). |
---
## `metadata` Object
Carries classification and provenance signals consumed by data pipelines and model trainers for filtering, weighting, and curriculum design.
```
metadata (Object)
├── content_type string Content format identifier
├── area_of_law string Legal domain
├── document_type string[] Legal instrument type(s) [OPTIONAL — see note]
├── industry string[] Industry vertical(s)
├── jurisdiction string[] ISO 3166-1 alpha-2 jurisdiction code(s)
├── pii_redacted boolean PII redaction status
├── proprietary_status string[] IP/ownership classification(s)
├── provenance_tier string Source quality tier
├── tokens_estimate integer Approximate token count
└── language string BCP 47 language tag
```
### Field: `metadata.content_type`
| Property | Detail |
|---|---|
| Type | `string` |
| Required | Yes |
| Example | `"communication-thread-with-documents"` |
| Description | Identifies the structural format of the record. Governs which fields are expected under `data`, and in particular which `context` sub-schema applies. |
**Known values:**
| Value | Description | `data.context` required? |
|---|---|---|
| `communication-thread-with-documents` | Multi-turn message thread with one or more document attachments and rich structured context | Yes |
| `final-document` | A finished legal instrument produced through an internal drafting workflow; thread captures internal handoff, not client dialogue | Yes |
| `expert-reasoning` | A professional legal analysis or opinion delivered in response to a client question; thread is typically short (1–2 turns) | Yes |
| `client-question-expert-answer-pair` | A single client question paired with a single expert answer; may lack a `context` block | No |
### Field: `metadata.area_of_law`
| Property | Detail |
|---|---|
| Type | `string` |
| Required | Yes |
| Example | `"corporate"` |
| Description | High-level legal domain of the content. Used for domain-stratified sampling. |
**Known values (non-exhaustive):** `corporate`, `tax`, `compliance`, `ip`, `employment`, `litigation`, `regulatory`
### Field: `metadata.document_type`
| Property | Detail |
|---|---|
| Type | `string[]` |
| Required | Conditional — required for all `content_type` values except `client-question-expert-answer-pair` |
| Example | `["SAFE"]` |
| Description | One or more legal instrument types referenced or produced in the thread. Must be an **array of strings** even when only one type is present. Omit the field entirely (do not use `null` or `[]`) for records where no document type applies. |
**Known values (non-exhaustive):**
| Canonical value | Observed variants |
|---|---|
| `SAFE` | — |
| `term-sheet` | `term_sheet` |
| `token-warrant` | — |
| `legal-opinion` | — |
| `tax-memo` | `tax_memo` |
| `SHA` | — |
| `NDA` | — |
| `employment-agreement` | — |
| `board-resolution` | — |
### Field: `metadata.industry`
| Property | Detail |
|---|---|
| Type | `string[]` |
| Required | Yes |
| Example | `["finance", "web3"]` |
| Description | Industry vertical(s) of the parties or subject matter. A record may span multiple industries. |
**Known values (non-exhaustive):** `finance`, `web3`, `technology`, `real-estate`, `healthcare`
### Field: `metadata.jurisdiction`
| Property | Detail |
|---|---|
| Type | `string[]` |
| Required | Yes |
| Format | ISO 3166-1 alpha-2 country codes |
| Example | `["SG"]`, `["UK", "PT", "PL"]` |
| Description | Governing legal jurisdiction(s). A record may span multiple jurisdictions (e.g., cross-border tax advice or multi-party deals). |
### Field: `metadata.pii_redacted`
| Property | Detail |
|---|---|
| Type | `boolean` |
| Required | Yes |
| Example | `true` |
| Description | Indicates whether personally identifiable information has been removed. Records with `false` must not be used in training without further review. |
**Redaction markers in content:** PII is replaced inline using typed angle-bracket placeholders. All placeholders are uppercase and may be indexed with a numeric suffix.
| Placeholder | Represents | Notes |
|---|---|---|
| `<NAME>` | Person's name | May appear as `<NAME_1>`, `<NAME_2>` when multiple individuals appear in one record |
| `<NUMBER_N>` | Numeric value | Indexed per record (e.g., `<NUMBER_1>`, `<NUMBER_5>`); indices are local to each record |
| `<EMAIL>` | Email address | — |
| `<COMPANY>` | Company or entity name | — |
| `<ENTITY>` | Named legal entity (e.g., DAO, foundation, protocol) | Observed in web3/compliance records; distinct from `<COMPANY>` |
| `<ENTITY_N>` | Named legal entity (indexed) | e.g., `<ENTITY_2>` for a second entity within the same record |
| `<DATE>` | Specific date | — |
### Field: `metadata.proprietary_status`
| Property | Detail |
|---|---|
| Type | `string[]` |
| Required | Yes |
| Example | `["IP_acquisition"]` |
| Description | One or more ownership and licensing classifications for the record. Governs permissible training use. Multiple values may apply simultaneously. |
**Known values:**
| Value | Description |
|---|---|
| `IP_acquisition` | IP rights formally acquired; cleared for training use |
| `terms_consent` | Source explicitly consented to use under platform terms of service |
| `licensed` | Used under a separate data license agreement |
| `public_domain` | No restrictions |
| `restricted` | Do not use without explicit written clearance |
### Field: `metadata.provenance_tier`
| Property | Detail |
|---|---|
| Type | `string` |
| Required | Yes |
| Example | `"t1"` |
| Description | Source quality tier indicating data origin and reliability. Used for training curriculum weighting. |
**Known values:**
| Tier | Description |
|---|---|
| `t1` | Verified primary source: practitioner-generated, matter-linked content (e.g., actual client files, legal opinions) |
| `t2` | Professional practitioner-generated content not directly tied to a verified client matter |
| `t3` | Lightly curated secondary or synthetic material |
### Field: `metadata.tokens_estimate`
| Property | Detail |
|---|---|
| Type | `integer` |
| Required | Yes |
| Example | `11232` |
| Description | Estimated token count for the full record, including all nested text fields. Used for batch sizing and context window planning. Counts are approximate and may not include attachment content. |
### Field: `metadata.language`
| Property | Detail |
|---|---|
| Type | `string` |
| Required | Yes |
| Format | BCP 47 language tag |
| Example | `"en-US"` |
| Description | Language and locale of the record content. |
---
## `data` Object
The primary content payload. All records contain `communication_thread`. The `context` block is present in most records but is **optional** for `client-question-expert-answer-pair` content types.
```
data (Object)
├── context object Structured summary of matter parameters [OPTIONAL]
└── communication_thread object[] Ordered sequence of messages
```
---
## `data.context` Object
Provides machine-readable parameters extracted or inferred from the thread. The internal structure of `context` varies significantly by `content_type` and `document_type`. All fields are descriptive summaries, not validated legal data. Numeric fields may contain redaction placeholders and should be treated as strings.
---
## `data.communication_thread` Array
An ordered array of message objects representing the full dialogue. Thread length varies by content type: `client-question-expert-answer-pair` records are exactly 2 turns; `communication-thread-with-documents` records may have 5 or more.
```
communication_thread (Object[])
└── message_object
├── sequence integer 1-based ordinal position in the thread
├── sender string Role of the message author
├── message string Full message body (may contain redaction placeholders)
└── attachments object[] Documents attached to this message (may be empty array)
```
### Field: `sequence`
| Property | Detail |
|---|---|
| Type | `integer` |
| Required | Yes |
| Description | 1-based index. Defines chronological order. Gaps in sequence values are not expected but should be handled gracefully by consumers. |
### Field: `sender`
| Property | Detail |
|---|---|
| Type | `string` |
| Required | Yes |
| Description | Role identifier of the message author. |
**Known values:**
| Value | Description | Applicable content types |
|---|---|---|
| `client` | The instructing party (company, founder, or business client) | all |
| `lawyer` | The legal professional advising the client | all |
| `user_1` | Internal team member initiating a drafting task | `final-document` |
| `user_2` | Internal team member executing a drafting task | `final-document` |
### Field: `message`
| Property | Detail |
|---|---|
| Type | `string` |
| Required | Yes |
| Description | Full text of the message. May span multiple paragraphs. Redaction placeholders appear inline where PII was removed. Newlines are represented as `\n`. Informal register and typos may be present in `client` messages, particularly in `client-question-expert-answer-pair` records. |
### Field: `attachments`
| Property | Detail |
|---|---|
| Type | `object[]` |
| Required | Yes |
| Description | List of documents attached to this message. Must be an empty array `[]` when no attachments are present; the field must not be omitted. |
**Attachment object structure:**
```
attachment (Object)
├── file_name string Human-readable filename including extension
└── file_path string Corpus-internal path to the document record
```
**Observed `file_path` formats:**
```
Format — document shares parent trace_id, with explicit file extension:
/document/{document_name}-trace_id-{parent_trace_id}.docx
Example: /document/tax_memo-trace_id-fd1748284.docx
/document/term_sheet-trace_id-fd1748285.docx
```
---