项目 / tuva-health/tuva-core

tuva-health/tuva-core

行业推荐
语言 Python标签 analytics-engineeringbigquerydata-analyticsdata-governancedata-lineagedata-pipelinesdata-warehousedbtdbt-packageshealthcarehealthcare-analysishealthcare-dataopen-sourceredshiftsnowflakesqlterminology数据更新 2026-11-20 06:49:16 · 仓库 2026-11-19

一段话介绍

Tuva Core 是一套 dbt 包,在云数仓内把理赔、临床及其他医疗数据转换成统一的、面向分析与 AI 的数据模型。当前仓库为 `tuva-health/tuva-core`,为保持包兼容,dbt 项目名仍是 `the_tuva_project`。`main` 分支声明的是 Tuva Core 1.0.0 契约,但分支上的版本并不等于正式发行;生产环境应使用 [GitHub Releases](https://github.com/tuva-health/tuva-core/releases) 中的不可变版本。需要 dbt 1.10.5 到 2.x,并支持 Snowflake、Databricks、BigQuery、Microsoft Fabric、Redshift 和 DuckDB。父项目在 `packages.yml` 中按带 `v` 前缀的发行标签安装后,执行 `dbt deps`,再按需打开理赔、临床等域,用 `dbt build --select package:the_tuva_project` 构建。入门与变量说明见[文档](https://www.thetuvaproject.com/getting-started)。许可为 Apache-2.0。本页按数据模型、转换与互操作用途介绍,不涉及诊疗效果。说明见[项目文档](https://www.thetuvaproject.com/)和[仓库 README](https://github.com/tuva-health/tuva-core)。

本站整理,非 GitHub 官方 description。

官方 description(GitHub API 原样)
Main repo including core data model, data marts, data quality tests, and terminology sets.
333累计星
143Fork
—峰值日增
0上榜次数
总榜
暂未入榜
日榜
暂未入榜
周榜
暂未入榜
月榜
暂未入榜

官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。

行业与场景

按行业选型 →

库存与供应链协同

适配系统:库存管理系统、供应链协同平台 · 得分 1.4

覆盖库存台账与出入库流程,可作为仓内作业与上下游协同的业务底座。

数据仓库建模与指标治理

适配系统:数据仓库、指标管理平台 · 得分 1.3

提供分层建模与指标定义能力,可支撑口径统一、血缘追踪与自助分析。

更多信息

以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。

我的用法
通过 packages.yml 安装:父项目用 git 方式填发布 tag 或 40 位 commit,也可用 dbt Hub 的 the_tuva_project,二者取一,再用 dbt deps 装依赖并按需启用各域变量。
特点或设计要点
Core 覆盖输入层契约、规范化层、理赔预处理、核心数据模型,以及可选开启的结构与逻辑数据质量检查,并提供与版本对齐的术语、值集、服务提供方数据和合成数据。1.0 把公共转换路径留在 Core,可选的数据集市与扩展以独立 dbt 包安装,例如 AHRQ 质量指标、CCSR、CMS 慢性病与 HCC、FHIR 预处理、纽约大学急诊分类、质量指标和语义层;父项目需显式安装 Core。公开字段中以 `_flag` 结尾的是可空二元整数,分类值使用 `_code` 或 `_status`。扩展列只在 14 张同名的输入层与 Core 表之间流动。SQL Server 部署需使用大小写敏感的排序规则,否则逻辑数据质量比较可能把无效值判为有效。
星标走势还差一天的数据,明天就能看到曲线
每天 10:30 记一次星标,连续两天后自动生成曲线
首次发现 — · 最近在榜 2026-11-11 · 语言 Python · 贡献者 —
python

GitHub 项目主页介绍

来自 GitHub 仓库 README / 主页介绍正文,原样摘录,共 10,544 字节。

# Tuva Core

[![Apache License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
![dbt 1.10.5 through 2.x](https://img.shields.io/static/v1?logo=dbt&label=dbt&message=1.10.5%20to%202.x&color=orange)

Tuva Core is the dbt package that transforms claims, clinical, and other
healthcare data into a common analytics- and AI-ready data model inside your
cloud data warehouse.

The repository is `tuva-health/tuva-core`, while the dbt project name remains
`the_tuva_project` for package compatibility. The `main` branch currently
declares the Tuva Core 1.0.0 contract, but a version on `main` is not a formal
release. Production projects should use an immutable version published in
[GitHub Releases](https://github.com/tuva-health/tuva-core/releases).

Tuva Core requires dbt 1.10.5 through 2.x and supports Snowflake, Databricks,
BigQuery, Microsoft Fabric, Redshift, and DuckDB. The 1.0 package ecosystem is
validated against both dbt Core 2.0 and dbt Fusion on DuckDB.

SQL Server deployments must use a case-sensitive database collation such as
`SQL_Latin1_General_CP1_CS_AS`. Logical Data Quality compares values against
exact lowercase literals, for example `sex in ('male', 'female', 'unknown')`.
Under the SQL Server default `SQL_Latin1_General_CP1_CI_AS`, `'MALE'` compares
equal to `'male'`, so those checks silently report an invalid value as valid
instead of failing. Set the collation when the database is created; changing it
afterwards requires rebuilding the affected objects.

## What Tuva Core Includes

| Area | Responsibility |
| --- | --- |
| Input Layer | Contracts that connector and parent projects map source data into |
| Normalized Layer | Portable type casting, reshaping, standardization, and terminology normalization |
| Claims Preprocessing | Service categories, encounters, member months, claims enrollment, and provider attribution |
| Core Data Model | Common claims, clinical, cost, utilization, and medication outputs |
| Data Quality | Opt-in Structural Data Quality and Logical Data Quality |
| Metadata and parity | Package metadata and an opt-in metric producer for release comparison |
| Data Assets | Version-aligned terminology, value sets, provider data, and synthetic data |

## Tuva 1.0 Package Ecosystem

Tuva 1.0 keeps the common transformation path in Core and distributes optional
marts and extensions as independently installable dbt packages. Installing a
standalone package enables that package; there is no umbrella package-enable
variable.

| Package | Scope |
| --- | --- |
| [AHRQ Quality Indicators](https://github.com/tuva-health/ahrq_quality_indicators) | AHRQ quality indicators and PQIs |
| [CCSR](https://github.com/tuva-health/ccsr) | Diagnosis and procedure CCSR groupers |
| [CMS Chronic Conditions](https://github.com/tuva-health/cms_chronic_conditions) | CMS-defined chronic conditions |
| [CMS HCC](https://github.com/tuva-health/cms_hcc) | CMS HCC scoring, recapture, and suspecting |
| [FHIR Preprocessing](https://github.com/tuva-health/fhir_preprocessing) | FHIR preprocessing extension |
| [NYU ED Classification](https://github.com/tuva-health/nyu_ed_classification) | Emergency-department classification |
| [Quality Measures](https://github.com/tuva-health/quality_measures) | Quality measures and retained readmissions scope |
| [Semantic Layer](https://github.com/tuva-health/semantic-layer) | Dimensions and facts over Core and selected packages |

Each package owns its models, tests, data assets, documentation,
compatibility, and release lifecycle.

## Install Tuva Core

Install a published GitHub release directly from the parent project's
`packages.yml`. Use its exact tag, including the `v` prefix:

```yaml
packages:
  - git: "https://github.com/tuva-health/tuva-core.git"
    revision: "<published-release-tag>"
```

For example, a published `v1.0.0` release uses `revision: "v1.0.0"`.
Git installation does not require the release to be indexed by dbt Hub.
An exact 40-character commit can also identify a reviewed development revision.
Avoid mutable branch names for production installations.

Once the version is available on dbt Hub, this alternative installs the same
package. Use one form per package, not both:

```yaml
packages:
  - package: tuva-health/the_tuva_project
    version: "<published-version>"
```

Add each optional Tuva package to the same root `packages.yml` using its own
repository URL and published tag. The parent project installs Core explicitly;
standalone packages do not install it for you. Semantic Layer also requires
the sibling packages listed in its installation instructions. Existing
dependencies such as `dbt-labs/dbt_utils` can continue to resolve through Hub.

Install dependencies with `dbt deps`. The parent project must expose the Tuva
Input Layer models and enable the domains it maps:

```yaml
flags:
  require_ref_searches_node_package_before_root: true

vars:
  claims_enabled: true
  clinical_enabled: false
  provider_attribution_enabled: false
  data_quality_enabled: false
  use_coderx_enterprise: false
```

Feature variables must be native, unquoted YAML booleans. Quoted values and
direct `env_var()` expressions are strings and are rejected. Environment-driven
workflows should generate typed YAML or JSON before invoking dbt.

CodeRx Open is the default medication terminology. Setting
`use_coderx_enterprise: true` switches every CodeRx consumer to user-managed
`packages`, `drugs`, and `classes` relations in the target database's `coderx`
schema.

Build the package with dbt's test-aware command:

```bash
dbt build --select package:the_tuva_project
```

See [Getting Started](https://www.thetuvaproject.com/getting-started) and the
[dbt Variables reference](https://www.thetuvaproject.com/dbt-variables) for
connector, Input Layer, warehouse, and configuration details.

## Important 1.0 Contracts

- Public fields ending in `_flag` are nullable binary integers: `1` means true,
  `0` means false, and null means unknown or not applicable. Categorical values
  use `_code` or `_status` instead.
- Core `location` and `practitioner` are source-native. Their public keys are
  `(location_id, data_source)` and `(practitioner_id, data_source)`.
- Extension columns flow only between the 14 same-named Input Layer and Core
  tables: appointment, condition, eligibility, encounter, immunization,
  lab_result, location, medical_claim, medication, observation, patient,
  pharmacy_claim, practitioner, and procedure. They do not flow into derived
  outputs such as cost, member month, person ID crosswalk, or utilization.
- Open eligibility spans keep a null end date rather than being capped at the
  current run date.

The complete breaking-change catalog and upgrade guidance live in the
[Tuva documentation](https://www.thetuvaproject.com/).

## Local Development and Testing

Use `integration_tests` as the local parent dbt project. It imports this
checkout, maps versioned synthetic data into the Input Layer, and exercises
Tuva Core without installing the standalone packages.

Configure a supported adapter in `~/.dbt/profiles.yml`, then run from the
repository root:

```bash
scripts/dbt-local deps
scripts/dbt-local build --full-refresh \
  --select package:integration_tests package:the_tuva_project
```

For local DuckDB development, use one thread while loading data assets. See
[integration_tests/README.md](integration_tests/README.md) for the full local
profile example, variables, and CI contract.

Tuva Core uses dbt-native tests:

- YAML unit tests live next to the models they protect.
- Generic data tests live in model YAML, and singular data tests live under
  `tests/`.
- Opt-in parity models under `models/parity` produce cross-version release
  metrics.

Use `dbt build` for normal validation because `dbt run` does not execute unit
or data tests.

## Data Assets

Tuva Core loads one explicitly selected data-asset version. Package code and
data-asset versions are intentionally independent. Core assets use this layout:

```text
tuva-core/<data-asset-version>/
├── _manifest.json
├── _release.json
├── terminology/
├── provider-data/
├── synthetic-data/
│   ├── small/
│   └── large/
└── value-sets/
```

The `tuva_core_data_asset_version` variable defaults to `1.0.0` and is used
directly in this path. A root project can override it when intentionally
testing a different complete snapshot. `custom_bucket_name` can point the same
loader contracts at another bucket.

Checked-in seed CSVs are header-only loader contracts; seed YAML retains the
relation names, schemas, column types, tests, and load hooks. Payload inventory,
source provenance, and candidate/released status live with the versioned cloud
snapshot instead of in the dbt package. dbt loads only the selected path and
does not read cloud manifest or release-status files.

A `candidate` snapshot may be edited while it is being prepared. A `released`
snapshot is read-only by default. The only exception is an explicit
break-glass instruction from Aaron that names the exact package and asset
version and gives a reason; maintenance must record that authorization, scope,
reason, and the resulting file changes.

S3 is the public source, and GCS and Azure mirror the same versioned paths.

Redshift loading uses `IAM_ROLE default`; configure the cluster or serverless
namespace with a default IAM role that can read the selected data-asset bucket.
Released gzip objects carry `Content-Encoding: gzip` for compatible
object-store loading.

Publication, mirroring, verification, synthetic-data generation, and
repository-maintenance tooling lives outside this dbt package. The Core-specific
`scripts/dbt-local` helper remains here because it runs this checkout through
the local integration project.

## Related Repositories

- [Documentation](https://www.thetuvaproject.com/)
- [DAG Viewer](https://github.com/tuva-health/dag-viewer)
- Tuva Maintenance (`tuva-health/tuva-maintenance`)

During local development, the docs site and DAG Viewer read this checkout
through `TUVA_CORE_PATH`.

## Contributing

- Report reproducible Core issues in
  [GitHub Issues](https://github.com/tuva-health/tuva-core/issues).
- Keep changes portable across every supported warehouse.
- Use the integration project and `dbt build` before opening a pull request.
- Coding agents must read [AGENTS.md](AGENTS.md) before changing the repository.

## License

Tuva Core is released under the [Apache 2.0 License](LICENSE).
↑