Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROD] SurgeAlerts export has bugs #2047

Open
szabozoltan69 opened this issue Feb 19, 2024 · 5 comments
Open

[PROD] SurgeAlerts export has bugs #2047

szabozoltan69 opened this issue Feb 19, 2024 · 5 comments
Assignees

Comments

@szabozoltan69
Copy link
Contributor

Issue

If we push the (upper right) Export button in https://go.ifrc.org/alerts/all – the export happens, but some rows are shifted horizontally: not the proper values appear in some cells.
If we push the (upper right) Export button in https://go.ifrc.org/alerts/all?event=6061, we receive a
Failed to generate export
warning, though on backend it seems to be not using that event-id (and seems to work):
"GET /api/v2/surge_alert/?offset=0&limit=100&format=csv HTTP/1.0" 200 ...
(200 means OK)

@szabozoltan69 szabozoltan69 self-assigned this Feb 19, 2024
@szabozoltan69
Copy link
Contributor Author

@anamariaescobar @tovari

@szabozoltan69
Copy link
Contributor Author

szabozoltan69 commented Feb 19, 2024

The failure seems to have this root cause:
Length mismatch. Expected 36 but got 100.

The API gives the response, but some newline chars can mess up the format. Normally this shouldn't cause issue via quotation marks:

0,fact,1,deployment,,,,,,,,,,,,,,,,2023-05-04T00:00:00Z,False,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,91,False,True,False,"FACT CASH, VR (British RC) , please proceed to deploy to Sri Lanka.",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Sri Lanka Floods,,0,Open,en
0,fact,1,deployment,,,,,,,,,,,,,,,,2023-05-04T00:00:00Z,False,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,92,False,True,False,"FACT Health, NE (Swedish RC), to deploy to Somalia.",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"Somalia, Drought and Epidemic",,0,Open,en
0,fact,0,information,,,,,,,,,,,,,,,,2023-05-04T00:00:00Z,False,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,93,False,True,False,Several profiles might be requested in the coming hours/days.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"Sierra Leone, Floods & Landslides",,0,Open,en
0,fact,2,alert,,,,,,,,,,,,,,,,2023-05-04T00:00:00Z,False,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,94,False,True,False,"1 x Team Leader: overall coordination internal and external, operational strategy and planning, team management.
1 x Shelter (funding available from Luxembourg RC): support NS on assessment, planning and coordination with other stakeholders.
1 x Communication: audio visual, media coverage/relations, content production.
1 x WASH: strong HP related competencies/expertise, assessment, support NS on design of WASH intervention with a focus on HP.
1 CTP: feasibility assessment, support NS on cash transfer program design and kick off implementation.
1 Health: strong PSS related competencies/background. This profile will support NS in assessment, planning, coordination and other NS PSS activities.
 
Also:
SIMS remote support will be activated
LOG profile have been identified at Country level",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"Sierra Leone, Floods & Landslides",,0,Open,en
0,fact,1,deployment,,,,,,,,,,,,,,,,2023-05-04T00:00:00Z,False,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,95,False,True,False,"The following roles are requested to deploy immediately:
FACT Team Leader: PD (Danish RC).
FACT Shelter: MP (Luxembourg RC).
FACT Communication: EH and ASA (Danish RC).
FACT WASH: AW (RDRT Cameroun RC, supported by the Canadian RC).
FACT CTP: GF (British RC). To be deployed after August 27th.
Also:
SIMS remote support have been identified and will be supported by the American RC, Netherland RC and British RC. FACT HEALTH (PSS): pending confirmation from NS.
For more information about the Sierra Leone operation, please see the operation page on DMIS.",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"Sierra Leone, Floods & Landslides",,0,Open,en

˘```

@szabozoltan69
Copy link
Contributor Author

I see a reason!
To have a smooth data flow, the requests are paginated, so the backend log shows:

[2024-02-19 15:56:43,283] basehttp: INFO - "GET /api/v2/surge_alert/?offset=0&limit=100&format=csv HTTP/1.1" 200 57666
[2024-02-19 15:56:43,781] basehttp: INFO - "GET /api/v2/surge_alert/?offset=100&limit=100&format=csv HTTP/1.1" 200 30707
[2024-02-19 15:56:44,151] basehttp: INFO - "GET /api/v2/surge_alert/?offset=200&limit=100&format=csv HTTP/1.1" 200 214334
[2024-02-19 15:56:44,525] basehttp: INFO - "GET /api/v2/surge_alert/?offset=300&limit=100&format=csv HTTP/1.1" 200 279057
[2024-02-19 15:56:44,836] basehttp: INFO - "GET /api/v2/surge_alert/?offset=400&limit=100&format=csv HTTP/1.1" 200 455258
[2024-02-19 15:56:47,688] basehttp: INFO - "GET /api/v2/surge_alert/?offset=500&limit=100&format=csv HTTP/1.1" 200 306312
[2024-02-19 15:56:50,083] basehttp: INFO - "GET /api/v2/surge_alert/?offset=600&limit=100&format=csv HTTP/1.1" 200 283560
[2024-02-19 15:56:52,646] basehttp: INFO - "GET /api/v2/surge_alert/?offset=700&limit=100&format=csv HTTP/1.1" 200 395579
[2024-02-19 15:56:55,341] basehttp: INFO - "GET /api/v2/surge_alert/?offset=800&limit=100&format=csv HTTP/1.1" 200 289576
[2024-02-19 15:56:58,766] basehttp: INFO - "GET /api/v2/surge_alert/?offset=900&limit=100&format=csv HTTP/1.1" 200 249182
[2024-02-19 15:57:01,653] basehttp: INFO - "GET /api/v2/surge_alert/?offset=1000&limit=100&format=csv HTTP/1.1" 200 677693
[2024-02-19 15:57:04,681] basehttp: INFO - "GET /api/v2/surge_alert/?offset=1100&limit=100&format=csv HTTP/1.1" 200 787801

Unfortunately the "flattening" of the different pages (to enity.0, entity.1...) depends on the data of the seen data set.
So, it can happen, that on page 4 we need molnix_tags.10, but on the other page there are only tags until molnix_tags.9.

@szabozoltan69
Copy link
Contributor Author

In go-web-app /src/views/AllSurgeAlerts/index.tsx we do not give the event id to the ExportButton(props) function, but the totalCount of awaited results yes.
On the mentioned page there were 36 alerts on frontend, so
kép
when the first page of the paginated API results gives 100 results, the mismatch appears.

@szabozoltan69
Copy link
Contributor Author

I don't see any option to give triggerExportStart any argument to filter results with event or country.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant