This video is available to students only

Preparing a new data set

Configuring the query builder with geographic data fields

Preparing a new data set#

Now that we have our new API endpoint up and running, we can modify the client to query on the fields from the new data set.

Dataset switching#

In the client code, add a new type to the file types.ts called Dataset.

Add a state variable to hold the dataset and add a dataset selector to the top of the return statement in App.tsx.

Add a state variable to hold the new query representation. Switch the query and onQueryChange props in the QueryBuilder component based on the dataset selection.

If you still have the SQL and JSON representations visible in the application, switch the display based on the selection.

Field configuration#

In fields.ts, import the Dataset type and convert the exported object to a Record with keys of type Dataset and values of type Field[]. The sales fields should be under the sales key. Add the UN/LOCODE fields under the unlocode key. Use the inputType "number" for the id, latitude, and longitude fields, and use "date" for the date field.

 
No discussions yet