texas-gov/professional-medical-billing-services-sv1-detail-7au4-j7bg
Icon for Socrata external plugin

Query the Data Delivery Network

Query the DDN

The easiest way to query any data on Splitgraph is via the "Data Delivery Network" (DDN). The DDN is a single endpoint that speaks the PostgreSQL wire protocol. Any Splitgraph user can connect to it at data.splitgraph.com:5432 and query any version of over 40,000 datasets that are hosted or proxied by Splitgraph.

For example, you can query the professional_medical_billing_services_sv1_detail table in this repository, by referencing it like:

"texas-gov/professional-medical-billing-services-sv1-detail-7au4-j7bg:latest"."professional_medical_billing_services_sv1_detail"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "service_adjustment_units_4", -- DN# 734 - The number of units applicable to the fifth adjustment to the line item.
    "service_adjustment_amount_4", -- DN# 733 - The dollar amount of the fifth adjustment paid or credited to the line item.
    "service_adjustment_group_4", -- DN# 731 - A code indicating the general category of the fifth adjustment made to the dollar amount paid or credited to the line item.
    "service_adjustment_group_3", -- DN# 731 - A code indicating the general category of the fourth adjustment made to the dollar amount paid or credited to the line item.
    "service_adjustment_units", -- DN# 734 - The number of units applicable to the first adjustment to the line item.
    "service_adjustment_reason", -- DN# 732 - A code indicating the detailed reason of the first adjustment made to the dollar amount paid or credited to the line item.
    "rendering_line_provider", -- DN# 592 - The unique National Provider ID of the rendering line provider.
    "service_line_from_date", -- DN# 605 - The starting date that services were performed for the line item. 
    "crna_supervision_indicator", -- DN# 568 - Flags that a Certified Registered Nurse Anesthetist (CRNA) was supervised. Y = Yes, N = No
    "third_diagnosis_pointer", -- DN# 557 - References the diagnosis code (ICD-9 CM or ICD-10 CM) for which the medical services were rendered.
    "first_diagnosis_pointer", -- DN# 557 - References the diagnosis code (ICD-9 CM or ICD-10 CM) for which the medical services were rendered.
    "total_charge_per_line", -- DN# 552 - The service charge amount for the line item.
    "procedure_description", -- DN# 551 - Free form text describing the treatment rendered.
    "third_hcpcs_modifier_billed", -- DN# 717 - The third two-character code identifying special circumstances related to the procedure billed.
    "first_hcpcs_modifier_billed", -- DN# 717 - The first two-character code identifying special circumstances related to the procedure billed.
    "hcpcs_line_procedure_billed", -- DN# 714 - Identifies the treatment that was rendered and billed. HCPCS is the abbreviation for Health Care Financing Administration's Common Procedure Coding System. HCPCS codes include Level 1 CPT procedure codes.
    "line_number", -- The number of the line item on the bill.
    "bill_selection_date", -- Bill Selection Date is a date field common to bill and bill line item records. It is usually the earliest date of service on a bill.
    "service_adjustment_units_3", -- DN# 734 - The number of units applicable to the fourth adjustment to the line item.
    "service_adjustment_units_2", -- DN# 734 - The number of units applicable to the third adjustment to the line item.
    "service_adjustment_amount_2", -- DN# 733 - The dollar amount of the third adjustment paid or credited to the line item.
    "first_hcpcs_modifier_paid", -- DN# 727 - The first two-character code identifying special circumstances related to the procedure paid.
    "contract_line_type_code", -- DN# 741 - A two-character code indicating the line item contractual arrangement for provider reimbursement. 01 = Diagnosis Related Group 02 = Per Diem 03 = Variable Per Diem 04 = Flat 05 = Capitate 06 = Percent 09 = Other
    "service_line_to_date", -- DN# 605 - The ending date that services were performed for the line item. 
    "service_adjustment_amount_3", -- DN# 733 - The dollar amount of the fourth adjustment paid or credited to the line item.
    "service_adjustment_reason_3", -- DN# 732 - A code indicating the detailed reason of the fourth adjustment made to the dollar amount paid or credited to the line item.
    "service_adjustment_amount_1", -- DN# 733 - The dollar amount of the second adjustment paid or credited to the line item.
    "second_hcpcs_modifier_paid", -- DN# 727 - The second two-character code identifying special circumstances related to the procedure paid.
    "total_amount_paid_per_line", -- DN# 574 - The total dollar amount paid or credited to the line item.
    "second_hcpcs_modifier_billed", -- DN# 717 - The second two-character code identifying special circumstances related to the procedure billed.
    "service_adjustment_reason_2", -- DN# 732 - A code indicating the detailed reason of the third adjustment made to the dollar amount paid or credited to the line item.
    "service_adjustment_reason_1", -- DN# 732 - A code indicating the detailed reason of the second adjustment made to the dollar amount paid or credited to the line item.
    "service_adjustment_amount", -- DN# 733 - The dollar amount of the first adjustment paid or credited to the line item.
    "place_of_service_line_code", -- DN# 600 - Identifies the place where the medical service was rendered. Examples: 21 = Inpatient Hospital 56 = Psychiatric Residential Treatment Center 72 = Rural Health Clinic
    "bill_detail_id", -- Bill Detail ID uniquely identifies a bill line item.
    "bill_id", -- Bill ID uniquely identifies a bill and links line items to the bill.
    "service_adjustment_reason_4", -- DN# 732 - A code indicating the detailed reason of the fifth adjustment made to the dollar amount paid or credited to the line item.
    "service_adjustment_group_2", -- DN# 731 - A code indicating the general category of the third adjustment made to the dollar amount paid or credited to the line item.
    "service_adjustment_units_1", -- DN# 734 - The number of units applicable to the second adjustment to the line item.
    "number_of_service_adjustments", -- The number of service adjustments for the line item.
    "days_units_paid", -- DN# 580 - The number of services paid for the line item in days or units.
    "hcpcs_line_procedure_paid", -- DN# 726 - Identifies the treatment that was rendered and paid.
    "fourth_diagnosis_pointer", -- DN# 557 - References the diagnosis code (ICD-9 CM or ICD-10 CM) for which the medical services were rendered.
    "days_units_code", -- DN# 553 - Indicates the time or units billed or paid. DA = Days MJ = Minutes UN = Unit
    "fourth_hcpcs_modifier_billed", -- DN# 717 - The fourth two-character code identifying special circumstances related to the procedure billed.
    "service_adjustment_group_1", -- DN# 731 - A code indicating the general category of the second adjustment made to the dollar amount paid or credited to the line item.
    "service_adjustment_group", -- DN# 731 - A code indicating the general category of the first adjustment made to the dollar amount paid or credited to the line item. CO = Contractual Obligations OA = Other Adjustments PI = Payer initiated reductions PR = Patient Responsibility
    "second_diagnosis_pointer", -- DN# 557 - References the diagnosis code (ICD-9 CM or ICD-10 CM) for which the medical services were rendered.
    "provider_agreement_line_code", -- DN# 42 - Indicates the type of provider agreement applicable to the line item. H = Network N = No Agreement P = Participation Agreement Y = PPO Agreement
    "days_units_billed", -- DN# 554 - The number of services billed for the line item in days or units.
    "fourth_hcpcs_modifier_paid", -- DN# 727 - The fourth two-character code identifying special circumstances related to the procedure paid.
    "treatment_line_authorization", -- DN# 738 - Defaults to the Treatment Authorization Number (DN581 at the bill level) unless a data element is transmitted in this field. Y = reported, N = not reported.
    "third_hcpcs_modifier_paid" -- DN# 727 - The third two-character code identifying special circumstances related to the procedure paid.
