{"openapi":"3.1.0","info":{"title":"medrepo API","version":"0.1.0"},"paths":{"/research/cycle-data/v1":{"post":{"summary":"Receive Cycle Data","operationId":"receive_cycle_data_research_cycle_data_v1_post","parameters":[{"name":"x-app-id","in":"header","required":true,"schema":{"type":"string","title":"X-App-Id"}},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/research/cycle-data/v1/stats":{"get":{"summary":"Cycle Data Stats","description":"Global aggregate across all trials. X-API-Key (operator key) only —\nresearchers use the per-trial /research/trials/<code>/* endpoints below.","operationId":"cycle_data_stats_research_cycle_data_v1_stats_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/research/trials/{code}/stats":{"get":{"summary":"Trial Stats","operationId":"trial_stats_research_trials__code__stats_get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/research/trials/{code}/submissions":{"get":{"summary":"Trial Submissions","operationId":"trial_submissions_research_trials__code__submissions_get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/research/trials/{code}/submissions.csv":{"get":{"summary":"Trial Submissions Csv","description":"One row per cycle (long format). Easier to load into R/pandas than\nnested JSON; researchers typically want a flat table anyway.","operationId":"trial_submissions_csv_research_trials__code__submissions_csv_get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/research/trials/{code}/results":{"post":{"summary":"Trial Result","description":"Ein Ergebnis unter der id4, unter der die Daten herausgegeben wurden.\n\nDas Portal loest NICHT auf und speichert NICHTS davon. Es prueft, dass der\nSchluessel diese Studie lesen darf, und reicht an das Relay weiter; dort\nliegt der Studienschluessel, dort wird die id4 auf id3 und Praxis\naufgeloest, und von dort geht das Ergebnis an die Box. Die Box prueft die\nEinwilligung, bevor sie es der Aerztin zeigt.\n\nAbsicht: keine Warteschlange und keine Ablage im Portal. Ist die Box nicht\nverbunden, gibt es 503 und die Forschungsseite liefert erneut. Ein\nErgebnis bei uns liegen zu lassen hiesse, Gesundheitsinhalt in unserer\nCloud zu speichern, und genau das soll dieses Verfahren vermeiden.","operationId":"trial_result_research_trials__code__results_post","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultIn"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/research/me":{"get":{"summary":"Research Me","description":"Identity + trial-list for the bearer holder. Drives the portal\ndashboard so the page can render only the trials this key can read.","operationId":"research_me_research_me_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/research/me/rotate-key":{"post":{"summary":"Research Me Rotate Key","description":"Self-service rotation. The old key dies the moment this commit lands;\nthe response carries the plaintext replacement so the portal can show\nit once + the researcher can update their R/Python scripts.","operationId":"research_me_rotate_key_research_me_rotate_key_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/research/trials/{code}/distribution/{field}":{"get":{"summary":"Trial Distribution","description":"Per-field histogram — value → count. Backend-aggregated so the page\ndoesn't have to pull every cycle just to render a histogram.","operationId":"trial_distribution_research_trials__code__distribution__field__get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}},{"name":"field","in":"path","required":true,"schema":{"type":"string","title":"Field"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/device/v1/exchange":{"post":{"summary":"Exchange","operationId":"exchange_device_v1_exchange_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/device/v1/exchange/poll/{nonce}":{"get":{"summary":"Exchange Poll","operationId":"exchange_poll_device_v1_exchange_poll__nonce__get","parameters":[{"name":"nonce","in":"path","required":true,"schema":{"type":"string","title":"Nonce"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/device/v1/refresh":{"post":{"summary":"Refresh","operationId":"refresh_device_v1_refresh_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/trial/v1/registry/{code}":{"get":{"summary":"Get Trial Config","description":"Return the public config for a trial.\n\nThe caller is the Zykla / cycletracker app; it uses trialId to\ndrive the enrollment flow and collection_fields to decide which\nquestions to present.","operationId":"get_trial_config_trial_v1_registry__code__get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CycleIn":{"properties":{"cycle_length_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cycle Length Days"},"period_length_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Period Length Days"},"flow_intensity":{"anyOf":[{"type":"integer","maximum":3.0,"minimum":0.0},{"type":"null"}],"title":"Flow Intensity"},"cramping":{"anyOf":[{"type":"integer","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Cramping"},"bloating":{"anyOf":[{"type":"integer","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Bloating"},"headache":{"anyOf":[{"type":"integer","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Headache"},"mood":{"anyOf":[{"type":"integer","maximum":3.0,"minimum":0.0},{"type":"null"}],"title":"Mood"}},"type":"object","title":"CycleIn"},"ExchangeIn":{"properties":{"token":{"type":"string","maxLength":128,"minLength":8,"title":"Token"}},"type":"object","required":["token"],"title":"ExchangeIn"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"RefreshIn":{"properties":{"refreshToken":{"type":"string","maxLength":128,"minLength":8,"title":"Refreshtoken"}},"type":"object","required":["refreshToken"],"title":"RefreshIn"},"ResultIn":{"properties":{"id4":{"type":"string","maxLength":74,"minLength":74,"title":"Id4"},"content":{"type":"string","maxLength":262144,"minLength":1,"title":"Content"}},"type":"object","required":["id4","content"],"title":"ResultIn"},"SubmissionIn":{"properties":{"share_id":{"type":"string","maxLength":64,"title":"Share Id"},"trial_code":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Trial Code"},"cycle_count":{"type":"integer","minimum":1.0,"title":"Cycle Count"},"summary":{"$ref":"#/components/schemas/SummaryIn"},"cycles":{"items":{"$ref":"#/components/schemas/CycleIn"},"type":"array","maxItems":500,"title":"Cycles"}},"type":"object","required":["share_id","cycle_count","summary","cycles"],"title":"SubmissionIn"},"SummaryIn":{"properties":{"avg_cycle_length_days":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Cycle Length Days"},"avg_period_length_days":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Period Length Days"}},"type":"object","title":"SummaryIn"},"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"}}}}