MedEx logo

GitHub: med_ex License: MIT

MedEx

MedEx is an Elixir SDK for recording clinical audio and streaming an independent live WebRTC Opus preview. It accepts indexed mono 48 kHz signed PCM16LE audio, writes an immutable content-addressed WAV artifact, and encodes live Opus for a replaceable WebRTC listener. The host application owns authorization, signaling, and clinical review.

Installation

Add :med_ex to your list of dependencies in mix.exs:

def deps do
  [
    {:med_ex, "~> 0.1.0"}
  ]
end

Prerequisites

Quick example

# Start a capture under your host DynamicSupervisor (owner is the producer PID)
{:ok, capture} =
  DynamicSupervisor.start_child(
    MyApp.Captures,
    {MedEx.Capture, owner: self(), acquisition_id: "acq-1", artifact_dir: "/var/lib/myapp/wavs"}
  )

# Push contiguous 20 ms chunks (960 mono samples = 1,920 PCM16LE bytes at 48 kHz)
:ok = MedEx.Capture.push(capture, 0, pcm_chunk_0)
:ok = MedEx.Capture.push(capture, 960, pcm_chunk_1)

# Finalize to an immutable "<file_sha256>.wav" file and %MedEx.Evidence{}
{:ok, %MedEx.Evidence{artifact_key: key, file_sha256: sha, sample_count: 1920}} =
  MedEx.Capture.finish(capture)

Scope in 0.1.0

Guides

License

Released under the MIT License.