Skip to content

Structured Context for HfLA created data sets #159

Open

Description

@ExperimentsInHonesty

Overview

We need to have minimum standards for structured context in data sets we create and or deploy in our projects so that we can help consumers understand the context from which they come.

Action Items

  • Identify existing resources for structured context, adding each example as a link in the resources section
    • Once done, remove the "TG: Gather Examples" label and add the "TG: Draft Template" label
  • Create a draft template, in all the formats the data will come in (json, csv, etc.) and upload to repo as a pr in the folder structured-context
    • Once done, remove the "TG: Draft Template" label and add the "TG: Create Guide" label
  • Discuss plan with data science team
  • Create a guide on how to use the template
    • Once done, remove the "TG: Create Guide" label and add the "TG: Review Guide" label
  • Review the guide with product management communities of practice
    • Once done, remove the "TG: Review Guide" label and add the "TG: Leadership Review" label
  • Present to Hack for LA leadership team for sign off
    • Once approved, remove the "TG: Leadership Review" label and add the "TG: Place Guide" label
  • Possibly create an issue template on .github
    • Include link to template under resources if you add it as a template in .github

Resources

Resources/Instructions

Datasheets for Data Sets
Definition of data context
Article on data in context
Adding context to data visualizations
Civic Data Library
Civic Software Foundation

