30 lines
803 B
Python
30 lines
803 B
Python
#!/usr/bin/env python3
|
|
"""Аудит данных lab-модуля (профили, нормы, рационы)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_ROOT = Path(__file__).resolve().parents[1]
|
|
if str(_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(_ROOT))
|
|
|
|
from app import create_app, db
|
|
from app.lab.commands.audit_lab_data import audit_lab_data, format_audit_report
|
|
from config import Config
|
|
|
|
|
|
def main() -> int:
|
|
include_components = "--components" in sys.argv
|
|
app = create_app(Config)
|
|
with app.app_context():
|
|
report = audit_lab_data(include_components=include_components)
|
|
print(format_audit_report(report))
|
|
db.session.remove()
|
|
return 0 if report.ok() else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|