Composite data accumulation
We use a variety of ways to get the data we need for our pages. Some are arguably rudimentary in nature but we move forward.
We would like to help you get familiar with the 3 step process.
How we get JSON
XMI ๐งช
- Log in to your Statista account.
- Open your browser developer tools (usually F12 or right-click and select "Inspect").
- Go to the "Application" tab. for Chrome or "Storage" tab for Firefox.
- Look for the "Cookies" section in the left sidebar.
- Find the cookie named __sso.
- Copy the value of the __sso cookie. This is your API token.
- Go to JWO.io and paste the token into the "Encoded" field.
- Remove extra "%3D" characters at the end of the token if they exist.
- Copy the accessToken value from the encoding value you pasted.
- Replace 'your_prod_token' with value you copied.
- cd inside the
/scriptsdirectory from your command line. - Follow the instructions inside the
scripts/get.xmo-json.shfile. - execute the following command
sh get-xmo-json.sh.
Statistics ๐งฐ
- Ensure you have the necessary permissions to access the API.
- You need a token from Numera Prod. If you do not have access please contact the Numera team for instructions or get in touch with someone from the templating team.
- Follow the instructions inside the
scripts/get-statistics-json.sh. - From your terminal, navigate to the scripts directory.
- Run the script with
sh get-statistics-json.sh.
GCS ๐ง
This process is a bit more manual but we proceed! ๐
- Create a folder inside the app's root directory called json.
- Place all the JSON files you want to convert inside the json/current-gcs directory
- Create another folder for storing gcs answer -> json/current-gcs/survey-answer in the root of the project.
We are now half way there
- Open the browser developer tools (usually F12 or right-click and select "Inspect").
- Go to the "Network" tab.
- Refresh the page to capture the network requests.
- copy the response for the request called
token/. - from your browser's console type JSON.parse(with_the_copied_value).
- paste that value in a new file you will create [any name you choose].json.
- Ensure the data is not an array e.g [{"cellResponseList" : ....}] โ {"cellResponseList : ..."} โ inside the json/current-gcs folder.
- now look again inside the request for a request with a questionID Example GCS request
- copy the the response of that request.
- from your browser's console type JSON.parse(with_the_copied_value).
- paste that value in a new file you will create [any name you choose].json. inside the json/current-gcs/survey-answer folder.
[!NOTE] you could add more answers to that array if you like.
Now we have some survey answers.
Data Conversion
For XMI no conversion is required.
Please follow the instructions inside scripts/collect-json.ts
- execute the
pnpm convertcommand from your terminal - the converted json will be now inside your json/converted folder.