Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import searchProcedurePricing from './search-procedure-pricing/index.js';

export default [searchProcedurePricing];
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import defineAction from '../../../../helpers/define-action.js';

export default defineAction({
name: 'Search Procedure Pricing',
key: 'searchProcedurePricing',
description: 'search procedure pricing by given parent code.',
arguments: [
{
label: 'Code',
key: 'code',
type: 'string',
required: true,
variables: true,
description: 'The code to find cost values for.',
},
],

async run($) {
const code = $.step.parameters.code;
const { data } = await $.http.get(`/costs/${code}`);
$.setActionItem({ raw: data });
},
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions packages/backend/src/apps/procedure-price-lookup/auth/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import verifyCredentials from './verify-credentials.js';
import isStillVerified from './is-still-verified.js';

export default {
fields: [
{
key: 'screenName',
label: 'Screen Name',
type: 'string',
required: true,
readOnly: false,
value: null,
placeholder: null,
description:
'Screen name of your connection to be used on Automatisch UI.',
clickToCopy: false,
},
{
key: 'apiKey',
label: 'API Key',
type: 'string',
required: true,
readOnly: false,
value: null,
placeholder: null,
description: 'Procedure price lookup API key of your account.',
clickToCopy: false,
},
{
key: 'amaLicense',
label: 'Ama License',
type: 'string',
required: true,
readOnly: false,
value: null,
placeholder: null,
description: 'American Medical Association License',
clickToCopy: false,
},
],

verifyCredentials,
isStillVerified,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import verifyCredentials from './verify-credentials.js';

const isStillVerified = async ($) => {
await verifyCredentials($);
return true;
};

export default isStillVerified;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const verifyCredentials = async ($) => {
await $.http.get('/costs?limit=2');

await $.auth.set({
screenName: $.auth.data.screenName,
apiKey: $.auth.data.apiKey,
amaLicense: $.auth.data.amaLicense,
});
};

export default verifyCredentials;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const addAuthHeader = ($, requestConfig) => {
if ($.auth.data?.apiKey && $.auth.data?.amaLicense) {
requestConfig.headers['apikey'] = `${$.auth.data.apiKey}`;
requestConfig.headers['amalicense'] = `${$.auth.data.amaLicense}`;
}

return requestConfig;
};

export default addAuthHeader;
18 changes: 18 additions & 0 deletions packages/backend/src/apps/procedure-price-lookup/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import defineApp from '../../helpers/define-app.js';
import addAuthHeader from './common/add-auth-header.js';
import auth from './auth/index.js';
import actions from './actions/index.js';

export default defineApp({
name: 'Procedure Price Lookup',
key: 'procedure-price-lookup',
iconUrl: '{BASE_URL}/apps/procedure-price-lookup/assets/favicon.svg',
authDocUrl: '',
supportsConnections: true,
baseUrl: 'https://www.medicare.gov/api/procedure-price-lookup/mce/api/v1',
apiBaseUrl: 'https://www.medicare.gov/api/procedure-price-lookup/mce/api/v1',
primaryColor: '#6f42c1',
beforeRequest: [addAuthHeader],
auth,
actions,
});