diff --git a/COMPONENTS_INVENTORY.md b/COMPONENTS_INVENTORY.md index 029910a5..9dc05c14 100644 --- a/COMPONENTS_INVENTORY.md +++ b/COMPONENTS_INVENTORY.md @@ -11,7 +11,7 @@ This document provides a comprehensive inventory of all components, services, te | Component | [ApiRowLimitNotice](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/ApiRowLimitNotice) | ✅ Public | ✅ Has Story | ❌ No Tests | | Component | [Breadcrumb](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/Breadcrumb) | ✅ Public | ✅ Has Story | ❌ No Tests | | Component | [CMSTopNav](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/CMSTopNav) | ✅ Public | ✅ Has Story | ❌ No Tests | -| Component | [DataDictionaryTable](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DataDictionaryTable) | ❌ Internal | ✅ Has Story | ❌ No Tests | +| Component | [DataDictionary](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DataDictionary) | ❌ Internal | ❌ No Story | ❌ No Tests | | Component | [DataTableControls](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DataTableControls) | ❌ Internal | ❌ No Story | ✅ Has Tests | | Component | [DataTableDensity](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DataTableDensity) | ❌ Internal | ✅ Has Story | ✅ Has Tests | | Component | [DataTablePageResults](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DataTablePageResults) | ✅ Public | ✅ Has Story | ❌ No Tests | @@ -23,7 +23,6 @@ This document provides a comprehensive inventory of all components, services, te | Component | [DatasetDate](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DatasetDate) | ✅ Public | ❌ No Story | ✅ Has Tests | | Component | [DatasetDateItem](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DatasetDateItem) | ✅ Public | ❌ No Story | ✅ Has Tests | | Component | [DatasetDescription](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DatasetDescription) | ❌ Internal | ✅ Has Story | ✅ Has Tests | -| Component | [DatasetDictionaryTable](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DatasetDictionaryTable) | ❌ Internal | ✅ Has Story | ❌ No Tests | | Component | [DatasetListItem](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DatasetListItem) | ✅ Public | ❌ No Story | ✅ Has Tests | | Component | [DatasetListSubmenu](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DatasetListSubmenu) | ✅ Public | ❌ No Story | ❌ No Tests | | Component | [DatasetListSubmenuItem](https://github.com/GetDKAN/cmsds-open-data-components/tree/main/src/components/DatasetListSubmenuItem) | ❌ Internal | ✅ Has Story | ✅ Has Tests | @@ -121,19 +120,19 @@ This document provides a comprehensive inventory of all components, services, te | Category | Total | With Stories | With Tests | With Both | With Neither | |----------|-------|--------------|------------|-----------|--------------| -| Components | 64 | 37 (58%) | 23 (36%) | 10 (16%) | 14 (22%) | +| Components | 63 | 35 (56%) | 23 (37%) | 10 (16%) | 15 (24%) | | Templates | 11 | 7 (64%) | 3 (27%) | 1 (9%) | 2 (18%) | | Services/Hooks/Contexts | 9 | 0 (0%) | 0 (0%) | 0 (0%) | 9 (100%) | | Utilities/Types/Assets | 10 | 0 (0%) | 0 (0%) | 0 (0%) | 10 (100%) | -| **Project Total** | **94** | **44 (47%)** | **26 (28%)** | **11 (12%)** | **35 (37%)** | +| **Project Total** | **93** | **42 (45%)** | **26 (28%)** | **11 (12%)** | **36 (39%)** | --- ### Export Summary - **Public**: 57 items (33 components, 11 templates, 3 services, 2 hooks, 4 contexts, 2 asset) -- **Internal**: 37 items (31 components, 0 templates, 0 services, 3 utilities, 3 types, 0 asset) +- **Internal**: 36 items (30 components, 0 templates, 0 services, 3 utilities, 3 types, 0 asset) --- -*Last updated: December 12, 2025* +*Last updated: December 23, 2025* *Repository: [GetDKAN/cmsds-open-data-components](https://github.com/GetDKAN/cmsds-open-data-components)* diff --git a/src/components/DataDictionaryTable/DataDictionaryTable.stories.tsx b/src/components/DataDictionary/DataDictionaryTable/DataDictionaryTable.stories.tsx similarity index 100% rename from src/components/DataDictionaryTable/DataDictionaryTable.stories.tsx rename to src/components/DataDictionary/DataDictionaryTable/DataDictionaryTable.stories.tsx diff --git a/src/components/DataDictionaryTable/dataDictionaryTable.scss b/src/components/DataDictionary/DataDictionaryTable/dataDictionaryTable.scss similarity index 100% rename from src/components/DataDictionaryTable/dataDictionaryTable.scss rename to src/components/DataDictionary/DataDictionaryTable/dataDictionaryTable.scss diff --git a/src/components/DataDictionaryTable/index.tsx b/src/components/DataDictionary/DataDictionaryTable/index.tsx similarity index 98% rename from src/components/DataDictionaryTable/index.tsx rename to src/components/DataDictionary/DataDictionaryTable/index.tsx index 8af5f41a..1bdc37cc 100644 --- a/src/components/DataDictionaryTable/index.tsx +++ b/src/components/DataDictionary/DataDictionaryTable/index.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { useReactTable, flexRender, getCoreRowModel, getPaginationRowModel, getSortedRowModel, SortingState, getFilteredRowModel, ColumnFiltersState } from '@tanstack/react-table'; import { useMediaQuery } from 'react-responsive'; import { Table, TableHead, TableRow, TableCell, TableBody, Pagination, Dropdown, DropdownChangeObject, Alert } from '@cmsgov/design-system'; -import HeaderResizeElement from '../Datatable/HeaderResizeElement'; +import HeaderResizeElement from '../../Datatable/HeaderResizeElement'; import './dataDictionaryTable.scss'; const DataDictionaryTable = ({tableColumns, tableData, pageSize, columnFilters} : diff --git a/src/components/DatasetDictionaryTable/DatasetDictionaryTable.stories.tsx b/src/components/DataDictionary/DatasetDictionaryJSON/DatasetDictionaryJSON.stories.tsx similarity index 100% rename from src/components/DatasetDictionaryTable/DatasetDictionaryTable.stories.tsx rename to src/components/DataDictionary/DatasetDictionaryJSON/DatasetDictionaryJSON.stories.tsx diff --git a/src/components/DatasetDictionaryTable/dataDictionary.scss b/src/components/DataDictionary/DatasetDictionaryJSON/dataDictionaryJSON.scss similarity index 100% rename from src/components/DatasetDictionaryTable/dataDictionary.scss rename to src/components/DataDictionary/DatasetDictionaryJSON/dataDictionaryJSON.scss diff --git a/src/components/DatasetDictionaryTable/index.tsx b/src/components/DataDictionary/DatasetDictionaryJSON/index.tsx similarity index 61% rename from src/components/DatasetDictionaryTable/index.tsx rename to src/components/DataDictionary/DatasetDictionaryJSON/index.tsx index c2c38795..58ed8809 100644 --- a/src/components/DatasetDictionaryTable/index.tsx +++ b/src/components/DataDictionary/DatasetDictionaryJSON/index.tsx @@ -1,13 +1,17 @@ -import React, { useState, useMemo } from 'react'; +import React, { useState, useMemo, useContext } from 'react'; +import { useQuery } from '@tanstack/react-query'; +import qs from 'qs'; +import axios from 'axios'; import { createColumnHelper } from '@tanstack/react-table'; -import { TextField, Dropdown, AccordionItem, Button, DropdownChangeObject } from '@cmsgov/design-system'; -import { DatasetDictionaryItemType } from '../../types/dataset'; +import { TextField, Dropdown, AccordionItem, Button, DropdownChangeObject, Tooltip, TooltipIcon } from '@cmsgov/design-system'; +import { DatasetDictionaryItemType } from '../../../types/dataset'; import DataDictionaryTable from '../DataDictionaryTable'; -import { Tooltip, TooltipIcon } from '@cmsgov/design-system'; -import "./dataDictionary.scss" -import ClearFiltersButton from '../QueryBuilder/ClearFiltersButton'; +import "./dataDictionaryJSON.scss" +import ClearFiltersButton from '../../QueryBuilder/ClearFiltersButton'; +import { acaToParams } from '../../../utilities/aca'; +import { ACAContext } from '../../../utilities/ACAContext'; -const DatasetDictionaryTable = ({ datasetDictionary, pageSize} : {datasetDictionary: DatasetDictionaryItemType[], pageSize: number}) => { +const DatasetDictionaryTable = ({ datasetDictionaryEndpoint, pageSize, showDownloadButton} : {datasetDictionaryEndpoint: string, pageSize: number, showDownloadButton: boolean}) => { const [titleFilter, setTitleFilter ] = useState(""); const [typeFilter, setTypeFilter ] = useState("all"); const columnFilters = useMemo(() => [ @@ -15,7 +19,22 @@ const DatasetDictionaryTable = ({ datasetDictionary, pageSize} : {datasetDiction {id: "type", value: typeFilter === "all" ? "" : typeFilter} ], [titleFilter, typeFilter]) - const tableData = datasetDictionary.map((item) => { + const {ACA} = useContext(ACAContext); + + const {data} = useQuery({ + queryKey: ["dictionary" + datasetDictionaryEndpoint], + queryFn: () => { + return axios.get(`${datasetDictionaryEndpoint}?${qs.stringify(acaToParams({}, ACA))}`) + .then((res) => res.data) + .catch((error) => console.error(error)) + }, + enabled: datasetDictionaryEndpoint !== undefined + }); + + const datasetDictionary = data && data.data && data.data.fields && data.data.fields.length ? data.data.fields : null; + if(!datasetDictionary) return <>>; + + const tableData = datasetDictionary.map((item : {title: string, description: string, type: string}) => { return { titleResizable: item.title, description: item.description, @@ -66,6 +85,23 @@ const DatasetDictionaryTable = ({ datasetDictionary, pageSize} : {datasetDiction return ( <> +
The data dictionary file can not be displayed at this time.
+ ) : ( +