Metadata-Version: 2.1
Name: cjdb
Version: 0.0.8
Summary: CJDB is a set of tools enabling CityJSON integration with a PostgreSQL database
Home-page: https://github.com/leoleonsio/cjdb
Author: Cynthia Cai, Lan Yan, Yitong Xia, Chris Poon, Siebren Meines, Leon Powalka
License: MIT
Keywords: CityJSON,PostgreSQL
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aniso8601 (==9.0.1)
Requires-Dist: flask (==2.2.2)
Requires-Dist: flask-marshmallow (==0.14.0)
Requires-Dist: flask-restful (==0.3.9)
Requires-Dist: flask-sqlalchemy (==3.0.2)
Requires-Dist: geoalchemy2 (==0.12.5)
Requires-Dist: lark (==0.12.0)
Requires-Dist: marshmallow (==3.18.0)
Requires-Dist: marshmallow-sqlalchemy (==0.28.1)
Requires-Dist: numpy (==1.23.4)
Requires-Dist: psycopg2-binary (==2.9.5)
Requires-Dist: pygeofilter[backend-sqlalchemy] (==0.2.0)
Requires-Dist: pygeoif (==0.7)
Requires-Dist: pyproj (==3.4.0)
Requires-Dist: python-dotenv (==0.21.0)
Requires-Dist: pytz (==2022.6)
Requires-Dist: requests (==2.28.1)
Requires-Dist: shapely (==1.8.5.post1)
Requires-Dist: charset-normalizer (==2.1.1) ; python_full_version >= "3.6.0"
Requires-Dist: pyparsing (==3.0.9) ; python_full_version >= "3.6.8"
Requires-Dist: importlib-metadata (==5.0.0) ; python_version < "3.10"
Requires-Dist: backports.zoneinfo (==0.2.1) ; python_version < "3.9"
Requires-Dist: python-dateutil (==2.8.2) ; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3"
Requires-Dist: six (==1.16.0) ; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3"
Requires-Dist: pytz-deprecation-shim (==0.1.0.post0) ; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3, 3.4, 3.5"
Requires-Dist: sqlalchemy (==1.4.43) ; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3, 3.4, 3.5"
Requires-Dist: urllib3 (==1.26.12) ; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3, 3.4, 3.5" and python_version < "4"
Requires-Dist: greenlet (==2.0.1) ; python_version >= "3" and platform_machine == "aarch64" or (platform_machine == "ppc64le" or (platform_machine == "x86_64" or (platform_machine == "amd64" or (platform_machine == "AMD64" or (platform_machine == "win32" or platform_machine == "WIN32")))))
Requires-Dist: dateparser (==1.1.3) ; python_version >= "3.5"
Requires-Dist: idna (==3.4) ; python_version >= "3.5"
Requires-Dist: certifi (==2022.9.24) ; python_version >= "3.6"
Requires-Dist: packaging (==21.3) ; python_version >= "3.6"
Requires-Dist: regex (==2022.3.2) ; python_version >= "3.6"
Requires-Dist: tzdata (==2022.6) ; python_version >= "3.6"
Requires-Dist: tzlocal (==4.2) ; python_version >= "3.6"
Requires-Dist: click (==8.1.3) ; python_version >= "3.7"
Requires-Dist: itsdangerous (==2.1.2) ; python_version >= "3.7"
Requires-Dist: jinja2 (==3.1.2) ; python_version >= "3.7"
Requires-Dist: markupsafe (==2.1.1) ; python_version >= "3.7"
Requires-Dist: werkzeug (==2.2.2) ; python_version >= "3.7"
Requires-Dist: zipp (==3.10.0) ; python_version >= "3.7"

# cjdb
![MIT badge](https://img.shields.io/pypi/l/cjdb) &nbsp; ![PyPI](https://img.shields.io/pypi/v/cjdb)

CJDB is a set of tools enabling CityJSON integration with a PostgreSQL database.

Authors: Cynthia Cai, Lan Yan, Yitong Xia, Chris Poon, Siebren Meines, Leon Powalka

### cj2pgsql
See [cj2pgsql/README.md](cj2pgsql/README.md)
### cjdb_api
See [cjdb_api/README.md](cjdb_api/README.md)


## Table of Contents  
### [1. Data model](#model)
### [2. Installation & running](#install)
### [3. Local development](#local)
### [4. Local CLI development](#cli)
---
## 1. Data model <a name="model"></a>
For the underlying data model see [model/README.md](model/README.md)

Based on this model, there are 2 software components available:

### cj2pgsql
See [cj2pgsql/README.md](cj2pgsql/README.md)
### cjdb_api
See [cjdb_api/README.md](cjdb_api/README.md)


## 2. Installation & running <a name="install"></a>
### Using pip

```
pip install cjdb
```
It is recommended to install it in an isolated environment, because of fragile external library dependencies for CQL filter parsing.

### Using the repository code
Another option is to clone the repository and build the CLI from the code.
From repository root, run:
```
python3 -m build
```

Install the .whl file with pip:
```
pip3 install dist/*.whl
```

### Using docker
Build:
```
docker build -t cjdb:latest .
```

Run: **cj2pgsql**
```
docker run --rm -it cjdb cj2pgsql --help
```

To import some files, the `-v` option is needed to mount our local file directory in the container.
```
docker run -v {MYDIRECTORY}:/data --rm -it --network=host cjdb cj2pgsql -H localhost -U postgres -d postgres -W postgres /data/5870_ext.jsonl 
```

Run: **cjdb_api**
```
docker run --rm -it --network host cjdb cjdb_api --help
```



For instructions on running the software check specific READMEs.


## 3. Local development <a name="local"></a>
Make sure pipenv is installed:
```
pip install pipenv
```
Create the environment:
```
pipenv install
```

## 4. Local CLI development <a name="cli"></a>
---
To build the CLI app (so that it can be called as a command line tool from anywhere):


1. Sync the pipenv requirements with the setup.py file:
```
pipenv run pipenv-setup sync
```

2. Create a venv just for testing the CLI build.

**Note**: This is not the pipenv/development environment.
```
virtualenv venv
```
3. Activate environment (note: this is not the pipenv environment. This is a separate environment just to test the CLI build)
```
. venv/bin/activate

```

4. Build the CLI:
```
python setup.py develop
```

5. The cj2pgsql importer should now work as a command inside this environment:
```
cj2pgsql --help
```
