Skip to content

Commit

Permalink
feat: basic logic converting csv into db (MAPCO-3357) (#1)
Browse files Browse the repository at this point in the history
* feat: basic logic converting csv into db

* feat: add classification matching + product adaptation

* chore: refactor folder structure

* fix: adding empty lines

* docs: pr notes + logging + documentation

* fix: ignore config

* feat: adding more data validations + refactoring

* chore: adding .licrc
  • Loading branch information
ronenkapelian authored Sep 20, 2023
1 parent 01542c3 commit 57e9a9c
Show file tree
Hide file tree
Showing 10 changed files with 1,328 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# config
config/local.json
19 changes: 19 additions & 0 deletions .licrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[licenses]
# This indicates which are the only licenses that Licensebat will accept.
# The rest will be flagged as not allowed.
#accepted = ["MIT", "MSC", "BSD"]
# This will indicate which licenses are not accepted.
# The rest will be accepted, except for the unknown licenses or dependencies without licenses.
unaccepted = ["LGPL"]
# Note that only one of the previous options can be enabled at once.
# If both of them are informed, only accepted will be considered.

[dependencies]
# This will allow users to flag some dependencies so that Licensebat will not check for their license.
ignored=["ignored_dep1", "ignored_dep2"]

[behavior]
# False by default, if true, it will only run the checks when one of the dependency files or the .licrc file has been modified.
run_only_on_dependency_modification = true
# False by default, if true, it will never block the build.
do_not_block_pr = true
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# polygon-parts-cli
This basic CLI insert static csv data into PolygonParts DB


## Prerequisites
1. Node.js
2. Suitable csv data file as will be explained on next section

<br/>

## CSV structure
| Field | What is it | Mandatory | possible values\examples |
| :---: | :---: | :---: | :---: |
| WKT | geometry of feature, may be MultiPolygon or Polygon | + | |
| recordId | Catalog ID of original layer | + | will be UUID |
| productId | Name of Parts source | - | |
| classification | Level of classification provided | + | unclassified(6), confidential(5), secret(4), topSecret(3) |
| productType | discrete type | + | Orthophoto, OrthophotoHistory, OrthophotoBest, RasterMap, RasterMapBest, RasterAid, RasterAidBest, RasterVector, RasterVectorBest|
| srsName | On default epsg:4326 | - <br/> (Not in use) | GCS_WGS_1984 |
| description | free text of information | - | |
| imageName | original image name | - | |
| minHorizontalAccuracyCE90 | | - | number |
| maxResolutionMeter | used for min also | - | float |
| sensors | list of sensor name | - | OGEN_CHAD, WORLDVIEW2|
| productName | internal name of material | - | |
| sourceDateEnd | will be used also for "start" | + | dd/mm/yyyy hh:mm:ss|
| maxResolutionDeg | used for min also | - | float |

<br/>

## Installation
Run the following command:
```
npm i
```

<br/>


## Usage
Run the following command:
```
node src/index.js -i path/to/data.csv
```
18 changes: 18 additions & 0 deletions config/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"pgConfig":{
"host": "localhost",
"port": 5432,
"database": "raster-dev",
"user": "postgres",
"password": "postgres",
"scheme": "PoylgonParts",
"table": "parts",
"sslEnabled": false,
"rejectUnauthorized": false,
"sslPaths": {
"ca": "",
"key": "",
"cert": ""
}
}
}
Loading

0 comments on commit 57e9a9c

Please sign in to comment.