diff --git a/docs/006-formatting-sample-data.md b/docs/006-formatting-sample-data.md new file mode 100644 index 0000000..6853d6d --- /dev/null +++ b/docs/006-formatting-sample-data.md @@ -0,0 +1,30 @@ +# Formatting Sample Data + +Working with sample/test data is a very common task when building applications. + +In the Petclinic application, the `src/main/resources/data/ownsers.csv` contains the list of owners formatted in a csv file. + +When looking it you can see that you have a column that could be removed (`default`), and ideally it would be nice to add a email for example with the format `first.last@petclinic.com`. + +How can you complete the following tasks: + +- Reformat the csv file, where you remove the default column and add email +- Create a JSON file, that will be another file for our test environment + + +
+Possible Flow + +1. Open the `src/main/resources/data/ownsers.csv` file +2. Select the content +3. Use the Copilot Inline Chat (`Right click > Copilot`), and ask the following: + + `In the editor, remove the first column, and add a new one called email based on first.last@petclinic.com` +4. Save the file. + + +You can now for example copy the file and use the same approach to reformat to JSON or use the Chat using #file command. + +- `using #file:ownsers.csv , propose the same data as JSON array (do not provide the code to do it but the formatted data that I can add in a new file)` + +
\ No newline at end of file diff --git a/readme.md b/readme.md index 3726afb..4076fed 100644 --- a/readme.md +++ b/readme.md @@ -37,6 +37,7 @@ The project contains some exercises to learn how to use GitHub Copilot. You can - [Working with SQL](docs/003-working-with-sql.md) - [Deploying the application](docs/004-deploying-the-application.md) - [Generating Diagram from code](docs/005-generating-documentation.md) +- [Formatting Test Data (CSV & JSON)](docs/006-formatting-sample-data.md) ## License diff --git a/src/main/resources/data/ownsers.csv b/src/main/resources/data/ownsers.csv new file mode 100644 index 0000000..3e26249 --- /dev/null +++ b/src/main/resources/data/ownsers.csv @@ -0,0 +1,11 @@ +"id","first_name","last_name","address","city","phone_number" +"default","George","Franklin","110 W. Liberty St.","Madison","6085551023" +"default","Betty","Davis","638 Cardinal Ave.","Sun Prairie","6085551749" +"default","Eduardo","Rodriquez","2693 Commerce St.","McFarland","6085558763" +"default","Harold","Davis","563 Friendly St.","Windsor","6085553198" +"default","Peter","McTavish","2387 S. Fair Way","Madison","6085552765" +"default","Jean","Coleman","105 N. Lake St.","Monona","6085552654" +"default","Jeff","Black","1450 Oak Blvd.","Monona","6085555387" +"default","Maria","Escobito","345 Maple St.","Madison","6085557683" +"default","David","Schroeder","2749 Blackhawk Trail","Madison","6085559435" +"default","Carlos","Estaban","2335 Independence La.","Waunakee","6085555487"