-- DBMS: snowflake
CREATE TABLE FINANCE__ECONOMICS.CYBERSYN.CYBERSYN_DATA_CATALOG (
    DATA_SOURCE ARRAY,
    LICENSE_URL ARRAY,
    LISTING_NAME ARRAY,
    CREATED_DATE DATE,
    TABLE_NAME_PROPER TEXT,
    LAST_UPDATED_TIMESTAMP TIMESTAMP_TZ,
    TABLE_TYPE TEXT,
    DESCRIPTION TEXT,
    SELECT_RELATED_TABLES ARRAY,
    DOCUMENTATION_URL TEXT,
    SHORT_DESCRIPTION TEXT,
    DATA_SOURCE_URL ARRAY,
    ENTITIES ARRAY,
    LISTING_URL ARRAY,
    TABLE_NAME TEXT
);

INSERT INTO "FINANCE__ECONOMICS"."CYBERSYN"."CYBERSYN_DATA_CATALOG" (DATA_SOURCE, LICENSE_URL, LISTING_NAME, CREATED_DATE, TABLE_NAME_PROPER, LAST_UPDATED_TIMESTAMP, TABLE_TYPE, DESCRIPTION, SELECT_RELATED_TABLES, DOCUMENTATION_URL, SHORT_DESCRIPTION, DATA_SOURCE_URL, ENTITIES, LISTING_URL, TABLE_NAME) VALUES ('[
  "Bureau of Labor Statistics (BLS)"
]', '[
  "https://www.bls.gov/bls/linksite.htm"
]', '[
  "Financials & Economics: Enterprise "
]', '2023-10-31', 'BLS Employment Timeseries Point in Time History', '2024-08-28 15:28:48.680000+00:00', 'point-in-time history', 'Tracks history of the bureau_of_labor_statistics_employment_timeseries table with start and end timestamps to indicate row validity periods. 

Current rows have a NULL end timestamp. Updated and deleted rows are time-stamped, including deletion time, in Eastern Time with UTC offset.', '[
  "bureau_of_labor_statistics_employment_timeseries"
]', NULL, NULL, '[
  "https://www.bls.gov/"
]', '[
  "geo_id"
]', '[
  "https://app.snowflake.com/marketplace/listing/GZTSZ290BUX66"
]', 'bureau_of_labor_statistics_employment_timeseries_history'), ('[
  "PermID",
  "US Securities & Exchange Commission (SEC)",
  "OpenFIGI"
]', '[
  "https://permid.org/terms",
  "https://creativecommons.org/licenses/by/4.0/",
  "https://www.sec.gov/privacy#security",
  "https://www.openfigi.com/docs/terms-of-service"
]', '[
  "Financials & Economics: Enterprise "
]', '2023-11-06', 'Company Characteristics Point in Time History', '2024-08-24 10:08:59.763000+00:00', 'point-in-time history', 'Tracks history of the company_characteristics table with start and end timestamps to indicate row validity periods. 

Current rows have a NULL end timestamp. Updated and deleted rows are time-stamped, including deletion time, in Eastern Time with UTC offset.', '[
  "company_characteristics"
]', NULL, NULL, '[
  "https://permid.org/",
  "https://www.sec.gov/edgar/search-and-access",
  "https://www.openfigi.com/about"
]', '[
  "company_id"
]', '[
  "https://app.snowflake.com/marketplace/listing/GZTSZ290BUX66"
]', 'company_characteristics_history'), ('[
  "PermID",
  "OpenFIGI",
  "US Securities & Exchange Commission (SEC)"
]', '[
  "https://permid.org/terms",
  "https://creativecommons.org/licenses/by/4.0/",
  "https://www.openfigi.com/docs/terms-of-service",
  "https://www.sec.gov/privacy#security"
]', '[
  "Financials & Economics: Enterprise "
]', '2023-11-06', 'Company Index Point in Time History', '2024-08-24 10:08:59.610000+00:00', 'point-in-time history', 'Tracks history of the company_index table with start and end timestamps to indicate row validity periods. 

Current rows have a NULL end timestamp. Updated and deleted rows are time-stamped, including deletion time, in Eastern Time with UTC offset.', '[
  "company_index"
]', NULL, NULL, '[
  "https://permid.org/",
  "https://www.openfigi.com/about",
  "https://www.sec.gov/edgar/search-and-access"
]', '[
  "company_id",
  "cik",
  "permid_company_id"
]', '[
  "https://app.snowflake.com/marketplace/listing/GZTSZ290BUX66"
]', 'company_index_history'), ('[
  "PermID",
  "OpenFIGI"
]', '[
  "https://permid.org/terms",
  "https://creativecommons.org/licenses/by/4.0/",
  "https://www.openfigi.com/docs/terms-of-service"
]', '[
  "Finance & Economics",
  "SEC Filings",
  "Financials & Economics: Enterprise "
]', '2023-09-17', 'Company Security Relationships', '2024-08-24 10:08:58.676000+00:00', 'relationships', 'Map between companies and the securities (stocks, bonds, etc.) they issue, including security identifiers from common open sources, including OpenFIGI and PermID. Maps to Cybersyn''s company index.

OpenFIGI and PermID both provide unique identifier systems for entities in the financial world, enhancing data standardization and integration. OpenFIGI (Open Financial Instrument Global Identifier) assigns codes primarily to financial instruments and related entities for improved transparency and efficiency in the global markets, while PermID (Permanent Identifier) by Refinitiv offers unique, machine-readable identifiers to a wide array of data elements including companies, securities, and financial instruments, facilitating consistent data management and interoperability across different systems and platforms in finance.

