Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic linters #4

Merged
merged 21 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .ecrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Exclude": [
"Website/htdocs/mpmanager/packages/inensus/",
"Website/htdocs/mpmanager/database/dummyData/dummy_data.sql",
"composer.phar"
]
}
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# EditorConfig is awesome: https://EditorConfig.org

[*]
# Ensure consistent file encoding in UNIX style
charset = utf-8
end_of_line = lf
40 changes: 40 additions & 0 deletions .github/workflows/check-generic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generic checks to ease collaboration:
# - consistent file encoding in UNIX style
# - whitespaces in all purposes files like markdown, yaml, etc
name: Check Generic

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
editorconfig-checker:
name: Run editorconfig-checker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run editorconfig-checker
run: docker run --rm --volume=$PWD:/check mstruebing/editorconfig-checker

markdownlint:
name: Run markdownlint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run markdownlint-cli2
uses: DavidAnson/markdownlint-cli2-action@v13

yamllint:
name: Run yamllint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run yamllint
run: yamllint .
2 changes: 1 addition & 1 deletion .github/workflows/php_linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: ./vendor/bin/phpcbf --standard=PSR12 --tab-width=4 app/
working-directory: ./Website/htdocs/mpmanager
continue-on-error: true

- name: Run PHPStan
run: ./vendor/bin/phpstan analyze app/Http app/Services --memory-limit=4G --level=1
working-directory: ./Website/htdocs/mpmanager
Expand Down
17 changes: 17 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Disable some built-in rules
config:
line-length: false
no-inline-html: false
first-line-h1: false
code-block-style: false # conflicts with MkDocs Admontions: https://squidfunk.github.io/mkdocs-material/reference/admonitions/
code-fence-style:
style: backtick

# Define glob expressions to use (only valid at root)
globs:
- "**/*.md"

ignores:
- Website/ui/src/docs/source/index.md
- Website/ui/src/docs/source/.compare.md
- Website/htdocs/mpmanager/packages/
13 changes: 13 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends: default

rules:
document-start: disable
indentation:
spaces: 2
line-length: disable
quoted-strings:
quote-type: double
required: only-when-needed
allow-quoted-quotes: true
truthy:
check-keys: false
89 changes: 48 additions & 41 deletions Documentation/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,49 @@

- **Tarriff:** The combination of energy(kWh) price and the fixed price(access rate).

- **Target:** It is a goal for a Mini-Grid/ Cluster that the company wants to reach at a given time.
- **Target:** It is a goal for a Mini-Grid/ Cluster that the company wants to reach at a given time.

- **Asset Type:** An object, that could be sold to locals to help/improve their productivity or live quality.

- **Maintenance:** This is the place where external contractors are assigned to predefined jobs like "connect a new house-hold to the grid", "replacing not working meters, etc.".


## Before using MPManager

The key component(s) of the system is a mixture of meter/customer. That means both melts into each other a bit. The only way to register a customer or a meter is to register them both at the same time. For that reason from now on, every registered person will be mentioned as a **customer**.

### Register a customer & meter

