what do I expect?
(As I don’t have codes I had to show in images what I need)
API response: https://raw.githubusercontent.com/leufrasiojunior/dashboard-clix/Testes/public/result.json
summarize the number of times a given criterion appears, count how many times it is compliant or non-compliant, add all the items individually and obtain a percentage.
When I manage to separate the data, I will use Google Charts to create the charts
[2]: https://phpout.com/wp-content/uploads/2023/07/a29vY.png
[3]: https://phpout.com/wp-content/uploads/2023/07/plRF9.png
[4]: https://phpout.com/wp-content/uploads/2023/07/amnS2.png
Original Content
I need some help to understand and how to do this process. I’m new to React and I need to do the following:
!I have the JSON below which is the response from an API.
OBS.: Within the JSON the information is in PT-BR.
I have an evaluation code that can be repeated. I need to concatenate all JSON responses from the same code to assemble a graph showing the user’s grade (Or general), as in the future I need to separate the "Criterion".
In summary:
1 person: 23 codes (23 items with the same code in JSON)
2 people: 46 codes (2 items with the same code for each person)
Separate these items, and display individually. (I deleted some JSON responses as I won’t be using them). In case it got complicated, I’ll try to explain it another way.
If I can CACHE these items on the server it might be easier to read these items later, as always reading more than 2000 items will be very slow. The API accepts criteria by changing the date. Can I program every day to fetch this data from the API, and save it in DB? Do I have to separate the JSON items somehow and write to a DB to maintain the cache, and read the items separately?
The API response is large, over two thousand items.
JSON Link
2
Answers
It's really hard to try to explain what I need to do. I am going to try. Basically I have an API response with 1500 items. (these are evaluations from a call center). Each evaluated user has an average of 23 items (which are shown in the API response), all of which have the same ID. There are different criteria (questions) where I need to unify all, and make an average to show the worst result. Separating every 5 items.
I need to unite the 23 items somehow, where I can show it to the user on the page created by React, where he had the worst rating.
And then regardless of the person, show an average of all values for each question. The problem is that this same question is repeated several times. So I basically need to filter out the duplicates and keep the question's unique value.
I've saved the entire API JSON (it's in pt-br) to see if it helps. The quantity is only shown from 5 days. Imagine that for the entire month? (In the postman simulation, the API response for 28 days has a weight of 13MB and took about 40 seconds to respond). That's why before I talked about some way to save it in cache or save it in a DB.
API response link: https://raw.githubusercontent.com/leufrasiojunior/dashboard-clix/Testes/public/result.json
In the future I will implement a search by name of the person, and show all averages (There is another API route that makes this easier for me).
I don’t understand what you are trying to do since you have not shown what you want your expected output to be like.
if you want to concatenate json why not parse into objects and then combine and stringify back.