Skip to content

Instantly share code, notes, and snippets.

@alfredayibonte
Created February 21, 2019 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfredayibonte/0528d862917721cc291c37872fc16fb1 to your computer and use it in GitHub Desktop.
Save alfredayibonte/0528d862917721cc291c37872fc16fb1 to your computer and use it in GitHub Desktop.
import ComprehendMedical from 'aws-sdk/clients/comprehendmedical';
import Config from 'react-native-config';
import { getDrugDetails } from './utils';
export function acm(text) {
return new Promise((resolve, reject) => {
let comprehendmedical = new ComprehendMedical({
region: Config.AWS_REGION,
apiVersions: Config.AWS_MEDICAL_API_VERSION,
credentials: {
accessKeyId: Config.AWS_ACCESS_KEY_ID,
secretAccessKey: Config.AWS_SECRET_ACCESS_KEY
}
});
comprehendmedical.detectEntities({ Text: text }, (err, data) => {
if (err) {
console.log(err, err.stack);
reject(err);
} else {
resolve(getDrugDetails(data));
}
});
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment