diff --git a/CONTRIBUTING_CENTRAL_DATA_MODEL.md b/CONTRIBUTING_CENTRAL_DATA_MODEL.md new file mode 100644 index 00000000..26ced7dc --- /dev/null +++ b/CONTRIBUTING_CENTRAL_DATA_MODEL.md @@ -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. diff --git a/CONTRIBUTING.md b/CONTRIBUTING_EXTERNALS.md similarity index 86% rename from CONTRIBUTING.md rename to CONTRIBUTING_EXTERNALS.md index a60de02d..782ff21d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING_EXTERNALS.md @@ -4,13 +4,13 @@ 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 @@ -29,11 +29,13 @@ To do so, first, commit your changes by clicking on the green check at the top-r 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 click on +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 @@ -45,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 diff --git a/README.md b/README.md index c0ffed09..dbe3ae69 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/WINDOWS_INSTALL.md b/WINDOWS_INSTALL.md index 992b35c2..7e7ef3ac 100644 --- a/WINDOWS_INSTALL.md +++ b/WINDOWS_INSTALL.md @@ -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,31 +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)). 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 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. diff --git a/city_model_structure/machine.py b/city_model_structure/machine.py index 491a8e72..e06583ca 100644 --- a/city_model_structure/machine.py +++ b/city_model_structure/machine.py @@ -5,6 +5,7 @@ Copyright © 2022 Concordia CERC group Project Coder Atiya atiya.atiya@mail.concordia.ca """ + class Machine: """ Machine class diff --git a/docs/img_contributing/img_0.png b/docs/img_contributing/img_0.png new file mode 100644 index 00000000..fc270698 Binary files /dev/null and b/docs/img_contributing/img_0.png differ diff --git a/docs/img_contributing/img_1.png b/docs/img_contributing/img_1.png new file mode 100644 index 00000000..95a56f81 Binary files /dev/null and b/docs/img_contributing/img_1.png differ diff --git a/docs/img_contributing/img_2.png b/docs/img_contributing/img_2.png new file mode 100644 index 00000000..b9975ed4 Binary files /dev/null and b/docs/img_contributing/img_2.png differ diff --git a/docs/img_contributing/img_3.png b/docs/img_contributing/img_3.png new file mode 100644 index 00000000..896484a5 Binary files /dev/null and b/docs/img_contributing/img_3.png differ diff --git a/docs/img_contributing/img_4.png b/docs/img_contributing/img_4.png new file mode 100644 index 00000000..34c327d9 Binary files /dev/null and b/docs/img_contributing/img_4.png differ diff --git a/docs/img_contributing/img_5.png b/docs/img_contributing/img_5.png new file mode 100644 index 00000000..892ad668 Binary files /dev/null and b/docs/img_contributing/img_5.png differ diff --git a/docs/img_contributing/img_6.png b/docs/img_contributing/img_6.png new file mode 100644 index 00000000..61c664a8 Binary files /dev/null and b/docs/img_contributing/img_6.png differ diff --git a/docs/img_contributing/img_7.png b/docs/img_contributing/img_7.png new file mode 100644 index 00000000..3a834efb Binary files /dev/null and b/docs/img_contributing/img_7.png differ diff --git a/docs/img/img_0.png b/docs/img_windows_install/img_0.png similarity index 100% rename from docs/img/img_0.png rename to docs/img_windows_install/img_0.png diff --git a/docs/img/img_1.png b/docs/img_windows_install/img_1.png similarity index 100% rename from docs/img/img_1.png rename to docs/img_windows_install/img_1.png diff --git a/docs/img/img_10.png b/docs/img_windows_install/img_10.png similarity index 100% rename from docs/img/img_10.png rename to docs/img_windows_install/img_10.png diff --git a/docs/img/img_11.png b/docs/img_windows_install/img_11.png similarity index 100% rename from docs/img/img_11.png rename to docs/img_windows_install/img_11.png diff --git a/docs/img/img_12.png b/docs/img_windows_install/img_12.png similarity index 100% rename from docs/img/img_12.png rename to docs/img_windows_install/img_12.png diff --git a/docs/img/img_13.png b/docs/img_windows_install/img_13.png similarity index 100% rename from docs/img/img_13.png rename to docs/img_windows_install/img_13.png diff --git a/docs/img/img_14.png b/docs/img_windows_install/img_14.png similarity index 100% rename from docs/img/img_14.png rename to docs/img_windows_install/img_14.png diff --git a/docs/img/img_15.png b/docs/img_windows_install/img_15.png similarity index 100% rename from docs/img/img_15.png rename to docs/img_windows_install/img_15.png diff --git a/docs/img/img_16.png b/docs/img_windows_install/img_16.png similarity index 100% rename from docs/img/img_16.png rename to docs/img_windows_install/img_16.png diff --git a/docs/img/img_2.png b/docs/img_windows_install/img_2.png similarity index 100% rename from docs/img/img_2.png rename to docs/img_windows_install/img_2.png diff --git a/docs/img/img_3.png b/docs/img_windows_install/img_3.png similarity index 100% rename from docs/img/img_3.png rename to docs/img_windows_install/img_3.png diff --git a/docs/img/img_4.png b/docs/img_windows_install/img_4.png similarity index 100% rename from docs/img/img_4.png rename to docs/img_windows_install/img_4.png diff --git a/docs/img/img_5.png b/docs/img_windows_install/img_5.png similarity index 100% rename from docs/img/img_5.png rename to docs/img_windows_install/img_5.png diff --git a/docs/img/img_6.png b/docs/img_windows_install/img_6.png similarity index 100% rename from docs/img/img_6.png rename to docs/img_windows_install/img_6.png diff --git a/docs/img/img_7.png b/docs/img_windows_install/img_7.png similarity index 100% rename from docs/img/img_7.png rename to docs/img_windows_install/img_7.png diff --git a/docs/img/img_8.png b/docs/img_windows_install/img_8.png similarity index 100% rename from docs/img/img_8.png rename to docs/img_windows_install/img_8.png diff --git a/docs/img/img_9.png b/docs/img_windows_install/img_9.png similarity index 100% rename from docs/img/img_9.png rename to docs/img_windows_install/img_9.png