Using Google Cloud Natural Language API with Healthcare Content

471 Views Asked by At

I am trying to use the Node.js SDK for the Natural Language API (@google-cloud/language). I can successfully analyze the entities for a string as per the docs.

What I want to do is analyze the same string but using the Healthcare Natural Language API. This seems like it should just be a flag or extra parameter to the language client, but I cannot find any documentation at all about how to specify which topical language API to use.

Can this be done from within the SDK or does this require making raw requests to healthcare.googleapis.com?

2

There are 2 best solutions below

0
On

Because of the unique requirements of medical documents, the Healthcare NLP API exists separate from the general purpose NLP API.

You can analyze entities using the analyzeEntities API method

curl -X POST https://healthcare.googleapis.com/v1beta1/{nlpService=projects/*/locations/*/services/nlp}:analyzeEntities \
-d '{
  "documentContent": "<your doc here>"
}'

You can find the documentation here and a how to guide here.

0
On

The Cloud Healthcare API documentation reference does not mention any language API's, at least at the moment.

So you have to use REST/RPC or maybe you can raise FR. It's not quite clear how to do this for this product, but I am sure it should be done via "Sent Feedback" button on mentioned documentation page.

Anyway, for all Google products, language APIs (like mentioned Node.JS SDK) are just convenient libraries that use REST API under the hood.