MedicaidJS is a versatile Software Development Kit (SDK) designed to facilitate seamless interaction with the data.gov Medicaid API.
To integrate MedicaidJS into your Node.js project, use npm for installation:
npm install medicaid or npm ci medicaid
For web-based projects, you can directly import MedicaidJS using ES6 module syntax:
const MedicaidSDK = await import('https://kunaalagarwal.github.io/medicaid/sdk.js');
Script tag loading: <script type='module' src='https://kunaalagarwal.github.io/medicaid/sdk.js'></script>
When using MedicaidJS in a browser environment, you may encounter Cross-Origin Resource Sharing (CORS) restrictions. To handle this, the SDK provides optional CORS proxy support.
import { setCorsProxy } from 'medicaid';
// Set a CORS proxy URL
setCorsProxy('https://corsproxy.io/?');
// Now all API requests will be routed through the proxyimport { setCorsProxy } from 'medicaid';
// Clear the CORS proxy to make direct API calls
setCorsProxy('');import { getCorsProxy } from 'medicaid';
// Get the currently configured CORS proxy URL
const proxyUrl = getCorsProxy();
console.log(proxyUrl); // Returns empty string if no proxy is setimport { setCorsProxy, getSchemas } from 'medicaid';
// Configure CORS proxy only in browser environments
if (typeof window !== 'undefined') {
setCorsProxy('https://corsproxy.io/?');
}
// Make API calls as usual
const schemas = await getSchemas();Note: Popular CORS proxy services include:
https://corsproxy.io/?https://api.allorigins.win/raw?url=- Or deploy your own CORS proxy server
Visit the landing page to explore the capabilities and the MedicaidJS ecosystem
Refer to the published research article for more information about MedicaidJS.
Comprehensive tutorial describing the best practices surrounding usage of MedicaidJS.
Note that the "Official" version of the repository lives within the Episphere Github Repository. Check out this repository for production-ready features.