Structured Modeling of Person Profiles: Attributes, Events, and Validation Practices

    This article explains how to design a structured data model for person profiles, covering attribute layering, event modeling with controlled vocabularies, versioning strategies, and consistency validation. It includes practical schema examples, an event extraction workflow, and runnable validation code, helping engineers build reliable knowledge graphs, Q&A systems, and person-centric applications.

    1. Background: Why Person Profiles Need Structured Modeling

    In information systems, person profiles are among the most common entity data types. A typical profile contains two kinds of information:

    1. Static attributes: name, aliases, gender, nationality, birthplace, birth date, occupation, etc. These remain relatively stable over long periods.
    2. Dynamic events: signing with an organization in a given year, releasing a work in a given month, publishing a public update on a specific day, etc. These accumulate over time and have a clear chronological nature.

    Storing such data as plain text leads to three problems:

    • Low retrieval efficiency: It is impossible to perform precise filters like “birthplace in a certain region” or “occupation includes X”.
    • Difficult updates: When a new event arrives, you must find the insertion point in a long text, risking information disorder.
    • Poor reusability: Downstream modules such as recommendation, Q&A, and graph reasoning cannot directly consume unstructured text.

    Therefore, structured modeling of person profiles is foundational for building knowledge graphs, intelligent Q&A, and person encyclopedia products. The rest of this article covers attribute modeling, event modeling, version management, and consistency validation.

    2. Applicability Boundaries: When Is Structured Modeling Worth the Effort

    Structured modeling incurs extra design and maintenance costs; it is not beneficial in every scenario.

    Suitable scenarios:

    • The number of entities reaches thousands or more, and batch filtering by attributes or time ranges is required.
    • Multiple downstream modules (recommendation, Q&A, graph) share the same data.
    • Data is continuously updated, and you need to trace the source and change history of each piece of information.

    Unuitable scenarios:

    • The data volume is small, rarely updated, and only used for display — plain text may suffice.
    • The original data lacks usable time information, and no one is responsible for maintaining sources.
    • Only full-text search is needed, and a full-text search engine already meets the requirements.

    3. Entity Attribute Modeling: Distinguishing Identifiers, Facts, and Descriptions

    3.1 Three-Layer Attribute Design

    Person entity attributes should not be flattened into a single object; they should be organized in three layers.

    • Identifier layer: entity_id (unique within the system, does not change with renames), primary_name (main name), aliases (a set of aliases, each with a type). Aliases determine retrieval recall. Users may search by stage name rather than legal name.
    • Fact layer: verifiable objective information such as gender, birth date, birthplace, and nationality. Each field should carry a source and a confidence (a value between 0 and 1).
    • Description layer: information that may change over time, such as height and weight. Each value must record collected_at (collection timestamp) and should not be treated as a permanent fact.

    If the source only provides a year, store birth_year separately; do not fabricate 01-01 as a full date. A fabricated date would contaminate downstream age calculations and sorting.

    3.2 Derived Attributes Should Not Be Stored

    Constellation is derived from birth date; age is derived from birth date and current date. Both are derived attributes and should be computed at query time, not stored as facts.

    Storing derived attributes causes two problems. First, if the birth date is corrected, all derived values must be updated in sync; missing one update creates inconsistency. Second, derived values occupy fields without adding information.

    If caching derived values is truly necessary for query performance, explicitly mark the field or metadata as a cache and define an invalidation rule: the cache becomes invalid immediately when the birth date changes. The validation function later in this article also checks that cached values match the birth date.

    3.3 Schema Example

    The following is a simplified structure. All values are fictional placeholders and are not related to any real person.

    1. {
    2. "entity_id": "person_demo_0001",
    3. "primary_name": "Example Person A",
    4. "aliases": [
    5. {"name": "Example Alias A", "type": "stage_name"},
    6. {"name": "Example B", "type": "english_name"}
    7. ],
    8. "facts": {
    9. "gender": "unknown",
    10. "birth_date": "1990-01-01",
    11. "birth_place": {"region": "Example Region"},
    12. "nationality": "Example Country",
    13. "ethnicity": null
    14. },
    15. "profiles": {
    16. "height_cm": null,
    17. "weight_kg": null,
    18. "collected_at": "2025-01-01"
    19. },
    20. "occupations": ["Profession A", "Profession B"],
    21. "events": [
    22. {
    23. "event_id": "evt_demo_0001",
    24. "event_type": "personal_event",
    25. "event_time": "2025-01-10",
    26. "time_precision": "day",
    27. "description": "Example event: published a public statement (fictional)",
    28. "related_entities": [],
    29. "source": {"media_type": "social_post", "url_hash": "placeholder"}
    30. }
    31. ],
    32. "meta": {"version": 1, "updated_at": "2025-01-12"}
    33. }

    Key design points:

    • Fill birthplace according to the actual precision. If the source only indicates a region, do not add lower-level administrative divisions.
    • Use an array for occupations. Multiple identities are common; a single-value field would lose information.
    • Keep facts separate from profiles. Their update strategies differ. Corrections to fact-layer fields should keep version records, while description-layer updates only require retaining the collection timestamp.
    • The embedded events are for illustration only. In production, store events in a separate table; see Section 4 for reasons.

    4. Timeline Event Modeling: Making Dynamic Information Sortable and Traceable

    4.1 Event Structure and Controlled Vocabulary

    The dynamic aspects of a person profile are essentially timestamped events. The event structure must satisfy three requirements: event type must be countable, time precision must be explicit, and the source must be traceable.

    1. {
    2. "event_id": "evt_demo_0002",
    3. "entity_id": "person_demo_0001",
    4. "event_type": "work_release",
    5. "event_time": "2016-09",
    6. "time_precision": "month",
    7. "description": "Released a work (name to be filled)",
    8. "related_entities": ["org_demo_01"],
    9. "status": "active",
    10. "source": {"media_type": "news", "url_hash": "placeholder"}
    11. }

    event_type uses a controlled vocabulary, not free-form text. Only with consistent classification can downstream comparisons be made. The initial vocabulary is as follows:

    event_type Meaning Typical role of related_entities
    contract_sign Signing a contract Organization
    contract_terminate Contract termination Organization
    work_release Work release Collaborator, work
    show_participation Show participation Show
    personal_event Personal event None
    other Cannot be classified above Depends

    Extension rules for the vocabulary:

    • Type names use lowercase English with underscores, e.g., award_received.
    • The meaning of existing types must not be modified. If the meaning evolves, create a new type and mark the old one as deprecated.
    • Events that cannot be classified are initially recorded as other and enter a manual review queue; a monthly review decides whether to add a new type.

    time_precision takes the values day, month, or year. Source data may have different granularities: some have exact days, others only months or years. Precision must be explicitly recorded; otherwise sorting may incorrectly mix entries like “September of the same year” and “a specific date.”

    For sorting, use the start of the event’s time range. For events with the same start, define a fixed ordering by precision (e.g., coarser precision first). Define this rule once and apply it consistently across the system.

    4.2 Event Extraction from Text

    Raw source material is often a narrative paragraph. The following uses a fictional sentence to illustrate the extraction process.

    Input text: Example Person released an album in 2016 and participated in a variety show in September of the same year.

    Step 1: Sentence segmentation and time normalization. Split into two sentences: “Example Person released an album in 2016” and “participated in a variety show in September of the same year.” The first sentence’s time is 2016 with precision year. The “same year” in the second sentence is anchored to the previous sentence’s 2016, and “September” combines to give 2016-09 with precision month.

    If a relative time expression has no anchor (e.g., “the following year” appears at the beginning of a text), set the event’s status to pending_review; do not guess the year.

    Step 2: Event type classification. “Released an album” maps to work_release; “participated in a variety show” maps to show_participation. Classification can use rule dictionaries or models. Regardless of the method, output a confidence score. Sentences below the confidence threshold enter manual review.

    Step 3: Argument extraction. Extract participating entities such as work names, organization names, and show names. Third-party names should be mapped to internal IDs, e.g., org_demo_01, with the canonical name stored in the organization table. The original name is retained only in source-related records; display layers output according to authorization scope.

    If the original text does not provide a work name, leave it blank or write “name to be filled”; do not infer from context.

    Step 4: Conflict detection. If contradictory statements appear in the same time period (e.g., contract signing and termination time ranges overlap), mark them as pending_review for manual judgment.

    Final output is two events:

    1. [
    2. {"event_id": "evt_demo_0002", "event_type": "work_release",
    3. "event_time": "2016", "time_precision": "year",
    4. "description": "Released an album (name to be filled)", "related_entities": []},
    5. {"event_id": "evt_demo_0003", "event_type": "show_participation",
    6. "event_time": "2016-09", "time_precision": "month",
    7. "description": "Participated in a variety show", "related_entities": ["show_demo_01"]}
    8. ]

    Failure handling summary:

    • Relative time without anchor: pending_review.
    • Classification confidence below threshold: manual review.
    • Missing argument: leave related_entities empty; do not infer.
    • Third-party name cannot be mapped to an existing ID: create a new pending-review ID; do not auto-merge.

    4.3 Why Events Should Be Stored Separately

    In the example, events are embedded in the entity object for one-shot retrieval. In production, the number of events grows continuously and needs to be queried by type and time range independently. A separate event table with an index on entity_id lowers query cost and supports append-only writes more easily.

    5. Version Management and Update Strategy

    Person profiles evolve over time—renames, identity changes, and data corrections are common. Update strategies must distinguish between events and facts; the rules differ.

    5.1 Events Are Append-Only

    Event records are written in an append-only fashion. When an erroneous event is discovered, do not physically delete it; instead, mark the record as deprecated and record the reason.

    1. {
    2. "event_id": "evt_demo_0002",
    3. "status": "deprecated",
    4. "deprecated_reason": "Duplicate source; the same as evt_demo_0007",
    5. "deprecated_at": "2025-03-02T10:00:00+08:00"
    6. }

    This preserves a complete audit trail. The state at any point in time can be reconstructed.

    5.2 Fact Correction and Change Logs

    Static facts may be corrected, but every correction must generate a new version and write an entry to the change log. Old values remain in historical versions, allowing you to reconstruct a profile snapshot at any point in time.

    Example fields for the change log table:

    Field Meaning Example
    entity_id Entity ID person_demo_0001
    field Field path that changed profiles.weight_kg
    old_value Value before correction 50
    new_value Value after correction 52
    reason Reason for correction Source erratum
    operator Operator or task ID import_job_07
    ts Change timestamp with timezone 2025-03-02T10:00:00+08:00

    5.3 Rollback Boundaries

    Rollback applies only to fact-layer versions. To roll back, create a new version number pointing to historical content; do not delete intermediate versions.

    Published snapshots cannot be overwritten. If an error is discovered after publication, publish a corrected version and explain it in the change log.

    6. Consistency Validation: Blocking Errors at the Entry Point

    Validation rules should be built into the update pipeline. The following code is runnable and requires Python 3.7 or later.

    1. import calendar
    2. from datetime import date
    3. ZODIAC_BOUNDARIES = [
    4. ((1, 20), "Aquarius"), ((2, 19), "Pisces"), ((3, 21), "Aries"),
    5. ((4, 20), "Taurus"), ((5, 21), "Gemini"), ((6, 22), "Cancer"),
    6. ((7, 23), "Leo"), ((8, 23), "Virgo"), ((9, 23), "Libra"),
    7. ((10, 24), "Scorpio"), ((11, 23), "Sagittarius"), ((12, 22), "Capricorn"),
    8. ]
    9. PRECISION_PARTS = {"year": 1, "month": 2, "day": 3}
    10. def compute_constellation(birth: date) -> str:
    11. """Compute the Western zodiac from a birth date. Capricorn spans the year boundary, so it is the fallback."""
    12. md = (birth.month, birth.day)
    13. for start, name in reversed(ZODIAC_BOUNDARIES):
    14. if md >= start:
    15. return name
    16. return "Capricorn"
    17. def event_range(value: str, precision: str) -> tuple[date, date]:
    18. """Expand an event time into a start-end interval. Raises ValueError if the time string does not match the precision."""
    19. parts = [int(p) for p in value.split("-")]
    20. if len(parts) != PRECISION_PARTS[precision]:
    21. raise ValueError(f"Time {value} does not match precision {precision}")
    22. if precision == "year":
    23. return date(parts[0], 1, 1), date(parts[0], 12, 31)
    24. if precision == "month":
    25. y, m = parts
    26. return date(y, m, 1), date(y, m, calendar.monthrange(y, m)[1])
    27. d = date(*parts)
    28. return d, d
    29. def validate(entity: dict) -> list[str]:
    30. """Validate entity data. Returns a list of errors; does not modify the data."""
    31. errors = []
    32. facts = entity.get("facts") or {}
    33. raw_birth = facts.get("birth_date")
    34. if not raw_birth:
    35. return ["Missing birth date; cannot perform time-related validation"]
    36. try:
    37. birth = date.fromisoformat(raw_birth)
    38. except ValueError:
    39. return [f"Invalid birth date format: {raw_birth}"]
    40. # An empty or missing event list is treated as no events and does not trigger errors.
    41. for e in entity.get("events") or []:
    42. eid = e.get("event_id", "<unknown>")
    43. precision = e.get("time_precision")
    44. if precision not in PRECISION_PARTS:
    45. errors.append(f"Event {eid} has invalid time precision: {precision}")
    46. continue
    47. try:
    48. _, end = event_range(e["event_time"], precision)
    49. except (ValueError, KeyError) as exc:
    50. errors.append(f"Event {eid} time cannot be parsed: {exc}")
    51. continue
    52. # Only flag as contradictory if the entire interval is before the birth date.
    53. if end < birth:
    54. errors.append(f"Event {eid} has an entire time range earlier than the birth date; data contradiction")
    55. # Constellation is not stored; if a cached field exists, it must match the birth date.
    56. cached = (entity.get("profiles") or {}).get("constellation")
    57. if cached is not None and cached != compute_constellation(birth):
    58. errors.append("Cached constellation does not match the birth date; needs recalculation")
    59. return errors

    Validation rules explained:

    • Birth date must be a complete date. If the format is wrong or missing, return immediately; subsequent rules cannot be executed.
    • Events are checked by interval. For a year precision event, the interval ends on December 31 of that year. Only when the entire interval is earlier than the birth date do we flag a contradiction. This avoids false positives for events within the same year.
    • Precision and time string must match. 2016-09 with a day precision will raise an exception in event_range and be recorded as an error.
    • An empty event list does not produce errors. Missing fields and empty arrays are both treated as “no events”, avoiding false positives due to data format differences.
    • Constellation is only checked when cached. If no cache field exists, validation passes.

    These rules appear simple, but they can block a large amount of dirty data at the entry point, significantly reducing correction costs for downstream graph reasoning.

    7. Retrieval and Applications: The Value of Structured Data

    After completing structured modeling, person profiles can support the following applications:

    • Multi-condition combined retrieval: precise filtering and aggregation by birthplace, occupation, and time ranges.
    • Timeline display: events carry precision and type, enabling direct generation of a chronological timeline with type-based layered rendering.
    • Intelligent Q&A: for example, answering “Which works did this person release between 2015 and 2020?” by querying structured events rather than parsing free text.
    • Graph reasoning: events and related