Created
February 21, 2019 07:36
-
-
Save alfredayibonte/0528d862917721cc291c37872fc16fb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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