{"openapi":"3.1.0","info":{"title":"alztest API","description":"Cribado temprano por el lenguaje. No es un diagnóstico.","version":"2.0.0"},"paths":{"/health":{"get":{"tags":["estado"],"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"boolean"}]},"type":"object","title":"Response Health Health Get"}}}}}}},"/screenings/audio":{"post":{"tags":["prueba"],"summary":"Screen Audio","operationId":"screen_audio_screenings_audio_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudioScreeningRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Bad Gateway","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/screenings/text":{"post":{"tags":["prueba"],"summary":"Screen Text","operationId":"screen_text_screenings_text_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TextScreeningRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Bad Gateway","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/auth/login":{"post":{"tags":["acceso"],"summary":"Login","operationId":"login_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/summary":{"get":{"tags":["panel"],"summary":"Summary","operationId":"summary_admin_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummaryResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/admin/screenings":{"get":{"tags":["panel"],"summary":"List Screenings","operationId":"list_screenings_admin_screenings_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/screenings/{screening_id}":{"get":{"tags":["panel"],"summary":"Get Screening","operationId":"get_screening_admin_screenings__screening_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"screening_id","in":"path","required":true,"schema":{"type":"string","title":"Screening Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["panel"],"summary":"Delete Screening","description":"Borra una prueba (por ejemplo, una de prueba técnica que no debe contar).","operationId":"delete_screening_admin_screenings__screening_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"screening_id","in":"path","required":true,"schema":{"type":"string","title":"Screening Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/screenings/{screening_id}/label":{"put":{"tags":["panel"],"summary":"Label Screening","description":"Marca la prueba como control, deterioro o simulado, para usarla al entrenar.","operationId":"label_screening_admin_screenings__screening_id__label_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"screening_id","in":"path","required":true,"schema":{"type":"string","title":"Screening Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabelRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/export/dataset.csv":{"get":{"tags":["panel"],"summary":"Export Dataset","description":"Las pruebas con texto y etiqueta, en el formato de app/ml/dataset_contract.py.\n\nSe entrena con: python -m training.train_model --dataset data/alztest_synthetic_es_v2.csv\n--dataset data/alztest_live.csv","operationId":"export_dataset_admin_export_dataset_csv_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/admin/model":{"get":{"tags":["panel"],"summary":"Model Info","operationId":"model_info_admin_model_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelInfoResponse"}}}}},"security":[{"HTTPBearer":[]}]}}},"components":{"schemas":{"AudioScreeningRequest":{"properties":{"age":{"type":"integer","maximum":110.0,"minimum":18.0,"title":"Age","description":"Edad en años."},"sex":{"type":"string","enum":["female","male"],"title":"Sex"},"allow_text_storage":{"type":"boolean","title":"Allow Text Storage","description":"True si la persona aceptó que se guarde el texto de su descripción (nunca el audio).","default":false},"audio_base64":{"type":"string","minLength":1,"title":"Audio Base64","description":"Audio codificado en base64."},"audio_format":{"type":"string","title":"Audio Format","description":"webm, mp4, m4a, mp3, wav, ogg o flac.","default":"webm"}},"type":"object","required":["age","sex","audio_base64"],"title":"AudioScreeningRequest"},"DailyCountResponse":{"properties":{"day":{"type":"string","format":"date","title":"Day"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["day","count"],"title":"DailyCountResponse"},"ErrorResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"ErrorResponse"},"FeatureWeightResponse":{"properties":{"name":{"type":"string","title":"Name"},"label":{"type":"string","title":"Label"},"weight":{"type":"number","title":"Weight"}},"type":"object","required":["name","label","weight"],"title":"FeatureWeightResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LabelRequest":{"properties":{"label_group":{"anyOf":[{"type":"string","enum":["control","deterioro","simulado"]},{"type":"null"}],"title":"Label Group","description":"null para quitar la etiqueta."},"participant_ref":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Participant Ref","description":"Apodo de quien hizo la prueba (ej.: «alvaro»). Evita que sus pruebas queden en entrenamiento y en prueba a la vez."}},"type":"object","required":["label_group"],"title":"LabelRequest"},"LoginRequest":{"properties":{"username":{"type":"string","title":"Username"},"password":{"type":"string","title":"Password"}},"type":"object","required":["username","password"],"title":"LoginRequest"},"ModelInfoResponse":{"properties":{"version":{"type":"string","title":"Version"},"language":{"type":"string","title":"Language"},"algorithm":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Algorithm"},"trained_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trained At"},"thresholds":{"additionalProperties":{"type":"number"},"type":"object","title":"Thresholds"},"metrics":{"type":"object","title":"Metrics"},"dataset":{"type":"object","title":"Dataset"},"warning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Warning"},"features":{"items":{"$ref":"#/components/schemas/FeatureWeightResponse"},"type":"array","title":"Features"}},"type":"object","required":["version","language","algorithm","trained_at","thresholds","metrics","dataset","warning","features"],"title":"ModelInfoResponse"},"ScreeningDetail":{"properties":{"id":{"type":"string","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"age":{"type":"integer","title":"Age"},"sex":{"type":"string","title":"Sex"},"input_mode":{"type":"string","title":"Input Mode"},"risk_level":{"type":"string","title":"Risk Level"},"probability":{"type":"number","title":"Probability"},"model_version":{"type":"string","title":"Model Version"},"out_of_range_count":{"type":"integer","title":"Out Of Range Count"},"has_transcript":{"type":"boolean","title":"Has Transcript"},"label_group":{"anyOf":[{"type":"string","enum":["control","deterioro","simulado"]},{"type":"null"}],"title":"Label Group"},"participant_ref":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Participant Ref"},"transcript":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transcript"},"features":{"additionalProperties":{"type":"number"},"type":"object","title":"Features"},"out_of_range_signals":{"items":{"type":"string"},"type":"array","title":"Out Of Range Signals"}},"type":"object","required":["id","created_at","age","sex","input_mode","risk_level","probability","model_version","out_of_range_count","has_transcript","label_group","participant_ref","transcript","features","out_of_range_signals"],"title":"ScreeningDetail"},"ScreeningPage":{"properties":{"total":{"type":"integer","title":"Total"},"skip":{"type":"integer","title":"Skip"},"limit":{"type":"integer","title":"Limit"},"items":{"items":{"$ref":"#/components/schemas/ScreeningRow"},"type":"array","title":"Items"}},"type":"object","required":["total","skip","limit","items"],"title":"ScreeningPage"},"ScreeningResponse":{"properties":{"screening_id":{"type":"string","title":"Screening Id","description":"Identificador de la prueba guardada."},"risk_level":{"type":"string","enum":["green","amber","red"],"title":"Risk Level"},"probability":{"type":"number","title":"Probability","description":"Qué tan marcadas están las señales, de 0 a 1. No es un diagnóstico."},"signal_groups":{"items":{"$ref":"#/components/schemas/SignalGroupResponse"},"type":"array","title":"Signal Groups"},"features":{"additionalProperties":{"type":"number"},"type":"object","title":"Features"},"word_count":{"type":"integer","title":"Word Count"},"model_version":{"type":"string","title":"Model Version"},"model_is_demo":{"type":"boolean","title":"Model Is Demo","description":"True si el modelo se entrenó con datos sintéticos."}},"type":"object","required":["screening_id","risk_level","probability","signal_groups","features","word_count","model_version","model_is_demo"],"title":"ScreeningResponse"},"ScreeningRow":{"properties":{"id":{"type":"string","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"age":{"type":"integer","title":"Age"},"sex":{"type":"string","title":"Sex"},"input_mode":{"type":"string","title":"Input Mode"},"risk_level":{"type":"string","title":"Risk Level"},"probability":{"type":"number","title":"Probability"},"model_version":{"type":"string","title":"Model Version"},"out_of_range_count":{"type":"integer","title":"Out Of Range Count"},"has_transcript":{"type":"boolean","title":"Has Transcript"},"label_group":{"anyOf":[{"type":"string","enum":["control","deterioro","simulado"]},{"type":"null"}],"title":"Label Group"},"participant_ref":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Participant Ref"}},"type":"object","required":["id","created_at","age","sex","input_mode","risk_level","probability","model_version","out_of_range_count","has_transcript","label_group","participant_ref"],"title":"ScreeningRow"},"SignalGroupResponse":{"properties":{"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"description":{"type":"string","title":"Description"},"needs_attention":{"type":"boolean","title":"Needs Attention"}},"type":"object","required":["key","label","description","needs_attention"],"title":"SignalGroupResponse"},"SummaryResponse":{"properties":{"total":{"type":"integer","title":"Total"},"by_risk_level":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Risk Level"},"by_input_mode":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Input Mode"},"last_30_days":{"items":{"$ref":"#/components/schemas/DailyCountResponse"},"type":"array","title":"Last 30 Days"},"with_out_of_range":{"type":"integer","title":"With Out Of Range","description":"Pruebas con alguna señal fuera del rango que el modelo conoce."},"with_transcript":{"type":"integer","title":"With Transcript","description":"Pruebas con el texto guardado (con consentimiento)."},"labeled":{"type":"integer","title":"Labeled","description":"Pruebas con texto y etiqueta: listas para entrenar."}},"type":"object","required":["total","by_risk_level","by_input_mode","last_30_days","with_out_of_range","with_transcript","labeled"],"title":"SummaryResponse"},"TextScreeningRequest":{"properties":{"age":{"type":"integer","maximum":110.0,"minimum":18.0,"title":"Age","description":"Edad en años."},"sex":{"type":"string","enum":["female","male"],"title":"Sex"},"allow_text_storage":{"type":"boolean","title":"Allow Text Storage","description":"True si la persona aceptó que se guarde el texto de su descripción (nunca el audio).","default":false},"text":{"type":"string","maxLength":5000,"minLength":1,"title":"Text","description":"Descripción escrita, en español."}},"type":"object","required":["age","sex","text"],"title":"TextScreeningRequest"},"TokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"}},"type":"object","required":["access_token"],"title":"TokenResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}