MediSeven.jl

Build Status Code Style: Blue

A robust Julia package for medical named entity recognition (NER) using spaCy models. MediSeven.jl provides state-of-the-art extraction of medical entities like drugs, dosages, frequencies, and routes from clinical text.

Features

Installation

using Pkg
Pkg.add("MediSeven")

Or from the Julia REPL:

] add MediSeven

Quick Start

using MediSeven

# Load model (automatic fallback if primary model fails)
model = load_model()

# Process single text
doc = model("Take 500mg paracetamol every 6 hours for pain")
println("Entities found: $(length(doc.ents))")

# Process batch
texts = [
    "Administer 40mg lisinopril daily", 
    "Apply 0.1% tacrolimus ointment BID"
]
docs = model(texts)

API Reference

Model Loading

# Default loading with fallbacks
model = load_model()

# Specify model and batch size
model = load_model(model_name="kormilitzin/en_core_med7_lg", batch_size=16)

# Disable fallbacks (strict mode)
model = load_model(model_name="my_model", use_fallback=false)

Text Processing

# Single text
doc = process!(text, model)
# or
doc = model(text)

# Batch processing
docs = process!(texts, model)
# or 
docs = model(texts)

Entities

for entity in doc.ents
    println("$(entity.label): '$(entity.text)' at $(entity.start):$(entity.stop)")
end

Supported Entity Types

Fallback Models

MediSeven.jl automatically tries multiple spaCy models in order of preference:

kormilitzin/en_core_med7_lg (primary) en_core_med7_lg en_core_web_sm en_core_web_md en_core_web_lg

Development

git clone https://github.com/liyakhathshaik/MediSeven.jl.git
cd MediSeven.jl
julia --project=. -e "using Pkg; Pkg.instantiate()"
julia --project=. -e "using Pkg; Pkg.test()"

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License & Attribution

This project is licensed under the MIT License - see the LICENSE file for details.

This package is a Julia port of the original Med7 Python package by Andrey Kormilitzin et al., which is licensed under the Apache License 2.0.

Original Med7 Python Package Attribution

Copyright 2020 Andrey Kormilitzin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Citation

@software{mediseven_jl,
  title = {MediSeven.jl: Medical Named Entity Recognition for Julia},
  author = {Liyakhath Shaik},
  year = {2025},
  url = {https://github.com/liyakhathshaik/MediSeven.jl},
  note = {Julia port of Med7 Python package by Andrey Kormilitzin et al.}
}

Acknowledgments