Skip to content

Commit

Permalink
formatting test data
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrall committed Mar 20, 2024
1 parent a67ba25 commit 9d880cf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/006-formatting-sample-data.md
Original file line number Diff line number Diff line change
@@ -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


<details>
<summary>Possible Flow</summary>

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)`

</details>
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/main/resources/data/ownsers.csv
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 9d880cf

Please sign in to comment.