uimaruta

Mark Diagnosis with a certain ICD-10 Code as main diagnosis


I would like to mark all diagnoses whose conceptId starts with "G35." as main diagnosis. How can I implement this?

d:Diagnosis{d.conceptId.startswith("G35.") -> MainDiagnosis}; 
d:Diagnosis{d.conceptId[0:3] == "G35." -> MainDiagnosis};

All the best Philipp


Solution

  • You could use REGEXP condition to match a pattern on the value of a feature (i.e. Diagnosis.conceptId). A solution in your case would be something like this:

    d:Diagnosis{REGEXP(d.conceptId, "^G35.*") -> MainDiagnosis};
    

    For more information on REGEXP Condition, feel free to consult the documentation


    Another option would be to use StringFunctions; similar to what you tried to do in the first rule.

    d:Diagnosis{startsWith(d.conceptId, "G35") -> MainDiagnosis};
    

    However this requires you to activate an optional extension org.apache.uima.ruta.string.bool.BooleanOperationsExtension in your Ruta Analysis Engine by setting its parameter PARAM_ADDITIONAL_EXTENSIONS