Explain Document Pipeline - CARP

Description

A pretrained pipeline with ner_clinical, assertion_dl, re_clinical and ner_posology. It will extract clinical and medication entities, assign assertion status and find relationships between clinical entities.

Open in Colab Copy S3 URI

How to use

carp_pipeline = PretrainedPipeline("explain_clinical_doc_carp","en","clinical/models")

annotations =  carp_pipeline.fullAnnotate("""A 28-year-old female with a history of gestational diabetes mellitus, used to take metformin 1000 mg two times a day, presented with a one-week history of polyuria , polydipsia , poor appetite , and vomiting. She was seen by the endocrinology service and discharged on 40 units of insulin glargine at night, 12 units of insulin lispro with meals.""")[0]

annotations.keys()


val carp_pipeline = new PretrainedPipeline("explain_clinical_doc_carp","en","clinical/models")

val result = carp_pipeline.fullAnnotate("""A 28-year-old female with a history of gestational diabetes mellitus, used to take metformin 1000 mg two times a day, presented with a one-week history of polyuria , polydipsia , poor appetite , and vomiting. She was seen by the endocrinology service and discharged on 40 units of insulin glargine at night, 12 units of insulin lispro with meals.""")(0)

import nlu
nlu.load("en.explain_doc.carp").predict("""A 28-year-old female with a history of gestational diabetes mellitus, used to take metformin 1000 mg two times a day, presented with a one-week history of polyuria , polydipsia , poor appetite , and vomiting. She was seen by the endocrinology service and discharged on 40 units of insulin glargine at night, 12 units of insulin lispro with meals.""")

Results

This pretrained pipeline gives the result of ner_clinical, re_clinical, ner_posology and assertion_dl models.

|   | chunks                        | ner_clinical | assertion | posology_chunk   | ner_posology | relations |
|---|-------------------------------|--------------|-----------|------------------|--------------|-----------|
| 0 | gestational diabetes mellitus | PROBLEM      | present   | metformin        | Drug         | TrAP      |
| 1 | metformin                     | TREATMENT    | present   | 1000 mg          | Strength     | TrCP      |
| 2 | polyuria                      | PROBLEM      | present   | two times a day  | Frequency    | TrCP      |
| 3 | polydipsia                    | PROBLEM      | present   | 40 units         | Dosage       | TrWP      |
| 4 | poor appetite                 | PROBLEM      | present   | insulin glargine | Drug         | TrCP      |
| 5 | vomiting                      | PROBLEM      | present   | at night         | Frequency    | TrAP      |
| 6 | insulin glargine              | TREATMENT    | present   | 12 units         | Dosage       | TrAP      |

Model Information

Model Name: explain_clinical_doc_carp
Type: pipeline
Compatibility: Spark NLP 2.5.5
License: Licensed
Edition: Official
Language: [en]

Included Models

  • ner_clinical
  • assertion_dl
  • re_clinical
  • ner_posology