MeMu SDK
MeMu SDK is a powerful and secure package designed for clients to perform medical-focused tasks such as audio transcription (basic and FHIR-compliant), medical entity extraction (basic and FHIR-compliant), drug interaction checks (basic and FHIR-compliant), medical summarization (basic and FHIR-compliant), medical code lookups (HCPCS, FHIR-compliant HCPCS, ICD-10, FHIR-compliant ICD-10), and more.
Additionally, MeMu handles client balance management, charging for audio transcription, text correction, summarization, and medical interaction checks based on usage, ensuring seamless billing for customers.
Table of Contents
- Installation
- Initialization
- Audio Transcription (Basic)
- Audio Transcription (FHIR-compliant)
- Medical Entity Extraction (Basic)
- Medical Entity Extraction (FHIR-compliant)
- Drug Interaction Checks (Basic)
- Drug Interaction Checks (FHIR-compliant)
- Summarization (Basic)
- Summarization (FHIR-compliant)
- Medical Code Lookups (HCPCS)
- Medical Code Lookups (FHIR-compliant HCPCS)
- Medical Code Lookups (ICD-10)
- Medical Code Lookups (FHIR-compliant ICD-10)
- Authentication
- Cost and Balance Management
- Multilingual Support
Installation
pip install medical-multimodal
Initialization
After installing the MeMu SDK, initialize the SDK by using your unique MeMu API key. This API key authenticates your requests with the MeMu backend.
Example for Initializing and Transcribing
from memu.audio import Audio
memu_api_key = "your_memu_api_key"
audio_processor = Audio(memu_api_key)
transcription = audio_processor.transcribe_audio_file("/path/to/audio/file.wav", language="en")
print(transcription)
Audio Transcription (Basic)
MeMu’s basic audio transcription service:
- Automatically re-encodes audio files if needed.
- Splits long audio files into smaller chunks.
Example:
from memu.audio import Audio
memu_api_key = "your_memu_api_key"
audio_processor = Audio(memu_api_key)
transcription = audio_processor.transcribe_audio_file("/path/to/audio/file.wav", language="en")
print(transcription)
Audio Transcription (FHIR-compliant)
For clients requiring FHIR-compliant outputs, MeMu offers a transcription service that generates FHIR DocumentReference resources. This is especially useful in medical and healthcare settings where data must conform to FHIR standards.
Example:
from memu.audio_fhir import AudioFHIR
memu_api_key = "your_memu_api_key"
audio_fhir_processor = AudioFHIR(memu_api_key)
fhir_document_json = audio_fhir_processor.transcribe_audio_file("/path/to/audio/file.wav", "example_patient_id", language="en")
print(fhir_document_json)
MeMu supports extracting medical entities like medications, procedures, diseases, and diagnoses from medical records and transcripts.
Example:
from memu.extraction import MedicalEntityExtractor
memu_api_key = "your_memu_api_key"
extractor = MedicalEntityExtractor(memu_api_key)
transcript = "Patient reports hypertension and diabetes."
medical_records = {"PatientID": "test_patient_123"}
entities = extractor.extract_medical_entities(transcript, medical_records)
print(entities)
For clients requiring FHIR-compliant outputs for entity extraction, MeMu offers a FHIR-compliant entity extraction service. The extracted entities are returned as FHIR-compliant resources (e.g., MedicationStatement, Procedure, Condition).
Example:
from memu.extraction_fhir import MedicalEntityExtractorFHIR
memu_api_key = "your_memu_api_key"
extractor_fhir = MedicalEntityExtractorFHIR(memu_api_key)
transcript = "Patient is taking Metformin and Furosemide."
medical_records = {"PatientID": "test_patient_123"}
fhir_bundle = extractor_fhir.extract_medical_entities(transcript, medical_records, "test_patient_123")
print(fhir_bundle)
Drug Interaction Checks (Basic)
MeMu’s drug interaction checker cross-references medications using AI models and third-party drug databases. It returns interactions between drug pairs and can be tailored for specific medical records.
Example:
from memu.drug_interaction import DrugInteractionChecker
memu_api_key = "your_memu_api_key"
interaction_checker = DrugInteractionChecker(memu_api_key)
medications = ["Metformin", "Lisinopril", "Furosemide"]
interactions = interaction_checker.orchestrate_interaction_check(medications)
print(interactions)
Drug Interaction Checks (FHIR-compliant)
For clients requiring FHIR-compliant outputs, MeMu can return detected drug interaction issues as DetectedIssue resources within a FHIR-compliant bundle.
Example:
from memu.drug_interaction_fhir import DrugInteractionCheckerFHIR
memu_api_key = "your_memu_api_key"
fhir_interaction_checker = DrugInteractionCheckerFHIR(memu_api_key)
medications = ["Metformin", "Lisinopril", "Furosemide"]
patient_id = "example_patient_123"
fhir_bundle = fhir_interaction_checker.orchestrate_interaction_check_fhir(medications, patient_id)
print(fhir_bundle)
Summarization (Basic)
MeMu's summarization feature generates concise summaries of patient medical records and transcripts, helping healthcare professionals to quickly understand patient status and medical history. The summary includes chronic conditions, vital signs, current medications, treatment plans, and recommendations based on medical data and transcript.
Example:
from memu.summarization import MedicalSummarizer
memu_api_key = "your_memu_api_key"
summarizer = MedicalSummarizer(memu_api_key)
transcript = "Good morning Jane, before we update your medication list, ..."
medical_records = [{
"PatientID": "cea64247-e29a-40db-b052-b4af44dda1b2",
"Name": "Jane Doe",
"Age": 45,
"Gender": "Female",
"MedicalHistory": "Hypertension, Diabetes",
"Medications": "Metformin, Lisinopril, Furosemide, Potassium Chloride",
"TestResults": "Blood pressure: 130/85",
"TreatmentPlans": "Continue current medication",
"Notes": "Patient is stable"
}]
summary = summarizer.summarize_medical_info(transcript, medical_records)
print(summary)
Summarization (FHIR-compliant)
For clients requiring FHIR-compliant outputs for summarization, MeMu offers a summarization service that generates a FHIR Composition resource. This is particularly useful for generating structured, interoperable medical summaries.
Example:
from memu.summarization_fhir import MedicalSummarizerFHIR
memu_api_key = "your_memu_api_key"
summarizer_fhir = MedicalSummarizerFHIR(memu_api_key)
transcript = "
Good morning Jane, before we update your medication list, ..."
medical_records = [{
"PatientID": "cea64247-e29a-40db-b052-b4af44dda1b2",
"Name": "Jane Doe",
"Age": 45,
"Gender": "Female",
"MedicalHistory": "Hypertension, Diabetes",
"Medications": "Metformin, Lisinopril, Furosemide, Potassium Chloride",
"TestResults": "Blood pressure: 130/85",
"TreatmentPlans": "Continue current medication",
"Notes": "Patient is stable"
}]
fhir_composition = summarizer_fhir.summarize_medical_info_fhir(transcript, medical_records, "test_patient_123")
print(fhir_composition)
Medical Code Lookups (HCPCS)
MeMu SDK allows users to perform medical code lookups for HCPCS codes. HCPCS (Healthcare Common Procedure Coding System) codes are primarily used to identify products, supplies, and services that are not included in the CPT (Current Procedural Terminology) codes.
The SDK interacts with AI to provide HCPCS code suggestions based on procedures and the patient's medical summary.
Example:
from memu.hcpcs import HCPCSCodeOrchestrator
memu_api_key = "your_memu_api_key"
hcpcs_orchestrator = HCPCSCodeOrchestrator(memu_api_key)
procedure = "Air pressure mattress"
consultation_summary = "The patient requires an air pressure mattress to manage pressure sores."
patient_summary = {
"MedicalStatus": {
"ChronicConditions": ["Hypertension", "Diabetes"],
"VitalSigns": {
"BloodPressure": "145/90",
"HeartRate": "88 bpm",
"OxygenSaturation": "94%",
"Temperature": "Normal"
}
},
"Medications": ["Metformin", "Lisinopril", "Furosemide", "Potassium Chloride"],
"TreatmentPlan": ["Continue current medication"]
}
hcpcs_suggestion = hcpcs_orchestrator.suggest_hcpcs_code(procedure, consultation_summary, patient_summary)
print(hcpcs_suggestion)
Medical Code Lookups (FHIR-compliant HCPCS)
For clients requiring FHIR-compliant HCPCS code lookups, MeMu offers an enhanced feature where HCPCS codes are fetched and returned as FHIR Procedure resources.
Example:
from memu.hcpcs_fhir import HCPCSCodeOrchestratorFHIR
memu_api_key = "your_memu_api_key"
hcpcs_fhir_orchestrator = HCPCSCodeOrchestratorFHIR(memu_api_key)
procedure = "Air pressure mattress"
consultation_summary = "The patient requires an air pressure mattress to manage pressure sores."
patient_summary = {
"MedicalStatus": {
"ChronicConditions": ["Pressure Sores"],
"VitalSigns": {
"BloodPressure": "145/90",
"HeartRate": "88 bpm",
"OxygenSaturation": "94%",
"Temperature": "Normal"
}
},
"Medications": ["Metformin", "Lisinopril", "Furosemide"],
"TreatmentPlan": ["Prescribe air pressure mattress"]
}
fhir_procedure = hcpcs_fhir_orchestrator.orchestrate_hcpcs_fhir(procedure, consultation_summary, patient_summary, "example_patient_123")
print(fhir_procedure)
Medical Code Lookups (ICD-10)
MeMu SDK also supports medical code lookups for ICD-10 codes. ICD-10 (International Classification of Diseases) codes are used for diagnosing diseases and classifying a wide variety of signs, symptoms, and conditions.
The SDK interacts with AI to provide ICD-10 code suggestions based on diseases, diagnoses, and the patient's medical summary.
Example:
from memu.icd10 import ICD10CodeOrchestrator
memu_api_key = "your_memu_api_key"
icd10_orchestrator = ICD10CodeOrchestrator(memu_api_key)
diagnosis = "Diabetes mellitus"
consultation_summary = "The patient has been diagnosed with type 2 diabetes mellitus and is managing it with Metformin."
patient_summary = {
"MedicalStatus": {
"ChronicConditions": ["Type 2 diabetes mellitus"],
"Medications": ["Metformin", "Insulin"],
"VitalSigns": {
"BloodPressure": "130/85",
"HeartRate": "72 bpm",
"OxygenSaturation": "97%",
"Temperature": "Normal"
}
},
"TreatmentPlan": ["Continue current medication"],
"Summary": "The patient has a stable condition and is managing their diabetes well."
}
icd10_suggestion = icd10_orchestrator.suggest_icd10_code(diagnosis, consultation_summary, patient_summary)
print(icd10_suggestion)
Medical Code Lookups (FHIR-compliant ICD-10)
For clients requiring FHIR-compliant ICD-10 code lookups, MeMu provides ICD-10 code suggestions returned as FHIR Condition resources, ensuring the output is compatible with healthcare standards.
Example:
from memu.icd10_fhir import ICD10CodeOrchestratorFHIR
memu_api_key = "your_memu_api_key"
icd10_fhir_orchestrator = ICD10CodeOrchestratorFHIR(memu_api_key)
diagnosis = "Diabetes mellitus"
consultation_summary = "The patient has been diagnosed with type 2 diabetes mellitus and is managing it with Metformin."
patient_summary = {
"MedicalStatus": {
"ChronicConditions": ["Type 2 diabetes mellitus"],
"Medications": ["Metformin", "Insulin"],
"VitalSigns": {
"BloodPressure": "130/85",
"HeartRate": "72 bpm",
"OxygenSaturation": "97%",
"Temperature": "Normal"
}
},
"TreatmentPlan": ["Continue current medication"],
"Summary": "The patient has a stable condition and is managing their diabetes well."
}
fhir_condition = icd10_fhir_orchestrator.orchestrate_icd10_fhir(diagnosis, consultation_summary, patient_summary, "example_patient_123")
print(fhir_condition)
Authentication
All actions performed using the MeMu SDK require authentication via the MeMu API key. Clients must include their key when initializing the SDK for any tasks.
Cost and Balance Management
MeMu SDK manages billing based on client usage. Each client account has an associated balance, and charges are based on the following:
- $15.00 per 1M input tokens
- $45.00 per 1M output tokens
- $0.018 per minute of audio transcription
Before performing a transcription, summarization, or interaction check, the SDK checks the client's balance to ensure there are sufficient funds. If not, the client is prompted to refill their account. All token usage and minutes transcribed are logged for accurate billing.
Multiligual Support
All MeMu modules support various languages, accessing this functionality is fairly simple and all you have to do is enter an additional parameter at the end of your definition. Here is an example:
from memu.icd10_fhir import ICD10CodeOrchestratorFHIR
memu_api_key = "your_memu_api_key"
icd10_fhir_orchestrator = ICD10CodeOrchestratorFHIR(memu_api_key)
diagnosis = "Diabetes mellitus"
consultation_summary = "The patient has been diagnosed with type 2 diabetes mellitus and is managing it with Metformin."
patient_summary = {
"MedicalStatus": {
"ChronicConditions": ["Type 2 diabetes mellitus"],
"Medications": ["Metformin", "Insulin"],
"VitalSigns": {
"BloodPressure": "130/85",
"HeartRate": "72 bpm",
"OxygenSaturation": "97%",
"Temperature": "Normal"
}
},
"TreatmentPlan": ["Continue current medication"],
"Summary": "The patient has a stable condition and is managing their diabetes well."
}
fhir_condition = icd10_fhir_orchestrator.orchestrate_icd10_fhir(diagnosis, consultation_summary, patient_summary, "example_patient_123", language)
print(fhir_condition)
What's Next?
MeMu SDK will soon support additional features, including:
- Medical Code Lookups for other coding systems beyond HCPCS and ICD-10.
Here is an updated README draft with the multilingual support section, as well as the general instructions for accessing MeMu's various functionalities, including examples.
Multilingual Support
MeMu SDK supports multiple languages across its modules, allowing users to extract and analyze medical entities in languages such as English, Chinese, Uzbek, Spanish, Italian, Russian, Thai, and Arabic.
You can access the multilingual capabilities by specifying the language
parameter in the relevant modules. Below is an example for extracting medical entities in different languages:
from memu.extraction import MedicalEntityExtractor
memu_api_key = "your_memu_api_key"
extractor = MedicalEntityExtractor(memu_api_key)
transcript = "El paciente reporta hipertensión y diabetes."
medical_records = {"PatientID": "test_patient_123"}
entities = extractor.extract_medical_entities(transcript, medical_records, language="es")
print(entities)
Example Output in Various Languages
Here are some examples of how the SDK processes medical entity extraction in different languages:
-
English:
{
"Medications": ["Lisinopril", "Metformin"],
"Procedures": ["Blood pressure measurement", "ECG monitoring"],
"Diseases": ["Hypertension", "Type 2 Diabetes"]
}
-
Chinese:
{
"Medications": ["赖诺普利", "二甲双胍"],
"Procedures": ["血压测量", "心电图监测"],
"Diseases": ["高血压", "2型糖尿病"]
}
-
Spanish:
{
"Medications": ["Lisinopril", "Metformina"],
"Procedures": ["Medición de la presión arterial", "Monitoreo del ECG"],
"Diseases": ["Hipertensión", "Diabetes tipo 2"]
}
The SDK provides similar multilingual capabilities for other modules such as drug interaction checks, medical summarization, and medical code lookups.
What's Next?
MeMu SDK will soon support additional features, including:
- Medical Code Lookups for other coding systems beyond HCPCS and ICD-10.
Here is an updated README draft with the multilingual support section, as well as the general instructions for accessing MeMu's various functionalities, including examples.