Activity

  1. akhaleghi commented on Oct 7, 2021

    @akhaleghi
  2. ExperimentsInHonesty commented on Dec 6, 2021

    @ExperimentsInHonesty
    Author
  3. ExperimentsInHonesty commented on Dec 20, 2021

    @ExperimentsInHonesty
    MemberAuthor

    added this issue to the agenda for DS pm meeting hackforla/data-science#65 (comment) - revisit on 2022-01-03

  4. ExperimentsInHonesty commented on Jan 5, 2022

    @ExperimentsInHonesty
    MemberAuthor

    We didn't meet, we will pick this up at this week's meeting 2022-01-07

  5. moved this to Properly Labeled and not yet ready for Guides Team Review in P: Guides: Tracker of guide issues (in knowlegebase-content repo)on May 31, 2024
  6. ExperimentsInHonesty commented on Aug 18, 2025

    @ExperimentsInHonesty
    Author
  7. ExperimentsInHonesty commented on Aug 18, 2025

    @ExperimentsInHonesty
    MemberAuthor

    Implementation Techniques for Structured Context in Knowledge Management and DataOps

    Little‑known but important insight
    If you don’t structure context at ingestion, you’ll pay it back with interest during audits, reanalysis, and stakeholder disputes. Most “data quality” fires are actually context failures (ambiguous definitions, missing lineage, drifting semantics).

    1. Schema Design (Context by Contract)

    • What it is: Every dataset has an agreed‑upon schema — not just columns, but definitions.
    • How to do it:
      • Define required fields (timestamp, entity IDs, source system).
      • Add contextual fields (business process, project or product version, validation status, intended audience).
      • Enforce via JSON/YAML schemas, DB constraints, or Sheets data validation.
    • Example: Instead of "Hours = 12", the schema requires:
      hours_logged: 12
      context:
        activity_type: onboarding
        person_id: 5678
        department: product
        system_version: v3.2
        validated_by: system_check

    2. Context‑as‑Code (Automate, don’t rely on memory)

    • What it is: Bake context into pipelines, not just documentation.
    • How to do it:
      • ETL/ELT jobs auto‑stamp source, load timestamp, pipeline version, and environment.
      • Enforce naming conventions such as product__metric__yyyy-mm-dd__source.csv.
      • Add lineage tags at each transform step.
    • Example:
      file_id, filename, deleted_by, deleted_at_utc, container_id, pipeline_version, reason_if_known
      

    3. Front Matter Standards (Reusable context blocks)

    • What it is: Treat every doc/report as an object with standard metadata.
    • How to do it:
      • Use YAML front matter at the top of design docs, runbooks, dashboards, and analyses.
      • Fields commonly include phase, audience, metric_definitions, data_sources, approvers.
      • Reference external dictionaries for roles, systems, and tech stacks.

    4. Taxonomies and Controlled Vocabularies

    • What it is: Replace free‑text with curated terms to kill ambiguity.
    • How to do it:
      • Maintain a master dictionary (roles, teams, products, regions, lifecycle phases).
      • Prefer codes/IDs plus human labels.
      • Validate tags at entry; reject unknown labels.
    • Example: role_id=PO vs. free‑text "prod owner", "PM", "product mgr".

    5. Metadata Pipelines (Enrich at ingestion)

    • What it is: Attach interpretive context when data enters the system.
    • How to do it:
      • Stamp rows with business calendar period, timezone, and unit semantics.
      • Store transform history (job name, commit/hash, run ID).
      • Keep source snapshots for reproducibility.
    • Example: In a people data platform, a contribution record is email + role + cost_center + product_area + activity_type + source_system_version.

    6. Dashboards with Structured Context (Numbers plus their story)

    • What it is: Dashboards surface assumptions, not just charts.
    • How to do it:
      • Display metric definitions inline and link to canonical specs.
      • Use filters tied to taxonomy (region_id, product_tier) not ad‑hoc text.
      • Show freshness/SLA and data caveats at view time.
    • Example: Active users = users with at least 1 key action in the last 30 days; excludes internal test accounts; timezone = UTC; last refreshed = 2025‑08‑18 14:05 UTC.

    Key Principles for Durable Data Across Teams and Time

    1. Future‑proofing
      Anyone six months from now should understand a number without tribal knowledge.

    2. Interpretability
      Definitions, units, and timeframes must be explicit and versioned.

    3. Auditability and lineage
      Every figure is traceable from report back to raw source and transformation steps.

    4. Reanalysis and reproducibility
      You can rerun the analysis and get the same result (or explain why not).

    5. Portability and interoperability
      Context travels with the data across tools, teams, and vendors.

    6. Governance and access
      Context includes who can use the data, for what purpose, and under which privacy/compliance rules.


    Common Pitfalls (and how to avoid them)

    • Semantic drift
      The meaning of a metric changes silently over time. Prevent with versioned metric specs and deprecation notes.

    • Lossy transforms
      Pipelines drop fields required for later analysis. Prevent with minimum context fields and schema tests.

    • Timezone and window ambiguity
      Dates look aligned but aren’t. Stamp everything with timezone and business calendar.

    • Vocabulary sprawl
      Too many near‑duplicate tags. Lock labels to a dictionary and run periodic concordance jobs.

    • Orphaned “single‑source‑of‑truth”
      Multiple dashboards claim to be canonical. Register authoritative datasets and enforce discoverability via a catalog.


    Minimum Definition of Done for Data Products

    • Metric definition is checked into version control and linked in the dashboard.
    • Dataset includes required context fields (source, load_ts_utc, unit, tz, version).
    • Lineage is queryable end‑to‑end (catalog, dbt docs, or equivalent).
    • Freshness/SLA monitors and alerts exist and are visible to consumers.
    • Access controls and allowed‑use statements are documented.
  8. ExperimentsInHonesty commented on Aug 18, 2025

    @ExperimentsInHonesty
    MemberAuthor

    Project Data Checklist

    Use this checklist to ensure that data in your project is reliable, reusable, and future-proof.

    1. Data Definition

    • Clear definition of every metric and field (units, timeframe, calculation method).
    • Schema documented (required fields, allowed values, data types).
    • Version of metric definitions stored in version control.

    2. Metadata and Context

    • Each dataset includes metadata: source system, load date, pipeline/job version, timezone.
    • Business context captured (project, audience, phase, purpose).
    • Controlled vocabularies or taxonomies enforced for tags and roles.

    3. Data Lineage and Provenance

    • Raw source documented and accessible.
    • Transformations logged (commit ID, run ID, pipeline version).
    • Ability to trace any number in a report back to raw data.

    4. Governance and Compliance

    • Access roles defined (who can view, edit, approve).
    • Privacy and compliance rules applied (PII handling, GDPR/CCPA if relevant).
    • Allowed use statement documented (what the data can/cannot be used for).

    5. Quality and Reliability

    • Automated checks in place (schema validation, null checks, duplicates).
    • Freshness and SLA monitoring (last updated timestamp visible to consumers).
    • Alerts set up for broken pipelines or data drift.

    6. Documentation and Discoverability

    • Datasets and dashboards listed in a catalog or index.
    • Definitions linked directly from dashboards or reports.
    • Docs explain assumptions and known limitations.

    7. Reproducibility

    • Scripts or queries to regenerate results stored in version control.
    • Historical snapshots or partitions preserved for auditing.
    • Analyses reproducible by another contributor without hidden steps.

    8. Portability and Interoperability

    • Context and metadata travel with the data when exported/shared.
    • Formats standardized (CSV, JSON, Parquet, etc. with consistent schemas).
    • APIs or exports documented for integration.

    9. Lifecycle and Stewardship

    • Owner(s) identified for each dataset or dashboard.
    • Review process for retiring or deprecating data sources.
    • Plan for long-term sustainability if contributors turn over.

    Guiding Question

    Could someone new to the project, six months from now, look at this dataset or dashboard and:

    1. Understand what it means?
    2. Reproduce how it was generated?
    3. Trust it enough to make a decision with it?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions