Skip to content

Commit

Permalink
Wrapped lines and used a common project name
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Attard committed Mar 9, 2021
1 parent d487052 commit 7d1d6cc
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 30 deletions.
96 changes: 67 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Welcome to PowerDale

PowerDale is a small town with around 100 residents. Most houses have a smart meter installed that can save and send information about how much power a house is drawing/using.
PowerDale is a small town with around 100 residents. Most houses have a smart meter installed that can save and send
information about how much power a house is drawing/using.

There are three major providers of energy in town that charge different amounts for the power they supply.

Expand All @@ -10,15 +11,21 @@ There are three major providers of energy in town that charge different amounts

# Introducing JOI Energy

JOI Energy is a new start-up in the energy industry. Rather than selling energy they want to differentiate themselves from the market by recording their customers' energy usage from their smart meters and recommending the best supplier to meet their needs.
JOI Energy is a new start-up in the energy industry. Rather than selling energy they want to differentiate themselves
from the market by recording their customers' energy usage from their smart meters and recommending the best supplier to
meet their needs.

You have been placed into their development team, whose current goal is to produce an API which their customers and smart meters will interact with.
You have been placed into their development team, whose current goal is to produce an API which their customers and
smart meters will interact with.

Unfortunately, two members of the team are on annual leave, and another one has called in sick! You are left with another ThoughtWorker to progress with the current user stories on the story wall. This is your chance to make an impact on the business, improve the code base and deliver value.
Unfortunately, two members of the team are on annual leave, and another one has called in sick! You are left with
another ThoughtWorker to progress with the current user stories on the story wall. This is your chance to make an impact
on the business, improve the code base and deliver value.

## Story Wall

At JOI energy the development team use a story wall or Kanban board to keep track of features or "stories" as they are worked on.
At JOI energy the development team use a story wall or Kanban board to keep track of features or "stories" as they are
worked on.

The wall you will be working from today has 7 columns:

Expand All @@ -30,11 +37,13 @@ The wall you will be working from today has 7 columns:
- Ready for sign off
- Done

Examples can be found here [https://leankit.com/learn/kanban/kanban-board/](https://leankit.com/learn/kanban/kanban-board/)
Examples can be found
here [https://leankit.com/learn/kanban/kanban-board/](https://leankit.com/learn/kanban/kanban-board/)

## Users

To trial the new JOI software 5 people from the JOI accounts team have agreed to test the service and share their energy data.
To trial the new JOI software 5 people from the JOI accounts team have agreed to test the service and share their energy
data.

| User | Smart Meter ID | Power Supplier |
| ------- | --------------- | --------------------- |
Expand All @@ -48,13 +57,17 @@ These values are used in the code and in the following examples too.

## Requirements

The project requires [Java 1.8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) or higher.
The project requires [Java 1.8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) or
higher.

The project makes use of Gradle and uses the [Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html), which means you don't need Gradle installed.
The project makes use of Gradle and uses
the [Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html), which means you don't need Gradle
installed.

## Useful Gradle commands

The project makes use of Gradle and uses the Gradle wrapper to help you out carrying some common tasks such as building the project or running it.
The project makes use of Gradle and uses the Gradle wrapper to help you out carrying some common tasks such as building
the project or running it.

### List all Gradle tasks

Expand All @@ -66,16 +79,17 @@ $ ./gradlew tasks

### Build the project

Compiles the project, runs the test and then created an executable JAR file
Compiles the project, runs the test and then creates an executable JAR file

```console
$ ./gradlew build
```

Run the application using Java and the executable JAR file produced by the Gradle `build` task. The application will be listening to port `8080`.
Run the application using Java and the executable JAR file produced by the Gradle `build` task. The application will be
listening to port `8080`.

```console
$ java -jar build/libs/tw-energy.jar
$ java -jar build/libs/joi-energy.jar
```

### Run the tests
Expand Down Expand Up @@ -110,7 +124,9 @@ $ ./gradlew bootRun

## API

Below is a list of API endpoints with their respective input and output. Please note that the application needs to be running for the following endpoints to work. For more information about how to run the application, please refer to [run the application](#run-the-application) section above.
Below is a list of API endpoints with their respective input and output. Please note that the application needs to be
running for the following endpoints to work. For more information about how to run the application, please refer
to [run the application](#run-the-application) section above.

### Store Readings

Expand All @@ -124,22 +140,28 @@ Example of body

```json
{
"smartMeterId": <smartMeterId>,
"electricityReadings": [
{ "time": <time>, "reading": <reading> },
{ "time": <time>, "reading": <reading> },
...
]
"smartMeterId": <smartMeterId>,
"electricityReadings": [
{
"time": <time>,
"reading": <reading>
},
{
"time": <time>,
"reading": <reading>
},
...
]
}
```

Parameters

| Parameter | Description |
| -------------- | ---------------------------------------------------- |
| `smartMeterId` | One of the smart meters' id listed above |
| `time` | The date/time (as epoch) when the _reading_ is taken |
| `reading` | The consumption in `kW` at the _time_ of the reading |
| Parameter | Description |
| -------------- | ----------------------------------------------------- |
| `smartMeterId` | One of the smart meters' id listed above |
| `time` | The date/time (as epoch) when the _reading_ was taken |
| `reading` | The consumption in `kW` at the _time_ of the reading |

Example readings

Expand All @@ -148,7 +170,10 @@ Example readings
| `2020-11-11 8:00` | 1605081600 | 0.0503 |
| `2020-11-12 8:00` | 1605168000 | 0.0213 |

In the above example, `0.0213 kW` were being consumed at `2020-11-12 8:00`. The reading indicates the powered being used at the time of the reading. If no power is being used at the time of reading, then the reading value will be `0`. Given that `0` may introduce new challenges, we can assume that there is always some consumption and we will never have a `0` reading value.
In the above example, `0.0213 kW` were being consumed at `2020-11-12 8:00`. The reading indicates the powered being used
at the time of the reading. If no power is being used at the time of reading, then the reading value will be `0`. Given
that `0` may introduce new challenges, we can assume that there is always some consumption, and we will never have a `0`
reading value.

Posting readings using CURL

Expand Down Expand Up @@ -186,8 +211,14 @@ Example output

```json
[
{ "time": "2020-11-11T08:00:00.000000Z", "reading": 0.0503 },
{ "time": "2020-11-12T08:00:00.000000Z", "reading": 0.0213 },
{
"time": "2020-11-11T08:00:00.000000Z",
"reading": 0.0503
},
{
"time": "2020-11-12T08:00:00.000000Z",
"reading": 0.0213
},
...
]
```
Expand Down Expand Up @@ -249,5 +280,12 @@ $ curl "http://localhost:8080/price-plans/recommend/smart-meter-0?limit=2"
Example output

```json
[{ "price-plan-2": 13.824 }, { "price-plan-1": 27.648 }]
[
{
"price-plan-2": 13.824
},
{
"price-plan-1": 27.648
}
]
```
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'tw-energy'
rootProject.name = 'joi-energy'

0 comments on commit 7d1d6cc

Please sign in to comment.