jQuery plugins to facilitate working with the CMM API. Easily search for drugs, PA forms, and create PA requests.
This project is built using Grunt, which requires NodeJS.
Instructions assume a Unix-compatible terminal.
cd api-jquery-plugins
npm install
npm test
This command will concatenate all the source files into a distribution
directory:
npm start
To add to your project, copy the distribution
directory, and include
the necessary JavaScript and CSS files:
distribution/css/stylesheet.css
distribution/js/cover-my-meds-api-plugins.min.js
If your users are running < IE9, you'll need to include:
distribution/css/old-ie.css
distribution/vendor/html5shiv.min.js
The CoverMyMeds API requires an API ID. Contact us
to obtain them. For quick testing, open the index.html
file in a text editor,
insert your own API ID, and then load the file in a browser.
The basic workflow to create a new Prior Authorization request:
- Search for a drug using the
drugSearch
autocomplete plugin - Search for a form using the
formSearch
autocomplete plugin - Fill in some extra data about the patient (name, birthday, etc.), then submit
the request using the
createRequest
plugin
Create an HTML text input field, and attach the drug search widget:
<input type="text" id="drug_search">
<script>
$(function () {
var options = {
apiId: '<Your API ID>',
version: 1
};
$('#drug_search').drugSearch(options);
});
</script>
Options
options
is an object with the following keys:
apiId
(required) - Your API IDversion
(required) - Version of the CoverMyMeds API you want to accessurl
(optional) - The URL of an "API middleman" app (see "Usage" above)debug
(optional) - If the value is set totrue
, the plugin will use the CoverMyMeds test server instead of production.
Create an HTML text input field, and attach the form search widget:
<input type="text" id="form_search">
<script>
$(function () {
var options = {
apiId: '<Your API ID>',
version: 1,
drugId: 12345,
state: 'OH'
};
$('#form_search').formSearch(options);
});
</script>
Options
options
is an object with the following keys:
apiId
(required) - Your API IDversion
(required) - Version of the CoverMyMeds API you want to accessdrugId
(required) - The form search also requires the numeric ID of a drug in the CMM system. You can either pass it explicitly when initializing the widget, or else the widget will search for an <input> tag with a "name" attribute ofrequest[drug_id]
state
(required) - The form search requires a two-character state abbreviation. You can either pass it explicitly when initializing the widget, or else the widget will search for a <select> tag with a "name" attribute ofrequest[state]
url
(optional) - The URL of an "API middleman" app (see "Usage" above)debug
(optional) - If the value is set totrue
, the plugin will use the CoverMyMeds test server instead of production.
Create an HTML button, and attach the "create request" widget:
<button id="create_request">Click me!</button>
<script>
$(function () {
var options = {
apiId: '<Your API ID>',
version: 1,
data: {
request: { ... }
}
};
$('#create_request').createRequest(options);
});
</script>
Options
options
is an object with the following keys:
apiId
(required) - Your API IDversion
(required) - Version of the CoverMyMeds API you want to accessurl
(optional) - The URL of an "API middleman" app (see "Usage" above).debug
(optional) - If the value is set totrue
, the plugin will use the CoverMyMeds test server instead of production.data
(optional) - an object that contains all necessary data to create a PA request. The object should conform to the API documentation. Alternately, you can create form fields with name attributes that conform to the documentation, and the widget will automatically find and use those values.success
(optional) - a callback which is executed when the request is successfully created. In order to view the request again later, store theid
of one of the request's tokens and pass it to thedashboard
plugin.error
(optional) - a callback which is executed when there is an error creating the request. The callback method takes the following 3 arguments: the data returned from the server, a string describing the request status, and a jQueryjqXHR
object.
Given a list of CoverMyMeds request IDs, creates a basic "dashboard," which allows a user to view high-level request details, and click through to access the request on the CoverMyMeds site.
<div id="dashboard"></div>
<script>
$(function () {
var options = {
apiId: '<Your API ID>',
version: 1,
tokenIds: ['gq9vmqai2mkwewv1y55x', '33lhqakhtmas8r965w39', 's4c85zi3ku0b9re5sg1o']
};
$('#dashboard').dashboard(options);
});
</script>
Options
options
is an object with the following keys:
apiId
(required) - Your API IDversion
(required) - Version of the CoverMyMeds API you want to accesstokenIds
(required) - an array of tokenIds for requests that will be displayed by the dashboard.url
(optional) - The URL of an "API middleman" app (see "Usage" above).debug
(optional) - If the value is set totrue
, the plugin will use the CoverMyMeds test server instead of production.data
(optional) - a static object representing the returned results from the CoverMyMeds/requests/search
API (e.g.{ "requests": [{ id: 'AB1CD2', ...}, {...}] }
). Use this if you'd like to pre-fetch data and simply use this widget to display it.
Show some text to help users get in touch with CoverMyMeds.
<div id="help"></div>
<script>
$(function () {
$('#help').showHelp();
});
</script>