Provides a map between COMPANY_ID and associated SECURITY_IDs. Securities can have multiple ''levels'' associated with one company identifier, such as the PERMID_QUOTE_ID, PERMID_SECURITY_ID, OPENFIGI_SHARE_CLASS_ID, OPENFIGI_COMPOSITE_ID, and OPENFIGI_FIGI_ID.

The PermID Quote ID is an identifier from Refinitiv''s PermID system used specifically for quoting purposes. It''s linked to the data needed for pricing and quoting a security, such as current stock price, rather than the security''s intrinsic characteristics.

The PermID Security ID is an identifier from Refinitiv''s PermID system that uniquely identifies individual securities (like stocks or bonds) associated with a company. It focuses on the specific security rather than the broader entity.

The OpenFIGI Composite ID is an identifier from the Bloomberg OpenFIGI system that aggregates all securities (across different markets or exchanges) that are considered part of the same overall listing for a company, providing a composite view of that company''s security across markets.

The OpenFIGI Share Class ID is an identifier from the Bloomberg OpenFIGI system that distinguishes different classes of shares (such as Class A, Class B, etc.) issued by a company. Different share classes may have varying voting rights, dividend policies, or other characteristics.

The OpenFIGI FIGI ID is a unique identifier for any financial instrument itself, not limited to shares. It covers a wider range of securities, such as bonds, derivatives, and others.', '[
  "company_index",
  "company_characteristics",
  "company_relationships",
  "merchant_company_relationships",
  "openfigi_security_index",
  "permid_security_index",
  "sec_holding_filing_attributes"
]', 'https://docs.cybersyn.com/public-domain-sources/sec-filings-1', 'Map between companies and the securities (stocks, bonds, etc.) they issue, including security identifiers from common open sources, including OpenFIGI and PermID. Maps to Cybersyn''s company index.', '[
  "https://permid.org/",
  "https://www.openfigi.com/about"
]', '[
  "company_id",
  "security_id"
]', '[
  "https://app.snowflake.com/marketplace/listing/GZTSZAS2KF7",
  "https://app.snowflake.com/marketplace/listing/GZTSZAS2KH9",
  "https://app.snowflake.com/marketplace/listing/GZTSZ290BUX66"
]', 'company_security_relationships'), ('[
  "Bureau of Economic Analysis (BEA)",
  "Bureau of Labor Statistics (BLS)",
  "Census Bureau (CB)",
  "Consumer Financial Protection Bureau (CFPB)",
  "Department of Labor (DOL)",
  "Federal Reserve (FED)",
  "Freddie Mac",
  "New York Fed"
]', '[
  "https://www.bea.gov/about/policies-and-information",
  "https://www.bls.gov/bls/linksite.htm",
  "https://www.census.gov/data/developers/about/terms-of-service.html",
  "https://www.consumerfinance.gov/privacy/",
  "https://www.dol.gov/general/aboutdol/copyright",
  "https://www.federalreserve.gov/disclaimer.htm",
  "https://www.freddiemac.com/pmms/syndication/how_to",
  "https://www.newyorkfed.org/privacy/termsofuse"
]', '[
  "Finance & Economics",
  "Financials & Economics: Enterprise "
]', '2024-03-12', 'Cybersyn Financial & Economic Indicators Timeseries', '2024-08-30 21:16:58.032000+00:00', 'timeseries', 'Economic metrics including retail sales, consumer credit, mortgage rates, unemployment claims, GDP estimates, employment, and CPI data for various geographic entities, aggregated from various government sources.

The Cybersyn Financial & Economic Indicators tables include data aggregated from various government sources. It features various economic metrics, such as the Census Bureau''s retail sales, Federal Reserve''s commercial paper and consumer credit, New York Fed''s SOFR and EFFR data, Freddie Mac''s house price index and mortgage rates, the Department of Labor''s weekly unemployment claims, Bureau of Economic Analysis GDP estimates, Bureau of Labor Statistics employment and CPI data, and more.

Each row represents a distinct timeseries, date, and value by geographic entity. Each variable is detailed in the cybersyn_financial_economic_indicators_attributes table.', '[
  "cybersyn_financial_economic_indicators_attributes",
  "geography_index"
]', 'https://docs.cybersyn.com/public-domain-sources/financial-and-economic-indicators', 'Economic metrics including retail sales, consumer credit, mortgage rates, unemployment claims, GDP estimates, employment, and CPI data for various geographic entities, aggregated from various government sources.', '[
  "https://www.bea.gov/data/gdp",
  "https://www.bls.gov/",
  "https://www.census.gov/data/datasets.html",
  "https://www.consumerfinance.gov/",
  "https://oui.doleta.gov/unemploy/claims.asp",
  "https://www.federalreserve.gov/data.htm",
  "https://www.freddiemac.com/pmms/pmms_archives",
  "https://www.freddiemac.com/research/indices/house-price-index",
  "https://www.newyorkfed.org/microeconomics/databank.html"
]', '[
  "geo_id"
]', '[
  "https://app.snowflake.com/marketplace/listing/GZTSZAS2KF7",
  "https://app.snowflake.com/marketplace/listing/GZTSZ290BUX66"
]', 'cybersyn_financial_economic_indicators_timeseries');