Skip to content

Software Development Kit (SDK) to interact with the data.gov Medicaid API

License

Notifications You must be signed in to change notification settings

episphere/medicaid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

367 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MedicaidJS

MedicaidJS is a versatile Software Development Kit (SDK) designed to facilitate seamless interaction with the data.gov Medicaid API.

Installation

Node.js Environment

To integrate MedicaidJS into your Node.js project, use npm for installation: npm install medicaid or npm ci medicaid

Browser Environment

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>

CORS Proxy Support

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.

Configuring a CORS Proxy

import { setCorsProxy } from 'medicaid';

// Set a CORS proxy URL
setCorsProxy('https://corsproxy.io/?');

// Now all API requests will be routed through the proxy

Disabling the CORS Proxy

import { setCorsProxy } from 'medicaid';

// Clear the CORS proxy to make direct API calls
setCorsProxy('');

Checking Current CORS Proxy Configuration

import { getCorsProxy } from 'medicaid';

// Get the currently configured CORS proxy URL
const proxyUrl = getCorsProxy();
console.log(proxyUrl); // Returns empty string if no proxy is set

Example: Conditional CORS Proxy Setup

import { 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

Resources

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.

About

Software Development Kit (SDK) to interact with the data.gov Medicaid API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 74.5%
  • CSS 17.6%
  • HTML 7.9%