feat: AI patient onboarding backend and documentation

This commit is contained in:
2026-08-27 12:15:09 +05:30
parent b9440772d1
commit 59c1372fe3
49 changed files with 4012 additions and 0 deletions
@@ -0,0 +1,25 @@
from pathlib import Path
from uuid import uuid4
BASE_DIR = Path(__file__).resolve().parent.parent.parent
AUDIO_DIR = BASE_DIR / "data" / "audio"
AUDIO_DIR.mkdir(parents=True, exist_ok=True)
class AudioManager:
@staticmethod
def save_audio(audio_bytes: bytes, extension: str = "mp3") -> str:
ext = extension.lstrip(".")
audio_id = f"aud_{uuid4().hex[:12]}"
file_path = AUDIO_DIR / f"{audio_id}.{ext}"
file_path.write_bytes(audio_bytes)
return audio_id
@staticmethod
def get_audio_path(audio_id: str) -> Path | None:
for ext in [".wav", ".mp3", ".webm", ".m4a", ".ogg"]:
p = AUDIO_DIR / f"{audio_id}{ext}"
if p.exists():
return p
return None