
    x:jm                        d dl mZ d dlZd dlZd dlmZ d dlmZ  ed          Zdd
Z	ddZ
edk    r e e
                      dS )    )annotationsN)date)Pathz4/home/agent/.hermes/assets/Gesundheit/health_data.dbconsqlite3.ConnectionreturnNonec                0    |                      d           d S )Na  CREATE TABLE IF NOT EXISTS low_histamine_experiments (
        id INTEGER PRIMARY KEY AUTOINCREMENT,
        start_date TEXT NOT NULL,
        end_date TEXT,
        phase TEXT NOT NULL DEFAULT 'baseline' CHECK(phase IN ('baseline','challenge','paused','completed')),
        challenge_food TEXT,
        hypothesis TEXT,
        notes TEXT,
        status TEXT DEFAULT 'active' CHECK(status IN ('active','completed','cancelled')),
        created_at TEXT DEFAULT CURRENT_TIMESTAMP,
        updated_at TEXT DEFAULT CURRENT_TIMESTAMP
    ))execute)r   s    I/home/agent/.hermes/assets/Gesundheit/scripts/low_histamine_experiment.pyensurer      s'    KK 	 
 
 
 
 
    intc                 @   t          j        d          } |                     dd          }|                    d          }|                    dt          j                                                               |                    d	d
           |                    dd           |                    d          }|                    dd           |                    dt          j                                                               |                    dd           |                    d          }|                    dt                     |                    dt          j                                                               |                    dd           |                    d           | 	                                }t          j        t                    }t          j        |_        	 t          |           |j        dk    rM|                    d|j        |j        |j        f           |                                 t+          d           n|j        dk    r]|                    d|j        |j        d|j         |j        f           |                                 t+          d|j                    n|j        dk    rZ|                    d|j        |j        |j        |j        f           |                                 t+          d|j                    n?|j        dk    r4|                    d          D ]}t+          t1          |                     |                                 n# |                                 w xY wdS )Nz4Manage low-histamine baseline/challenge experiments.)descriptioncmdT)destrequiredstartz--date)defaultz--hypothesisu:   Low-Histamine-Baseline zur Symptom-/Ernährungskorrelationz--notes 	challengez--food)r   completeid)typelistzINSERT INTO low_histamine_experiments(start_date,phase,hypothesis,notes,status,updated_at)
                           VALUES(?,'baseline',?,?, 'active', CURRENT_TIMESTAMP)z Low-Histamine-Baseline gestartetzINSERT INTO low_histamine_experiments(start_date,phase,challenge_food,hypothesis,notes,status,updated_at)
                           VALUES(?,'challenge',?,?,?, 'active', CURRENT_TIMESTAMP)zRe-Challenge: zChallenge gestartet: zUPDATE low_histamine_experiments SET end_date=?, status='completed', phase='completed', notes=COALESCE(notes,'') || CASE WHEN ?='' THEN '' ELSE '
' || ? END, updated_at=CURRENT_TIMESTAMP WHERE id=?zExperiment abgeschlossen: ztSELECT id,start_date,end_date,phase,challenge_food,status,hypothesis FROM low_histamine_experiments ORDER BY id DESCr   )argparseArgumentParseradd_subparsers
add_parseradd_argumentr   today	isoformatr   
parse_argssqlite3connectDBRowrow_factoryr   r   r   
hypothesisnotescommitprintfoodr   dictclose)apsubpargsr   rs         r   mainr6      s   		 -c	d	d	dB




6
6CwANN8TZ\\%;%;%=%=N>>>NN>+gNhhhNN9bN))){##ANN8dN+++NN8TZ\\%;%;%=%=N>>>NN9bN)))z""ANN4cN"""NN8TZ\\%;%;%=%=N>>>NN9bN)))NN6==??D
/"

Css8wKK TVZV_aeaprvr|U}  JJLLL% BCCCCX$$KK WY]Ybdhdm  pL  AE  AJ  pL  pL  NR  NX  YYZ Z ZJJLLL% C	 C CDDDDX##KK  a  dh  dm  os  oy  {  {E  GK  GN  cO  P  P  PJJLLL% FTW F FGGGGX[[  "X  Y  Y  d1gg				1s   =E3N N__main__)r   r   r   r	   )r   r   )
__future__r   r   r%   datetimer   pathlibr   r'   r   r6   __name__
SystemExit r   r   <module>r>      s    " " " " " "              	T
@AA
 
 
 
$ $ $ $L z
*TTVV

 r   