Skip to content

Commit

Permalink
Merge pull request #11 from CIAT-DAPA/develop
Browse files Browse the repository at this point in the history
EWP-86 added the description for each models in the readme
  • Loading branch information
CarlosNasayo authored Jul 19, 2023
2 parents eeb02bb + 37c3c7a commit 4f195ad
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 16 deletions.
129 changes: 129 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,132 @@
# EWP Models

![GitHub release (latest by date)](https://img.shields.io/github/v/release/CIAT-DAPA/lswms_models) ![](https://img.shields.io/github/v/tag/CIAT-DAPA/lswms_models)

## Features

- Built using Mongoengine for MongoDB
- Supports Python 3.x

## Getting Started

To use this Models, it is necessary to have an instance of MongoDB running.

### Prerequisites

- Python 3.x
- MongoDB

## Usage

This ORM can be used as a library in other Python projects. The models are located in the my_orm/models folder, and can be imported like any other Python module. To install this orm as a library you need to execute the following command:

````bash
pip install git+https://github.com/CIAT-DAPA/lswms_models
````

If you want to download a specific version of orm you can do so by indicating the version tag (@v0.0.0) at the end of the install command

````bash
pip install git+https://github.com/CIAT-DAPA/lswms_models@v0.2.0
````

## Models

### Adm1

Represents a Adm1 (Zone) in the database.

Attributes:

- name: `str` Name of the Adm1(Zone).
- ext_id: `str` external id from the Adm1(Zone). Mandatory.
- traced: `array` array with created time, updated and a status from the Adm1(Zone). Mandatory.

### Adm2

Represents a Adm2 (Woreda) in the database.

Attributes:

- name: `str` Name of the Adm2(Woreda).
- ext_id: `str` external id from the Adm2(Woreda). Mandatory.
- traced: `array` array with created time, updated and a status from the Adm2(Woreda). Mandatory.
- adm1: `ObjectId` Adm1 Reference id (zone). Mandatory.

### Adm3

Represents a Adm3 (Kebele) in the database.

Attributes:

- name: `str` Name of the Adm3(Kebele).
- ext_id: `str` external id from the Adm3(Kebele). Mandatory.
- traced: `array` array with created time, updated and a status from the Adm3(Kebele). Mandatory.
- adm2: `ObjectId` Adm2 Reference id (woreda). Mandatory.


### watershed

Represents a watershed in the database.

Attributes:

- name: `str` Name of the watershed. Mandatory.
- area: `float` Area of the watershed. Mandatory.
- traced: `array` array with created time, updated and a status from the watershed. Mandatory.
- adm3: `ObjectId` Adm3 Reference id (kebele). Mandatory.


### waterpoint

Represents an waterpoint in the database.

Attributes:

- name: `str` Name of the waterpoint. Mandatory.
- lat: `float` Latitude of the geographical location where the water point is located. Mandatory.
- lon: `float` Longitude of the geographical location where the water point is located. Mandatory.
- area: `float` Area of the waterpoint. Mandatory.
- traced: `array` array with created time, updated and a status from the waterpoint. Mandatory.
- ext_id: `str` External identifier for the waterpoint.Mandatory.
- other_attributes: `array` Additional attributes of the waterpoint. Optional.
- climatology: `array` Array with the historical data for the waterpoint. Mandatory.
- watershed: `ObjectId` Watershed Reference id. Mandatory.

### monitored

Represents an the monitored values from waterpoint in the database.

Attributes:

- date: `datetime` Date from the historical data. Mandatory.
- values: `array` Values of the monitored values. Mandatory.
- waterpoint: `ObjectId` Waterpoint Reference id. Mandatory.

### type_content

Represents an type of content in the database.

Attributes:

- name: `str` Name of the type of content. Mandatory.

### wp_content

Represents an waterpoint content in the database.

Attributes:

- content: `array` Array with the diferent content of the waterpoint. Mandatory.
- waterpoint: `ObjectId` Waterpoint Reference id. Mandatory.
- type: `ObjectId` type_content Reference id. Mandatory.

### ws_content

Represents an watershed content in the database.

Attributes:

- content: `array` Array with the diferent content of the waterpoint. Mandatory.
- watershed: `ObjectId` Watershed Reference id. Mandatory.
- type: `ObjectId` type_content Reference id. Mandatory.
6 changes: 3 additions & 3 deletions src/ormWP/models/monitored.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class Monitored(Document):

"""
Represents a watershed in the database.
Represents a monitored data in the database.
Attributes:
----------
Expand All @@ -18,9 +18,9 @@ class Monitored(Document):
Methods:
-------
save()
Saves the Group object to the database.
Saves the monitored object to the database.
delete()
Deletes the Group object from the database.
Deletes the monitored object from the database.
"""

meta = {
Expand Down
6 changes: 3 additions & 3 deletions src/ormWP/models/type_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class Typecontent(Document):

"""
Represents the tipe of content.
Represents the type of content.
Attributes:
----------
Expand All @@ -14,9 +14,9 @@ class Typecontent(Document):
Methods:
-------
save()
Saves the Group object to the database.
Saves the Type object to the database.
delete()
Deletes the Group object from the database.
Deletes the Type object from the database.
"""

meta = {
Expand Down
6 changes: 3 additions & 3 deletions src/ormWP/models/waterpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class Waterpoint(Document):

"""
Represents a watershed in the database.
Represents a waterpoint in the database.
Attributes:
----------
Expand All @@ -26,9 +26,9 @@ class Waterpoint(Document):
Methods:
-------
save()
Saves the Group object to the database.
Saves the waterpoint object to the database.
delete()
Deletes the Group object from the database.
Deletes the waterpoint object from the database.
"""

meta = {
Expand Down
6 changes: 3 additions & 3 deletions src/ormWP/models/watershed.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Watershed(Document):
name: str
Name of the watershed.
area: float
Crop object that the group belongs to. Mandatory.
Crop object that the watershed belongs to. Mandatory.
adm3: Adm3
Adm3 reference.
traced: array
Expand All @@ -20,9 +20,9 @@ class Watershed(Document):
Methods:
-------
save()
Saves the Group object to the database.
Saves the watershed object to the database.
delete()
Deletes the Group object from the database.
Deletes the watershed object from the database.
"""

meta = {
Expand Down
4 changes: 2 additions & 2 deletions src/ormWP/models/wp_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class Wpcontent(Document):
Methods:
-------
save()
Saves the Group object to the database.
Saves the waterpointcontent object to the database.
delete()
Deletes the Group object from the database.
Deletes the waterpointcontent object from the database.
"""

meta = {
Expand Down
4 changes: 2 additions & 2 deletions src/ormWP/models/ws_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class Wscontent(Document):
Methods:
-------
save()
Saves the Group object to the database.
Saves the watershedcontent object to the database.
delete()
Deletes the Group object from the database.
Deletes the watershedcontent object from the database.
"""

meta = {
Expand Down

0 comments on commit 4f195ad

Please sign in to comment.