There is an additional [Android Application](https://github.com/inensus/Customer-Meter-Registration) that should be used to register a customer with a meter together. The application allows you to select the village where the customer lives, the meter manufacturer, and the energy tariff that should be assigned to the meter.

### Tariffs

Its basically the energy price per kWh with an optional access rate/subscription fee. The operator is free to define the period of that fee. Ex: Every 7 days.

### Payment Channels

or now, the system supports only incoming payments from Airtel Tanzania and Vodacom Tanzania. Both providers are accepting Mobile Money and notify the MPManager over a secure tunnel.

### Payments

Each incoming payment has to contain the meter number. That is the unique number that is used to identify the other channels where the money could spend. After payment is been received the system automatically checks these further points;

1. Missing Asset Type Rates
2. Not paid Access Rates
3. Convert the money to energy and generate an STS-Token for the calculated energy amount. At the end of the payment process, the customer will be notified about each step.
3. Convert the money to energy and generate an STS-Token for the calculated energy amount. At the end of the payment process, the customer will be notified about each step.

At the end of the payment process the customer will be notified about each step.

If the entered meter number is not valid the system refuses the payment automatically.

### Selling an Asset

The system supports to sell assets to customers on a rate basis plan. A water pump or a milling machine will be a good example of that.

## Targets
A target can be assigned to a whole cluster or for a single Mini-Grid. The important thing by assigning a target is;

If the target is assigned to a cluster, the manager will see only that target on the cluster dashboard. However, if a single Mini-Grid or all Mini-Grids in a cluster has a defined target. The manager will see the calculated sum of these targets.
A target can be assigned to a whole cluster or for a single Mini-Grid. The important thing by assigning a target is;

If the target is assigned to a cluster, the manager will see only that target on the cluster dashboard. However, if a single Mini-Grid or all Mini-Grids in a cluster has a defined target. The manager will see the calculated sum of these targets.

Example: Cluster 1 has following Mini-Grids; MG-1 MG-2 and MG-3

Expand All @@ -62,108 +68,109 @@ Example: Cluster 1 has following Mini-Grids; MG-1 MG-2 and MG-3

The result of the cluster overview page would be 800 for expected new connections.


## MPManager

**Note: The pages that contain only a `List of X` and a `Add new X` button without any other key feature are not explained below.**

### Clusters Dashboard

It is basically the whole overview of the business. It shows some quick information like total revenue, registered meters and the number of registered clusters.

There are also more sections;
1. **Financial overview:** That breaks the total revenue to Mini-Grid level. The manager can see/analyse each Mini-Grid with that.
2. **Cluster Map:** The maps shows graphically where the clusters are located. The clusters on the map are clickable and forwards the manager to the next level dashboard **Cluster Dashboard**

To register a new cluster find the red plus button on the right bottom corner of the screen.
1. **Financial overview:** That breaks the total revenue to Mini-Grid level. The manager can see/analyse each Mini-Grid with that.
2. **Cluster Map:** The maps shows graphically where the clusters are located. The clusters on the map are clickable and forwards the manager to the next level dashboard **Cluster Dashboard**

To register a new cluster find the red plus button on the right bottom corner of the screen.

## Cluster Dashboard
The cluster dashboard is built similar to the clusters dashboard. There are small informative boxes at the top of the screen.
The financial overview and the map are based on Mini-Grids instead of clusters.

The cluster dashboard is built similar to the clusters dashboard. There are small informative boxes at the top of the screen.
The financial overview and the map are based on Mini-Grids instead of clusters.

There are two new sections available;
1. Revenue Analysis: That is the place where all targets of MiniGrids are shown together.

1. Revenue Analysis: That is the place where all targets of MiniGrids are shown together.
2. Revenue Trends: That is a chart that breaks down the revenue to customer groups.

## Mini-Grid Dashboard

Mini-grids are the building blocks of clusters. This dashboard provides information about the selected Mini-Grid, such as **revenue per customer**, **targeted revenue per customer type**, **energy sold**, **actual payment** ,and **the daily weather forecast** is the area where it can observe and analyze the income distribution of the selected Mini-Grid.

Also on this page, the status of **tickets** created by customers in the related Mini-Grid can be observed.

## Customers

MPManager customers are listed under `Customers` in the sidebar. This table contains the customers' name, phone number, city, and meter number. The search function also includes all those fields.

By clicking on a customer, will load the details of that specific customer.

This `customer details` page shows all information about that customer.

Such as
- Basic Details: Name, Surname, Birth Date, etc.
- Payment flow: Is a chart that shows how often the customer makes payments
- Addresses: A list of the addresses that belong to the customer.
- Sold Assets: The assets, that bought by the customer.
- A detailed list of the payments.
- Payment types: Shows how the sent money is neem spent (Energy, Access Rate payment, etc.).
- List of tickets that belong to the customer.
- A list of the meters which belong to the customer and a map where the meters are visually displayed.
This `customer details` page shows all information about that customer.

Such as

- Basic Details: Name, Surname, Birth Date, etc.
- Payment flow: Is a chart that shows how often the customer makes payments
- Addresses: A list of the addresses that belong to the customer.
- Sold Assets: The assets, that bought by the customer.
- A detailed list of the payments.
- Payment types: Shows how the sent money is neem spent (Energy, Access Rate payment, etc.).
- List of tickets that belong to the customer.
- A list of the meters which belong to the customer and a map where the meters are visually displayed.

Some of the elments are editable (ex:name,surname) or addable (ex:ticket, address).

## Meters

The `Meters` link on the sidebar loads a list that contains all registered meters with some additional details such as its serial number, assigned tariff, etc.. The search area on the page searches in `serial_number` and `tariff name`.


By clicking on a meter in the list, a new `meter detail` page will be loaded. This page, contains `basic information`, `meter details`, and `meter transactions`. If the meter can send its usage data it also shows it in an additional `meter reading` section. The `Basic Information` section contains the total revenue that the meter made, the owner, when the last payment occurs, and the registration date. `Meter Details` are meter specified details such as the manufacturer name, the serial number, assigned tariff, and its connection type. `Meter transactions` is a basic list that contains all transactions that hit the meter.

## Targets
By clicking on `Targets` in the sidebar will load a page with already set targets. The list shows only the key fields of each target. To see the details of a target, click on the `Expand` button.
## Targets (Sidebar)


To add a **new Target** just click on the `New Target` on the right top side. After clicking on that button, a new page will be loaded. Firstly the manager/admin should assign a Cluster or a Mini-Grid (The difference is already explained [here](#Information-before-using-MPManager)). Then, the date until that target is valid should be selected.
By clicking on `Targets` in the sidebar will load a page with already set targets. The list shows only the key fields of each target. To see the details of a target, click on the `Expand` button.

When these two steps are done; Its time to define our target with some fields like `New connections`, `Revenue per Month`,... None of these fields are marked as required. That means the manager/admin is free to enter or not to enter a value for each goal.
To add a **new Target** just click on the `New Target` on the right top side. After clicking on that button, a new page will be loaded. Firstly the manager/admin should assign a Cluster or a Mini-Grid.
Then, the date until that target is valid should be selected.

When these two steps are done; Its time to define our target with some fields like `New connections`, `Revenue per Month`,... None of these fields are marked as required. That means the manager/admin is free to enter or not to enter a value for each goal.

## Transactions
The page contains two main sections.

The page contains two main sections.

1. The comparison section; gives a quick overview of the situation. That section contains; Total incoming transactions, Confirmed Transactions, Cancelled Transactions, and the Revenue. The part which makes that information a bit interesting is the availability of comparison. The manager/admin can compare the day with; yesterday, same day last week, or the current week with last week or the current month with last month.

2. A basic list with incoming transactions. The list has an advanced filtering option instead of a basic search as in other pages.



By clicking on a Transaction, the `Transaction detail` page will load. The detail page contains the `Mobile Provider-specific data`, `Basic Data`, `Sent Sms`, and `Transaction Processing`.


**Mobile Money Provider-specific data:** The name of the provider and the transaction details. This information is required by the mobile money provider in case of an issue.

**Transaction Processing:** A detailed list that shows how the incoming money is been used by the system. Ex: 100$ for Energy, 20$ for Access Rate, and 400$ for Milling Machine Rate Payment.


## Tickets

MPManager is using [Trello](https://trello.com) as a ticketing platform. All tickets are basically Trello cards. The database is only holding references to the tickets. The ticketing system aims to resolve requests and complaints from customers as quickly as possible. It is important to assign a ticket to the correct category to maintain tickets easily. Therefore, there are some ticket categories. To add/ list category please click on `Categories` that is listed under `Tickets` in the sidebar.

### Adding User to Ticketing System
As already mentioned, the ticketing system is using Trello. To be able to assign tickets internally, all the staff has to be registered on [Trello](https://trello.com). The user name is been used to associate the Trello user to MPManager users.

As already mentioned, the ticketing system is using Trello. To be able to assign tickets internally, all the staff has to be registered on [Trello](https://trello.com). The user name is been used to associate the Trello user to MPManager users.

To add a user click on `Users` in the list below `Tickets`. It will ask you the `Ticketing System Tag`. That is the name that begins with an **@** in the Trello user profile.

## Maintenance

In some cases, it is wiser to use external resources to solve small problems. Maintenance is exactly for that there. The maintenance users are some experts who are not working for the company but works per contract.


There is a form to create a **New Maintenance Request**. That page asks the manager/admin about the job todo, the deadline for the task, the person who is responsible to do that, and the price for the task. The created task will be sent out to the external person via SMS. The created maintenance job/task is also saved as a ticket. The gain by saving that task as a ticket is, in case of a problem the person who is assigned to that job can reply to the initial SMS. The incoming SMS will automatically add to the ticket as a response.



## Sms

Sms is the key communication infrastructure. It is used by `Transactions` and `Maintenance`. But what if the company wants to send some inform their customers about something like an unplanned electricity cut. That is the reason why `Sms`is listed in the sidebar as an extra service.

The manager/admin can send SMS's to a specific Mini-Grid, to a specific customer group/type or single customers.


## Reports
MPManager has a reports page where managers can download reports. This page contains weekly, monthly, and payment requests.

MPManager has a reports page where managers can download reports. This page contains weekly, monthly, and payment requests.
Loading
Loading