Merge remote-tracking branch 'origin/to_erase'
88
CONTRIBUTING_CENTRAL_DATA_MODEL.md
Normal file
|
@ -0,0 +1,88 @@
|
|||
# How to create a class for the Central Data Model
|
||||
|
||||
This document explains the steps to follow if you want to contribute to the city data model by adding new classes or new attributes.
|
||||
Use this document after having a clear idea of how your data model should look like already integrated in the Central Data Model.
|
||||
Please, refer to the cerclibs.pdf (https://liveconcordia.sharepoint.com/:b:/s/CERC-Next-GenCities-Platform/EfPNAGXexCFOju2sKBr6pNMBcwnvLin1Wio1Ahpfu4cxag?e=rhkdca)
|
||||
to integrate your data model with the Central Data Model.
|
||||
|
||||
## Starting with the basics
|
||||
- Install all requirements and download the Libs project. [Here](WINDOWS_INSTALL.md) how to do it for windows.
|
||||
In order to maintain a good quality code, we will work in branches. New codes will need to pass quality standards before being accepted in the main branch.
|
||||
- Check and follow our [coding style](PYGUIDE.md)
|
||||
- Don’t forget to create unit tests and ensure that the old ones pass normally after your changes.
|
||||
- Imperative! Document your work using comments in the code and, if needed, adding text files with extended explanations.
|
||||
|
||||
If the code doesn't pass the quality review, it will be rejected.
|
||||
|
||||
## Adding new parameters to existing classes
|
||||
|
||||
Adding a new parameter is an easy task. Open the desired class, for example, CityObject:
|
||||
![city object](./docs/img_contributing/img_5.png)
|
||||
|
||||
Add the name of your new parameter to the list at the constructor and initialize it as desired:
|
||||
![new parameter](./docs/img_contributing/img_6.png)
|
||||
|
||||
At the end of the class, add the corresponding getter and setter. It is very important that they are documented!
|
||||
![getter and setter](./docs/img_contributing/img_7.png)
|
||||
|
||||
You will see that the name of the file (city_object.py) changes from white to blue. That means that your version is different
|
||||
from that one in the git. Once you finish doing your changes, you should commit and push them to your branch. The name of the file will turn back white.
|
||||
|
||||
## Creating a new class
|
||||
|
||||
Create a new class in the corresponding folder (if it does not exist, create a new folder ad hoc).
|
||||
![new folder](./docs/img_contributing/img_0.png)
|
||||
![new file](./docs/img_contributing/img_1.png)
|
||||
![add to git](./docs/img_contributing/img_2.png)
|
||||
|
||||
And add it to git (the name of the file will turn from red to green).
|
||||
Every new class must have:
|
||||
- A header with the following information:
|
||||
|
||||
```python
|
||||
|
||||
"""
|
||||
My New Data Class module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Name of Project Coder name.project.coder@concordia.ca
|
||||
"""
|
||||
```
|
||||
|
||||
- A brief explanation of what it is, what it does, what it can be used for, etc. under its name:
|
||||
|
||||
```python
|
||||
|
||||
"""
|
||||
MyNewDataClass class
|
||||
This class models this and does that
|
||||
"""
|
||||
```
|
||||
|
||||
- All imported libraries together at the beginning.
|
||||
|
||||
![new class](./docs/img_contributing/img_3.png)
|
||||
|
||||
A data class contains properties that describe the data model. Therefore, it should be mainly composed by getters and setters.
|
||||
We would like to avoid having methods in the data classes. All those methods that could be done in the factories must be written there.
|
||||
The properties can be divided into two groups, those that can be modified during the use of the model, and those that
|
||||
are set only once and stay unchangeable. The line that divides these to groups is sometimes difficult to draw.
|
||||
An example to get a taste of this difference could be the following. A building is formed by surfaces, the list of surfaces
|
||||
is something that defines the building and, for our purposes, is unchangeable. On the other hand, if one of our studies is
|
||||
to show the effect of the construction on the building demand, we may want to modify this during the run, so the construction
|
||||
becomes changeable. This is important because those parameters that are static (unchangeable), must be provided for the
|
||||
initialization and don’t have setter, while the others are initialized at None and do have setter:
|
||||
|
||||
It is important to highlight that all setters and getters (@property) must have comments to describe the parameters, as shown in the previous image.
|
||||
|
||||
![new class getters and setters](./docs/img_contributing/img_4.png)
|
||||
|
||||
Once you finish doing your changes, you should commit and push them to your branch. The name of the new files will change from green to white.
|
||||
|
||||
## Documentation and authoring
|
||||
There can be two types of authors, that one who created the model and that one who coded it. If they are not the same person,
|
||||
in the headers of the classes must be just the name of the coder, who is the reference person to ask anything about the code,
|
||||
and the one in charge of maintaining it, and interacting with the git.
|
||||
|
||||
The author of the data model will appear in the official documentation of the Insel4Cities platform. In those documents,
|
||||
a larger explanation of the data model should be also added.
|
|
@ -4,29 +4,38 @@
|
|||
|
||||
Before sending your pull requests, make sure you completed this checklist:
|
||||
|
||||
- Read to the end [this document](CONTRIBUTING.md).
|
||||
- Read to the end [this document](CONTRIBUTING_EXTERNALS.md).
|
||||
- Read [Code of Conduct](CODE_OF_CONDUCT.md).
|
||||
- Check if your changes are consistent with the [Guidelines](CONTRIBUTING.md#user-content-general-guidelines-and-philosophy-for-contribution).
|
||||
- Check if your changes are consistent with the [Coding Style](CONTRIBUTING.md#user-content-coding-style).
|
||||
- Manually test your code and add [Unit Tests](CONTRIBUTING.md#user-content-testing-best-practices).
|
||||
- Check if your changes are consistent with the [Guidelines](CONTRIBUTING_EXTERNALS.md#user-content-general-guidelines-and-philosophy-for-contribution).
|
||||
- Check if your changes are consistent with the [Coding Style](CONTRIBUTING_EXTERNALS.md#user-content-coding-style).
|
||||
- Manually test your code and add [Unit Tests](CONTRIBUTING_EXTERNALS.md#user-content-testing-best-practices).
|
||||
- Be sure that you didn't brake anything by running all unit tests in folder unittests (right click on the folder and click on the green play).
|
||||
- [Document your work](CONTRIBUTING.md#user-content-documentation).
|
||||
- [Document your work](CONTRIBUTING_EXTERNALS.md#user-content-documentation).
|
||||
|
||||
## How to become a contributor and submit your own code
|
||||
|
||||
### Contributor License Agreements
|
||||
|
||||
CERC Libs is an [LGPL licensed](LICENSE.md) software, so even if we'd love to accept your patches, Before we can take them, please be sure that you are the intellectual property owner of your code and that do you fully understand and respect our software license.
|
||||
CERC Libs is an [LGPL licensed](LICENSE.md) software, so even if we'd love to accept your patches, before we can take them,
|
||||
please be sure that you are the intellectual property owner of your code and that do you fully understand and respect our software license.
|
||||
|
||||
***NOTE***: Only source code that you own will go into the main repository.
|
||||
|
||||
### Contributing code
|
||||
|
||||
If you have improvements to CERC Libs or want to extend the functionality, please send us your pull request as seen at [git pull request documentation](https://git-scm.com/docs/git-request-pull)
|
||||
If you made any changes in your own project, just push them to git. You are the owner, you are the manager.
|
||||
|
||||
To do so, first, commit your changes by clicking on the green check at the top-right corner of Pycharm. Add a comment that explains briefly your changes.
|
||||
Then, pull by clicking on the blue arrow to be sure that there are no conflicts between your version (local) and the one in gitlab (remote).
|
||||
Once the conflicts are solved and the merge in local is done, push the changes by clicking on the green arrow.
|
||||
|
||||
If you have improvements to CERC Libs or want to extend the functionality, please send us your pull request as seen at [git pull request documentation](https://git-scm.com/docs/git-request-pull).
|
||||
Or ASK GUILLE!!!!
|
||||
|
||||
Once the pull requests are approved and pass continuous integration checks, a team member will merge your changes on CERC Libs, and your code will become an integral part of Insel4D platform.
|
||||
|
||||
If you prefer to contribute, instead of adding new functionality, you can also take a look at our ticket system and try to fix any of the listed issues.
|
||||
??????????? SURE WE WANT THIS?
|
||||
|
||||
### Contribution guidelines and standards
|
||||
|
||||
|
@ -38,17 +47,17 @@ Before sending your pull request for review, make sure your changes are consiste
|
|||
* Prove that your code works correctly.
|
||||
* Guard against future breaking changes to lower the maintenance cost.
|
||||
|
||||
|
||||
* Bug fixes also generally require unit tests, because the presence of bugs usually indicates insufficient test coverage.
|
||||
* Keep backward compatibility in mind when you change code in CERC Libs, and if you need to broke the backward compatibility, please ensure that you:
|
||||
* Keep backward compatibility in mind when you change code in CERC Libs, and if you need to brake the backward compatibility, please ensure that you:
|
||||
* Clearly indicate which features are affected by your changes.
|
||||
* Technical reasons for the changes.
|
||||
??????????? SURE WE WANT THIS?
|
||||
|
||||
|
||||
* Tests should follow the
|
||||
[testing best practices](CONTRIBUTING.md#user-content-testing-best-practices)
|
||||
[testing best practices](CONTRIBUTING_EXTERNALS.md#user-content-testing-best-practices)
|
||||
guide.
|
||||
* [Document your contribution](CONTRIBUTING.md#user-content-documentation)
|
||||
* [Document your contribution](CONTRIBUTING_EXTERNALS.md#user-content-documentation)
|
||||
|
||||
#### License
|
||||
|
|
@ -17,4 +17,4 @@ Our aims are:
|
|||
* involve as many scientists and contributors as possible.
|
||||
* provide a complete set of classes that help scientists and students to model urban environments.
|
||||
|
||||
Please check the [contributing information](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) if you want to contribute, and let us know any new feature you may be of interest for you or your team.
|
||||
Please check the [contributing information](CONTRIBUTING_EXTERNALS.md) and [code of conduct](CODE_OF_CONDUCT.md) if you want to contribute, and let us know any new feature you may be of interest for you or your team.
|
||||
|
|
|
@ -13,17 +13,17 @@ Download the latest version of python and Microsoft c++ redistributable
|
|||
|
||||
3. Open PyCharm and click on **"Get from Version Control"**.
|
||||
|
||||
![pycharm welcome screen](./docs/img/img_0.png)
|
||||
![pycharm welcome screen](docs/img_windows_install/img_0.png)
|
||||
|
||||
You can find it also at VCS -> Get from Version Control...
|
||||
|
||||
![pycharm get from version control](./docs/img/img_6.png)
|
||||
![pycharm get from version control](docs/img_windows_install/img_6.png)
|
||||
|
||||
|
||||
4. Select Git as the version control, and set the URL to [libs repository](https://rs-loy-gitlab.concordia.ca/Guille/libs.git) as shown in the picture.
|
||||
At the website, copy the URL from Clone -> Clone with HTTPS.
|
||||
|
||||
![pycharm get from version control screen](./docs/img/img_1.png)
|
||||
![pycharm get from version control screen](docs/img_windows_install/img_1.png)
|
||||
|
||||
|
||||
You may need to install Git, by clicking at ***Download and install***.
|
||||
|
@ -32,25 +32,25 @@ If that message does not appear is because you have it already installed in your
|
|||
5. Click Clone to download CERC libs source code. You will end with a project like this:
|
||||
|
||||
|
||||
![pycharm project screen](./docs/img/img_2.png)
|
||||
![pycharm project screen](docs/img_windows_install/img_2.png)
|
||||
|
||||
6. Create your working branch by right clicking on the project folder (libs) -> Git -> Repository -> Branches:
|
||||
|
||||
![create new branch 1](./docs/img/img_9.png)
|
||||
![create new branch 1](docs/img_windows_install/img_9.png)
|
||||
|
||||
And then + New Branch:
|
||||
|
||||
![create new branch 2](./docs/img/img_10.png)
|
||||
![create new branch 2](docs/img_windows_install/img_10.png)
|
||||
|
||||
Give a name to your branch and open the tab Git at the down-left corner. Right click on your branch and push.
|
||||
|
||||
![push new branch 1](./docs/img/img_11.png)
|
||||
![push new branch 1](docs/img_windows_install/img_11.png)
|
||||
|
||||
![push new branch 2](./docs/img/img_12.png)
|
||||
![push new branch 2](docs/img_windows_install/img_12.png)
|
||||
|
||||
Check that your branch appears in the Remote list:
|
||||
|
||||
![check all set](./docs/img/img_13.png)
|
||||
![check all set](docs/img_windows_install/img_13.png)
|
||||
|
||||
If your branch is there, you are done with this part.
|
||||
|
||||
|
@ -59,30 +59,31 @@ If your branch is there, you are done with this part.
|
|||
We use two spaces as a tab instead of standard [pep8](https://www.python.org/dev/peps/pep-0008/) four spaces indentation.
|
||||
This option can be configured in PyCharm at the settings screen, as shown in the picture.
|
||||
|
||||
![pycharm configuration screen](./docs/img/img_5.png)
|
||||
![pycharm configuration screen](docs/img_windows_install/img_5.png)
|
||||
|
||||
|
||||
# Start your project.
|
||||
|
||||
1. At our Git (https://rs-loy-gitlab.concordia.ca/), click on New project:
|
||||
|
||||
![git new project screen](./docs/img/img_14.png)
|
||||
![git new project screen](docs/img_windows_install/img_14.png)
|
||||
|
||||
The create a black project with the desired name (remember to follow our ![Coding Style](PYGUIDE.md)).
|
||||
The create a black project with the desired name (remember to follow our ![Coding Style](PYGUIDE.md)).
|
||||
Be sure that Initialize repository with a README is selected, and ideally, that the Visibility Level is Public.
|
||||
|
||||
![git give a name](./docs/img/img_15.png)
|
||||
![git give a name](docs/img_windows_install/img_15.png)
|
||||
|
||||
And finally, clone it following the same steps as with ![libs](WINDOWS_INSTALL.md#get-the-code) (steps 3 to 5).
|
||||
And finally, clone it following the same steps as for ![libs](WINDOWS_INSTALL.md#get-the-code) (steps 3 to 5).
|
||||
|
||||
2. Go to project settings and add the libs project to your own, by clicking on Add Content Root:
|
||||
|
||||
![pycharm new project screen](./docs/img/img_4.png)
|
||||
![pycharm new project screen](docs/img_windows_install/img_4.png)
|
||||
|
||||
![pycharm add libs](./docs/img/img_7.png)
|
||||
![pycharm add libs](docs/img_windows_install/img_7.png)
|
||||
|
||||
3. Add your first file to your project and click on install requirements to automatically download all the dependencies (in blue at top-right corner).
|
||||
|
||||
![pycharm add dependencies](./docs/img/img_8.png)
|
||||
![pycharm add dependencies](docs/img_windows_install/img_8.png)
|
||||
|
||||
4. When all the dependencies are satisfied, you are all set to start importing your first city model.
|
||||
|
||||
|
@ -95,4 +96,7 @@ from imports.geometry_factory import GeometryFactory
|
|||
city = GeometryFactory('citygml', 'myfile.gml').city
|
||||
```
|
||||
|
||||
5. Always remember to push your own project changes as the last thing you do before ending your working day!
|
||||
5. Always remember to push your own project changes as the last thing you do before ending your working day!
|
||||
First, commit your changes by clicking on the green check at the top-right corner of Pycharm. Add a comment that explains briefly your changes.
|
||||
Then, pull by clicking on the blue arrow to be sure that there are no conflicts between your version (local) and the remote one (gitlab).
|
||||
Once the conflicts are solved and the merge in local is done, push the changes by clicking on the green arrow.
|
||||
|
|
|
@ -5,6 +5,7 @@ Copyright © 2022 Concordia CERC group
|
|||
Project Coder Atiya atiya.atiya@mail.concordia.ca
|
||||
"""
|
||||
|
||||
|
||||
class Machine:
|
||||
"""
|
||||
Machine class
|
||||
|
|
BIN
docs/img_contributing/img_0.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
docs/img_contributing/img_1.png
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
docs/img_contributing/img_2.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
docs/img_contributing/img_3.png
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
docs/img_contributing/img_4.png
Normal file
After Width: | Height: | Size: 172 KiB |
BIN
docs/img_contributing/img_5.png
Normal file
After Width: | Height: | Size: 176 KiB |
BIN
docs/img_contributing/img_6.png
Normal file
After Width: | Height: | Size: 179 KiB |
BIN
docs/img_contributing/img_7.png
Normal file
After Width: | Height: | Size: 126 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 159 KiB After Width: | Height: | Size: 159 KiB |