FROM
    "texas-gov/professional-medical-billing-services-sv1-detail-7au4-j7bg:latest"."professional_medical_billing_services_sv1_detail"
LIMIT 100;

Connecting to the DDN is easy. All you need is an existing SQL client that can connect to Postgres. As long as you have a SQL client ready, you'll be able to query texas-gov/professional-medical-billing-services-sv1-detail-7au4-j7bg with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.texas.gov. When you querytexas-gov/professional-medical-billing-services-sv1-detail-7au4-j7bg:latest on the DDN, we "mount" the repository using the socrata mount handler. The mount handler proxies your SQL query to the upstream data source, translating it from SQL to the relevant language (in this case SoQL).

We also cache query responses on the DDN, but we run the DDN on multiple nodes so a CACHE_HIT is only guaranteed for subsequent queries that land on the same node.

Query Your Local Engine

Install Splitgraph Locally
bash -c "$(curl -sL https://github.com/splitgraph/splitgraph/releases/latest/download/install.sh)"
 

Read the installation docs.

Splitgraph Cloud is built around Splitgraph Core (GitHub), which includes a local Splitgraph Engine packaged as a Docker image. Splitgraph Cloud is basically a scaled-up version of that local Engine. When you query the Data Delivery Network or the REST API, we mount the relevant datasets in an Engine on our servers and execute your query on it.

It's possible to run this engine locally. You'll need a Mac, Windows or Linux system to install sgr, and a Docker installation to run the engine. You don't need to know how to actually use Docker; sgrcan manage the image, container and volume for you.

There are a few ways to ingest data into the local engine.

For external repositories (like this repository), the Splitgraph Engine can "mount" upstream data sources by using sgr mount. This feature is built around Postgres Foreign Data Wrappers (FDW). You can write custom "mount handlers" for any upstream data source. For an example, we blogged about making a custom mount handler for HackerNews stories.

For hosted datasets, where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Mounting Data

This repository is an external repository. It's not hosted by Splitgraph. It is hosted by data.texas.gov, and Splitgraph indexes it. This means it is not an actual Splitgraph image, so you cannot use sgr clone to get the data. Instead, you can use the socrata adapter with the sgr mount command. Then, if you want, you can import the data and turn it into a Splitgraph image that others can clone.

First, install Splitgraph if you haven't already.

Mount the table with sgr mount

sgr mount socrata \
  "texas-gov/professional-medical-billing-services-sv1-detail-7au4-j7bg" \
  --handler-options '{
    "domain": "data.texas.gov",
    "tables": {
        "professional_medical_billing_services_sv1_detail": "7au4-j7bg"
    }
}'

That's it! Now you can query the data in the mounted table like any other Postgres table.

Query the data with your existing tools

Once you've loaded the data into your local Splitgraph engine, you can query it with any of your existing tools. As far as they're concerned, texas-gov/professional-medical-billing-services-sv1-detail-7au4-j7bg is just another Postgres schema.