{"id":48446558,"url":"https://github.com/biomathcode/clinical_table_search_sdk","last_synced_at":"2026-04-06T18:03:59.609Z","repository":{"id":345229028,"uuid":"1180893088","full_name":"biomathcode/clinical_table_search_sdk","owner":"biomathcode","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-18T06:00:51.000Z","size":118,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-18T22:07:30.194Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://clinical-table-search-sdk.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/biomathcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-13T14:23:17.000Z","updated_at":"2026-03-18T06:00:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/biomathcode/clinical_table_search_sdk","commit_stats":null,"previous_names":["biomathcode/clinical_table_search_sdk"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/biomathcode/clinical_table_search_sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biomathcode%2Fclinical_table_search_sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biomathcode%2Fclinical_table_search_sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biomathcode%2Fclinical_table_search_sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biomathcode%2Fclinical_table_search_sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biomathcode","download_url":"https://codeload.github.com/biomathcode/clinical_table_search_sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biomathcode%2Fclinical_table_search_sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31483385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T17:22:55.647Z","status":"ssl_error","status_checked_at":"2026-04-06T17:22:54.741Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-06T18:03:06.213Z","updated_at":"2026-04-06T18:03:59.605Z","avatar_url":"https://github.com/biomathcode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clinical Table Search SDK\n\nType-safe, dependency-minimal client for the NIH/NLM Clinical Table Search Service: https://clinicaltables.nlm.nih.gov/\n\n## Install\n\n```sh\nnpm i clinical-table-search-sdk\n```\n\n## Quick Start\n\n```ts\nimport { ClinicalTablesClient, datasets } from \"clinical-table-search-sdk\";\n\nconst client = ClinicalTablesClient.builder().build();\nconst hcpcs = client.dataset(datasets.hcpcs);\n\nconst res = await hcpcs.search({\n  terms: \"wheelchair\",\n  df: [\"code\", \"display\"],\n  ef: [{ field: \"long_desc\", as: \"long\" }],\n} as const);\n\nres.items[0]?.code;\nres.items[0]?.display; // string[]\nres.items[0]?.extra?.long; // unknown\n```\n\n## Type-Safe Dataset Params\n\n`df`, `sf`, `cf`, and `ef` are typed per dataset.\n\n```ts\nconst genes = client.dataset(datasets.genes);\n\nawait genes.search({\n  terms: \"BRCA\",\n  df: [\"symbol\", \"name_mod\"],\n  ef: [{ field: \"location\", as: \"loc\" }],\n} as const);\n```\n\n## Composable Debounce/Throttle\n\nThe SDK ships small async wrappers you can compose around any async function.\n\n```ts\nimport { debounce } from \"clinical-table-search-sdk\";\n\nconst searchHcpcs = debounce(\n  (terms: string) =\u003e hcpcs.search({ terms, df: [\"code\", \"display\"] } as const),\n  250,\n);\n\nconst res = await searchHcpcs(\"wheel\");\n```\n\n## Table-Friendly Rows\n\nClinicalTables returns `display` as an array of arrays (in the same order as your `df`).\nUse `displayToObjects` to build table rows keyed by your `df`.\n\n```ts\nimport { displayToObjects } from \"clinical-table-search-sdk\";\n\nconst r = await hcpcs.search({ terms: \"wheel\", df: [\"code\", \"display\"] } as const);\nconst rows = displayToObjects([\"code\", \"display\"] as const, r.display);\n```\n\n## Middleware (Composable)\n\nAdd request middleware (auth headers, logging, query defaults, etc).\n\n```ts\nconst client2 = ClinicalTablesClient.builder()\n  .use(({ url, init }) =\u003e {\n    init.headers = { ...(init.headers as Record\u003cstring, string\u003e), \"x-client\": \"demo\" };\n    url.searchParams.set(\"count\", \"20\");\n  })\n  .build();\n```\n\n## Browser + Node.js\n\n- In browsers: uses global `fetch`.\n- In Node.js: requires Node 18+ (global `fetch`), or provide your own `fetch` implementation via the client builder.\n\n```ts\nconst client3 = ClinicalTablesClient.builder()\n  .fetch(fetch) // pass your polyfill / custom fetch if needed\n  .build();\n```\n\n## Testing\n\n```sh\nnpm test              # unit tests + coverage (no network)\nnpm run test:integration  # hits the real clinicaltables.nlm.nih.gov API\n```\n\n## Custom Tables\n\nIf you want to call a table that isn’t included as a built-in dataset definition, define it:\n\n```ts\nimport { defineDataset } from \"clinical-table-search-sdk\";\n\nconst myTable = defineDataset({\n  id: \"my_table\",\n  version: \"v3\",\n  fields: [\"code\", \"name\"] as const,\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiomathcode%2Fclinical_table_search_sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiomathcode%2Fclinical_table_search_sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiomathcode%2Fclinical_table_search_sdk/lists"}