notebook
This commit is contained in:
17
graphql_capture_1760777115.jsonl
Normal file
17
graphql_capture_1760777115.jsonl
Normal file
File diff suppressed because one or more lines are too long
135
medevio_api_notes.md
Normal file
135
medevio_api_notes.md
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
# 🧭 MEDEVIO API – Working Notes
|
||||||
|
|
||||||
|
## General Architecture
|
||||||
|
- **Frontend:** React + Material‑UI (MUI) + Apollo GraphQL
|
||||||
|
- **Backend:** GraphQL API → `https://api.medevio.cz/graphql`
|
||||||
|
- **Authentication:** cookies/tokens stored in `medevio_storage.json` (Playwright session)
|
||||||
|
- **Frontend base:** `https://my.medevio.cz/mudr-buzalkova/klinika/...`
|
||||||
|
- **Session handling:** token refreshed through `AccessToken_AuthSelf` calls
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Authentication and Session
|
||||||
|
Reuse session cookies from Playwright:
|
||||||
|
|
||||||
|
```python
|
||||||
|
state = json.load(open("medevio_storage.json"))
|
||||||
|
cookies = {c["name"]: c["value"] for c in state["cookies"] if "medevio" in c["domain"]}
|
||||||
|
```
|
||||||
|
|
||||||
|
Use these cookies in every `requests.post(GRAPHQL_URL, headers, cookies, data=...)` call.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Key GraphQL Operations
|
||||||
|
|
||||||
|
| Operation name | Purpose |
|
||||||
|
|----------------|----------|
|
||||||
|
| `AccessToken_AuthSelf` | Verify or refresh session |
|
||||||
|
| `ClinicNavigation_GetClinic` | Get basic clinic info |
|
||||||
|
| `ClinicAgenda_GetCalendarsForClinic` | List calendars within clinic |
|
||||||
|
| **`ClinicAgenda_ListClinicReservations`** | **List reservations (appointments)** |
|
||||||
|
| **`UpdateReservation_GetReservation`** | **Get full detail of one reservation** |
|
||||||
|
| **`ClinicRequestDetail_GetPatientRequest2`** | **Fetch detailed “Požadavek” (request card)** |
|
||||||
|
| `ClinicRequestNotes_Get` | Load Požadavek notes |
|
||||||
|
| `UseMessages_ListMessages` | Load chat messages |
|
||||||
|
| `Communication_GetClinicFooter` | UI footer text |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workflow for Automation
|
||||||
|
|
||||||
|
### 1️⃣ Extract reservations (agenda overview)
|
||||||
|
```graphql
|
||||||
|
operationName: "ClinicAgenda_ListClinicReservations"
|
||||||
|
variables: {
|
||||||
|
"clinicId": "<clinic-uuid>",
|
||||||
|
"dateFrom": "YYYY-MM-DDT00:00:00Z",
|
||||||
|
"dateTo": "YYYY-MM-DDT23:59:59Z"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
→ returns `id`, `startDateTime`, `endDateTime`, `patient {name, age}`, `reason`, `status`.
|
||||||
|
|
||||||
|
### 2️⃣ Get detail of a single reservation
|
||||||
|
```graphql
|
||||||
|
operationName: "UpdateReservation_GetReservation"
|
||||||
|
variables: {"id": "<reservation-uuid>"}
|
||||||
|
```
|
||||||
|
→ returns reason, time, doctor, patient contact, note, etc.
|
||||||
|
|
||||||
|
### 3️⃣ Get detail of Požadavek
|
||||||
|
```graphql
|
||||||
|
operationName: "ClinicRequestDetail_GetPatientRequest2"
|
||||||
|
variables: {"id": "<request-uuid>"}
|
||||||
|
```
|
||||||
|
→ returns text, attachments, communication, etc.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HTTP Setup (Python)
|
||||||
|
|
||||||
|
```python
|
||||||
|
GRAPHQL_URL = "https://api.medevio.cz/graphql"
|
||||||
|
headers = {
|
||||||
|
"content-type": "application/json",
|
||||||
|
"origin": "https://my.medevio.cz",
|
||||||
|
"referer": "https://my.medevio.cz/",
|
||||||
|
}
|
||||||
|
response = requests.post(GRAPHQL_URL, headers=headers, cookies=cookies, data=json.dumps(payload))
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Reservation Data Example
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": "0e3a4f5c-1c15-40e6-b1b1-325de9269ef5",
|
||||||
|
"reason": "Očkování - Chřipka",
|
||||||
|
"startDateTime": "2025-10-17T09:10:00Z",
|
||||||
|
"endDateTime": "2025-10-17T09:20:00Z",
|
||||||
|
"status": "confirmed",
|
||||||
|
"note": "přijde i s taťkou",
|
||||||
|
"patient": {"id": "...", "name": "Černík Pavel", "age": 53},
|
||||||
|
"doctor": {"id": "...", "name": "MUDr. Buzalková"},
|
||||||
|
"location": {"name": "Ordinace Prosek"}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Playwright Selectors
|
||||||
|
|
||||||
|
| Purpose | Selector |
|
||||||
|
|----------|-----------|
|
||||||
|
| Agenda rows | `div[data-testid='reservation-row']` |
|
||||||
|
| Row ID | `data-id` |
|
||||||
|
| Agenda fields | `div[data-field='Time']`, `div[data-field='Patient']`, `div[data-field='Reason']` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Recommended Automation Pipeline
|
||||||
|
|
||||||
|
1. **Agenda scrape (Playwright)** → extract `data-id`, patient, time, reason.
|
||||||
|
2. **GraphQL fetch (Python)** → use `ClinicAgenda_ListClinicReservations`.
|
||||||
|
3. **Detail enrichment** → call `UpdateReservation_GetReservation` and `ClinicRequestDetail_GetPatientRequest2`.
|
||||||
|
4. **Storage/reporting** → save to MySQL/Excel for vaccine planning.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Security / Maintenance Notes
|
||||||
|
|
||||||
|
- GraphQL introspection disabled.
|
||||||
|
- Refresh session cookies periodically.
|
||||||
|
- Keep data GDPR-compliant.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Future Tasks
|
||||||
|
|
||||||
|
- Automate cookie renewal.
|
||||||
|
- Build helper functions:
|
||||||
|
- `get_reservations(date)` using `ClinicAgenda_ListClinicReservations`
|
||||||
|
- `get_reservation_detail(reservation_id)`
|
||||||
|
- Map vaccine keywords (`Očkování – Chřipka`, `COVID`, `Hepatitida`, …).
|
||||||
|
- Export to Excel/MySQL for vaccine order planning.
|
||||||
113
medevio_api_notes.txt
Normal file
113
medevio_api_notes.txt
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
MEDEVIO API – WORKING NOTES
|
||||||
|
============================
|
||||||
|
|
||||||
|
GENERAL ARCHITECTURE
|
||||||
|
--------------------
|
||||||
|
Frontend: React + Material-UI (MUI) + Apollo GraphQL
|
||||||
|
Backend: GraphQL API at https://api.medevio.cz/graphql
|
||||||
|
Authentication: via cookies / tokens stored in medevio_storage.json (Playwright session file)
|
||||||
|
Frontend base: https://my.medevio.cz/mudr-buzalkova/klinika/...
|
||||||
|
Session handling: token refreshed through AccessToken_AuthSelf calls
|
||||||
|
|
||||||
|
AUTHENTICATION AND SESSION
|
||||||
|
--------------------------
|
||||||
|
Reuse session cookies from medevio_storage.json.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
state = json.load(open("medevio_storage.json"))
|
||||||
|
cookies = {c["name"]: c["value"] for c in state["cookies"] if "medevio" in c["domain"]}
|
||||||
|
|
||||||
|
Use these cookies in all requests.post(GRAPHQL_URL, headers, cookies, data=...) calls.
|
||||||
|
|
||||||
|
KEY API ENDPOINTS (GraphQL OPERATIONS)
|
||||||
|
--------------------------------------
|
||||||
|
Operation name Purpose
|
||||||
|
------------------------------------ ------------------------------------------
|
||||||
|
AccessToken_AuthSelf Verify or refresh current user session
|
||||||
|
ClinicNavigation_GetClinic Get basic clinic info (name, ID)
|
||||||
|
ClinicAgenda_GetCalendarsForClinic List available calendars within your clinic
|
||||||
|
ClinicAgenda_ListClinicReservations List reservations (appointments) for date or range
|
||||||
|
UpdateReservation_GetReservation Get full detail of one reservation
|
||||||
|
ClinicRequestDetail_GetPatientRequest2 Fetch detailed “Požadavek” (request card)
|
||||||
|
ClinicRequestNotes_Get Load notes/comments on Požadavek
|
||||||
|
UseMessages_ListMessages Load chat messages with patient
|
||||||
|
Communication_GetClinicFooter UI info only
|
||||||
|
|
||||||
|
WORKFLOW FOR AUTOMATION
|
||||||
|
-----------------------
|
||||||
|
1. Extract reservations (agenda overview)
|
||||||
|
operationName: "ClinicAgenda_ListClinicReservations"
|
||||||
|
variables: {"clinicId": "<clinic-uuid>", "dateFrom": "YYYY-MM-DDT00:00:00Z", "dateTo": "YYYY-MM-DDT23:59:59Z"}
|
||||||
|
|
||||||
|
Returns: id, startDateTime, endDateTime, patient {name, age}, reason, status
|
||||||
|
|
||||||
|
2. Get detail of a single reservation
|
||||||
|
operationName: "UpdateReservation_GetReservation"
|
||||||
|
variables: {"id": "<reservation-uuid>"}
|
||||||
|
|
||||||
|
Returns: reason, time, doctor, patient contact, note, etc.
|
||||||
|
|
||||||
|
3. Get detail of Požadavek (request card)
|
||||||
|
operationName: "ClinicRequestDetail_GetPatientRequest2"
|
||||||
|
variables: {"id": "<request-uuid>"}
|
||||||
|
|
||||||
|
Returns: text of request, attachments, communication, etc.
|
||||||
|
|
||||||
|
HTTP SETUP FOR ALL GRAPHQL CALLS
|
||||||
|
--------------------------------
|
||||||
|
GRAPHQL_URL = "https://api.medevio.cz/graphql"
|
||||||
|
headers = {
|
||||||
|
"content-type": "application/json",
|
||||||
|
"origin": "https://my.medevio.cz",
|
||||||
|
"referer": "https://my.medevio.cz/",
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.post(GRAPHQL_URL, headers=headers, cookies=cookies, data=json.dumps(payload))
|
||||||
|
|
||||||
|
DATA STRUCTURE HINTS (Reservation)
|
||||||
|
----------------------------------
|
||||||
|
{
|
||||||
|
"id": "0e3a4f5c-1c15-40e6-b1b1-325de9269ef5",
|
||||||
|
"reason": "Očkování - Chřipka",
|
||||||
|
"startDateTime": "2025-10-17T09:10:00Z",
|
||||||
|
"endDateTime": "2025-10-17T09:20:00Z",
|
||||||
|
"status": "confirmed",
|
||||||
|
"note": "přijde i s taťkou",
|
||||||
|
"patient": {"id": "...", "name": "Černík Pavel", "age": 53},
|
||||||
|
"doctor": {"id": "...", "name": "MUDr. Buzalková"},
|
||||||
|
"location": {"name": "Ordinace Prosek"}
|
||||||
|
}
|
||||||
|
|
||||||
|
PLAYWRIGHT SELECTORS (REFERENCE)
|
||||||
|
--------------------------------
|
||||||
|
Purpose Selector
|
||||||
|
---------------- -------------------------------------------
|
||||||
|
Agenda rows div[data-testid='reservation-row']
|
||||||
|
Row ID data-id
|
||||||
|
Agenda fields div[data-field='Time'], div[data-field='Patient'], div[data-field='Reason']
|
||||||
|
|
||||||
|
RECOMMENDED AUTOMATION PIPELINE
|
||||||
|
--------------------------------
|
||||||
|
1. Step 1 – Agenda scrape (Playwright)
|
||||||
|
Open agenda-dne → extract data-id, patient, time, reason.
|
||||||
|
2. Step 2 – GraphQL fetch (Python requests)
|
||||||
|
Use ClinicAgenda_ListClinicReservations to get full dataset.
|
||||||
|
3. Step 3 – Detail enrichment
|
||||||
|
For each appointment → call UpdateReservation_GetReservation.
|
||||||
|
For linked Požadavek → call ClinicRequestDetail_GetPatientRequest2.
|
||||||
|
4. Step 4 – Storage / reporting
|
||||||
|
Save to MySQL or Excel for vaccine inventory, reminders, analytics.
|
||||||
|
|
||||||
|
SECURITY / MAINTENANCE NOTES
|
||||||
|
----------------------------
|
||||||
|
- GraphQL introspection is disabled.
|
||||||
|
- Session cookies expire periodically; refresh via Playwright login.
|
||||||
|
- Keep data secure (GDPR compliance).
|
||||||
|
|
||||||
|
FUTURE TASKS
|
||||||
|
------------
|
||||||
|
- Automate login refresh and cookie renewal.
|
||||||
|
- Build function get_reservations(date) using ClinicAgenda_ListClinicReservations.
|
||||||
|
- Build function get_reservation_detail(reservation_id).
|
||||||
|
- Map vaccine keywords (Očkování – Chřipka, COVID, Hepatitida, …).
|
||||||
|
- Export to Excel/MySQL for vaccine order planning.
|
||||||
1
medevio_storage.json
Normal file
1
medevio_storage.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"cookies": [{"name": "gateway-access-token", "value": "YwBgkf8McREDKs7vCZj0EZD2fJsuV8RyDPtYx7WiDoz0nFJ9kxId8kcNEPBLFSwM+Tiz80+SOdFwo+oj", "domain": "my.medevio.cz", "path": "/", "expires": 1763372319, "httpOnly": false, "secure": false, "sameSite": "Lax"}, {"name": "aws-waf-token", "value": "b6a1d4eb-4350-40e5-8e52-1f5f9600fbb8:CgoAr9pC8c6zAAAA:OYwXLY5OyitSQPl5v2oIlS+hIxsrb5LxV4VjCyE2gJCFFE5PQu+0Zbxse2ZIofrNv5QKs0TYUDTmxPhZyTr9Qtjnq2gsVQxWHXzrbebv3Z7RbzB63u6Ymn3Fo8IbDev3CfCNcNuxCKltFEXLqSCjI2vqNY+7HZkgQBIqy2wMgzli3aSLq0w8lWYtZzyyot7q8RPXWMGTfaBUo2reY0SOSffm9rAivE9PszNfPid71CvNrGAAoxRbwb25eVujlyIcDVWe5vZ9Iw==", "domain": ".my.medevio.cz", "path": "/", "expires": 1761125920, "httpOnly": false, "secure": true, "sameSite": "Lax"}], "origins": [{"origin": "https://my.medevio.cz", "localStorage": [{"name": "awswaf_token_refresh_timestamp", "value": "1760780309860"}, {"name": "awswaf_session_storage", "value": "b6a1d4eb-4350-40e5-8e52-1f5f9600fbb8:CgoAr9pC8c+zAAAA:+vw//1NzmePjPpbGCJzUB+orCRivtJd098DbDX4AnABiGRw/+ql6ShqvFY4YdCY7w2tegb5mEPBdAmc4sNi22kNR9BuEoAgCUiMhkU1AZWfzM51zPfTh7SveCrREZ7xdvxcqKPMmfVLRYX5E4+UWh22z/LKQ7+d9VERp3J+wWCUW3dFFirkezy3N7b2FVjTlY/RxsZwhejQziTG/L3CkIFFP3mOReNgBvDpj7aKoM1knY4IL4TZ8E7zNv3nTsvzACLYvnUutVOUcofN1TfOzwZshSKsEXsMzrQn8PzLccX1jM5VSzce7gfEzl0zSPsT8NB3Sna+rhMIttDNYgvbW1HsfG2LIeKMR27Zf8hkslDRVVkcU/Kp2jLOEdhhrBKGjKY2o9/uX3NExdzh5MEKQSSRtmue01BpWYILPH23rMsz4YSmF+Ough5OeQoC95rkcYwVXMhwvUN9Zfp9UZ4xCNfFUex5dOrg9aJntYRnaceeocGUttNI5AdT0i3+osV6XHXzKxeqO8zLCS9BIsCzxaHfdqqem5DorMceuGKz+QqksatIQAA=="}, {"name": "Application.Intl.locale", "value": "cs"}, {"name": "Password.prefill", "value": "{\"username\":\"vladimir.buzalka@buzalka.cz\",\"type\":\"email\"}"}]}]}
|
||||||
Reference in New Issue
Block a user