Extract Cancer Therapies and Granular Posology Information

Description

This model extracts cancer therapies (Cancer_Surgery, Radiotherapy and Cancer_Therapy) and posology information at a granular level.

Definitions of Predicted Entities:

  • Cancer_Surgery: Terms that indicate surgery as a form of cancer treatment.
  • Cancer_Therapy: Any cancer treatment mentioned in text, excluding surgeries and radiotherapy.
  • Cycle_Count: The total number of cycles being administered of an oncological therapy (e.g. “5 cycles”).
  • Cycle_Day: References to the day of the cycle of oncological therapy (e.g. “day 5”).
  • Cycle_Number: The number of the cycle of an oncological therapy that is being applied (e.g. “third cycle”).
  • Dosage: The quantity prescribed by the physician for an active ingredient.
  • Duration: Words indicating the duration of a treatment (e.g. “for 2 weeks”).
  • Frequency: Words indicating the frequency of treatment administration (e.g. “daily” or “bid”).
  • Radiotherapy: Terms that indicate the use of Radiotherapy.
  • Radiation_Dose: Dose used in radiotherapy.
  • Route: Words indicating the type of administration route (such as “PO” or “transdermal”).

Predicted Entities

Cancer_Surgery, Cancer_Therapy, Cycle_Count, Cycle_Day, Cycle_Number, Dosage, Duration, Frequency, Radiotherapy, Radiation_Dose, Route

Live Demo Open in Colab Copy S3 URI

How to use

document_assembler = DocumentAssembler()\
    .setInputCol("text")\
    .setOutputCol("document")

sentence_detector = SentenceDetectorDLModel.pretrained("sentence_detector_dl_healthcare","en","clinical/models")\
    .setInputCols(["document"])\
    .setOutputCol("sentence")

tokenizer = Tokenizer() \
    .setInputCols(["sentence"]) \
    .setOutputCol("token")

word_embeddings = WordEmbeddingsModel().pretrained("embeddings_clinical", "en", "clinical/models")\
    .setInputCols(["sentence", "token"]) \
    .setOutputCol("embeddings")                

ner = MedicalNerModel.pretrained("ner_oncology_posology", "en", "clinical/models") \
    .setInputCols(["sentence", "token", "embeddings"]) \
    .setOutputCol("ner")

ner_converter = NerConverter() \
    .setInputCols(["sentence", "token", "ner"]) \
    .setOutputCol("ner_chunk")

pipeline = Pipeline(stages=[document_assembler,
                            sentence_detector,
                            tokenizer,
                            word_embeddings,
                            ner,
                            ner_converter])

data = spark.createDataFrame([["The patient underwent a regimen consisting of adriamycin (60 mg/m2) and cyclophosphamide (600 mg/m2) over six courses. She is currently receiving his second cycle of chemotherapy and is in good overall condition."]]).toDF("text")

result = pipeline.fit(data).transform(data)
val document_assembler = new DocumentAssembler()
    .setInputCol("text")
    .setOutputCol("document")
    
val sentence_detector = SentenceDetectorDLModel.pretrained("sentence_detector_dl_healthcare","en","clinical/models")
    .setInputCols("document")
    .setOutputCol("sentence")
    
val tokenizer = new Tokenizer()
    .setInputCols("sentence")
    .setOutputCol("token")
    
val word_embeddings = WordEmbeddingsModel().pretrained("embeddings_clinical", "en", "clinical/models")
    .setInputCols(Array("sentence", "token"))
    .setOutputCol("embeddings")                
    
val ner = MedicalNerModel.pretrained("ner_oncology_posology", "en", "clinical/models")
    .setInputCols(Array("sentence", "token", "embeddings"))
    .setOutputCol("ner")
    
val ner_converter = new NerConverter()
    .setInputCols(Array("sentence", "token", "ner"))
    .setOutputCol("ner_chunk")

        
val pipeline = new Pipeline().setStages(Array(document_assembler,
                            sentence_detector,
                            tokenizer,
                            word_embeddings,
                            ner,
                            ner_converter))    

val data = Seq("The patient underwent a regimen consisting of adriamycin (60 mg/m2) and cyclophosphamide (600 mg/m2) over six courses. She is currently receiving his second cycle of chemotherapy and is in good overall condition.").toDS.toDF("text")

val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("en.med_ner.oncology_posology").predict("""The patient underwent a regimen consisting of adriamycin (60 mg/m2) and cyclophosphamide (600 mg/m2) over six courses. She is currently receiving his second cycle of chemotherapy and is in good overall condition.""")

Results

| chunk            | ner_label      |
|:-----------------|:---------------|
| adriamycin       | Cancer_Therapy |
| 60 mg/m2         | Dosage         |
| cyclophosphamide | Cancer_Therapy |
| 600 mg/m2        | Dosage         |
| six courses      | Cycle_Count    |
| second cycle     | Cycle_Number   |
| chemotherapy     | Cancer_Therapy |

Model Information

Model Name: ner_oncology_posology
Compatibility: Healthcare NLP 4.2.2+
License: Licensed
Edition: Official
Input Labels: [sentence, token, embeddings]
Output Labels: [ner]
Language: en
Size: 34.3 MB

References

In-house annotated oncology case reports.

Benchmarking

         label   tp  fp   fn  total  precision  recall   f1
  Cycle_Number   52   4   45     97       0.93    0.54 0.68
   Cycle_Count  200  63   30    230       0.76    0.87 0.81
  Radiotherapy  255  16   55    310       0.94    0.82 0.88
Cancer_Surgery  592  66  227    819       0.90    0.72 0.80
     Cycle_Day  175  22   73    248       0.89    0.71 0.79
     Frequency  337  44   90    427       0.88    0.79 0.83
         Route   53   1   60    113       0.98    0.47 0.63
Cancer_Therapy 1448  81  250   1698       0.95    0.85 0.90
      Duration  525 154  236    761       0.77    0.69 0.73
        Dosage  858  79  202   1060       0.92    0.81 0.86
Radiation_Dose   86   4   40    126       0.96    0.68 0.80
     macro_avg 4581 534 1308   5889       0.90    0.72 0.79
     micro_avg 4581 534 1308   5889       0.90    0.78 0.83