
    Ri	                        % S r SSKrSSKrSSKJr  SSKJr  SSKJrJ	r	  SSK
Jr  SSKJr  SSKJr  SS	KJr  \R$                  " \5      r\" \5      R-                  5       R.                  R.                  R.                  r\" \5      R-                  5       R.                  r\S
-  r\S-  r\" SSSS9rSq\\S'   \R?                  S5      S 5       r \RC                  5       (       a  \RE                  S\" \#" \5      S9SS9  \RI                  S\S9S 5       r%\RI                  S5      S 5       r&\S:X  a  SSK'r'\'RP                  " SSSSS 9  gg)!z FastAPI application entry point.    N)Path)FastAPI)HTMLResponseFileResponse)StaticFiles)PipelineManager)create_router)
WebServicefrontendstaticzCo-location MVP Web APIzXWeb interface for interactive co-location pattern mining with Stage3 preference learningz1.0.0)titledescriptionversionservicestartupc                     #    [         S-  S-  n [        [        U 5      S9n[        U5      q[        [        5      n[        R                  U5        [        R                  S5        g7f)zInitialize services on startup.configzconfig.yaml)config_pathz$Web service initialized successfullyN)
project_rootr   strr
   r   r	   appinclude_routerloggerinfo)r   managerrouters      :   /home/ubuntu/codebase/yexijia/保研/iCoLoc/src/web/app.pystartup_eventr   "   sX      )M9K#k*:;G !G 7#Fv
KK67s   A$A&z/static)	directory)name/)response_classc                     #    [         S-  n U R                  5       (       a,  [        U SSS9 n[        UR	                  5       S9sSSS5        $ [        SS9$ ! , (       d  f       g= f7f)zServe the main HTML page.z
index.htmlrzutf-8)encoding)contentNaE  
        <!DOCTYPE html>
        <html>
        <head>
            <title>iCoLoc</title>
            <meta charset="utf-8">
        </head>
        <body>
            <h1>Co-location MVP Web Interface</h1>
            <p>Frontend files not found. Please create frontend/index.html</p>
        </body>
        </html>
        )frontend_direxistsopenr   read)
index_pathfs     r   indexr-   :   s`      ,J*cG41 54  %  	 54s   *A'AA'
A$ A'z/healthc                     #    SSS.$ 7f)zHealth check endpoint.okzService is running)statusmessage r2       r   healthr4   Q   s      ';<<s   __main__zweb.app:appz0.0.0.0i@  T)hostportreload))__doc__loggingospathlibr   fastapir   fastapi.responsesr   r   fastapi.staticfilesr   controller.managerr   
web.routerr	   web.servicesr
   	getLogger__name__r   __file__resolveparentr   _web_dirr'   
static_dirr   r   __annotations__on_eventr   r(   mountr   getr-   r4   uvicornrunr2   r3   r   <module>rP      sQ   &  	   8 + . $ #			8	$ H~%%'..55<<>!!#***$ 
 
#j   i8 8& IIis:?hIO \* +, = =
 zKKIDF r3   