LinuxForHealth / connect-r-and-d

Linux For Health Connectors for Inbound Data Processing
Apache License 2.0
14 stars 19 forks source link

Generalize nlp routes to support different nlp engines #201

Closed srcarrier closed 3 years ago

srcarrier commented 3 years ago

We currently have an acd route and a separate route to feed the acd route based on unstructured data retrieved from applicable fhir resources. This should be generalized, such that the route that extracts unstructured data from fhir resources can feed an nlp service rather than a specific nlp services. This will give lfh users greater flexibility in supporting alternate nlp services, of which there are many.

srcarrier commented 3 years ago

From lfh team mtg > look at integrating through the Kong API layer. Have a metadata layer where you can overload the metadata based on the nlp engine being used and pass in the data payload. (we currently do not have a metadata layer). Would like to see a demo RE different AI engine based on Henry's data to predict the proper Dx. Show folks he we generalize across the different AI engines RE unstructured data. Possible use case: find adverse rx events w/in clinical notes.

srcarrier commented 3 years ago

Sample Requests

Google Healthcare NLP

curl -X POST \
   -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
   -H "Content-Type:application/json" \
   --data "{
    'nlpService':'projects/PROJECT_ID/locations/LOCATION/services/nlp',
    'documentContent':'Insulin regimen human 5 units IV administered.'
   }" \
   "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/services/nlp:analyzeEntities"

Amazon Comprehend Amazon appears to push users towards using their SDKs versus making straight-up http requests. Their apis use SigV4 signatures for authentication. It's technically possible, but according to a reply by an Amazon employee in the following thread, they don't consider comprehend to be a restful api > https://forums.aws.amazon.com/thread.jspa?messageID=882228

Health Gorilla HG offers NLP processing as a component of their broader FHIR APIs - i.e. it doesn't appear to let you send in stand-alone clinical text, rather there's a series of steps that's part of a broader workflow.

The workflow of our NLP API consists of four stages: • Add document to the patient’s chart. See “Health Gorilla FHIR RESTful API specification” for more details • Create Subscription to be notified about task completeness and receive results • Start NLP job for the given document • Receive results

Inputs While acd supports both text/json requests, google/aws engines seem to require json inputs. A generalized nlp route will need to support both.

Authentication Basic auth is pretty straightforward, but we may need to support bearer tokens and Sigv4 protocols for aws.