Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024 05 datamodel #1

Merged
merged 79 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
a3ee8b3
create setup.sh - first draft
sjib Apr 5, 2024
72e7ca3
add tests folder and readme
sjib Apr 5, 2024
b5357dc
Create _init_.py
sjib Apr 5, 2024
db4a7b0
Create util.py
sjib Apr 5, 2024
8bc94a8
Create requirements.txt
sjib Apr 5, 2024
84c1fa4
Create _init_.py
sjib Apr 5, 2024
cf23862
requirements-tests.txt and schemaspy.properties
sjib Apr 5, 2024
bb00b5d
oid_generation.sql
sjib Apr 5, 2024
8fd779d
create 01_schema.sql
sjib Apr 5, 2024
ffb36af
Create 02_sys.sql
sjib Apr 5, 2024
71bc9fd
adaptions setup.sh
sjib May 3, 2024
dd53f41
rename oid_generation.sql
sjib May 3, 2024
2a38a55
adapt setup.sh
sjib May 3, 2024
e7e336b
add dependabot.yml
sjib May 6, 2024
fbb573e
add datamodel-create-dumps.yml
sjib May 6, 2024
c317e40
add datamodel-test.yml
sjib May 6, 2024
271cf16
Add docs-builder.yml
sjib May 6, 2024
61a356d
add plugin-package.yml
sjib May 6, 2024
6dafd11
Add plugin-test.yml and test data
sjib May 6, 2024
698bfdc
Update minimal dataset and project-translation.yml
sjib May 6, 2024
317c1f6
requirements
sjib May 6, 2024
173f2ab
datamodel .docker configuration
sjib May 6, 2024
9ba8f3f
add create_app.py
sjib May 6, 2024
26fab59
add tww_app_roles.sql
sjib May 6, 2024
7c04816
add organisation_functions.sql
sjib May 6, 2024
b0f1db3
Adapt setup.sh
sjib May 6, 2024
e297821
Add change_owner.sh
sjib May 6, 2024
49d66da
Add create-dumps.py
sjib May 6, 2024
24ab60f
Add run-docker.sh
sjib May 6, 2024
7797062
Update README.md
sjib May 6, 2024
16213f7
Update utils.py
sjib May 6, 2024
6f196c7
Add static_tests.sh
sjib May 6, 2024
499e23e
Add test_geometry.py
sjib May 6, 2024
b64e558
Add test_schemas.py
sjib May 6, 2024
24d0529
Add update files py
sjib May 6, 2024
e054584
Add config files for project file
sjib May 6, 2024
e5f25bb
Add trench_point
sjib May 6, 2024
f70c5fc
Update datammodel - srid variable
sjib May 6, 2024
849c966
09_tdh_dictionaries.sql
sjib May 6, 2024
32ecd81
Add various config files
sjib May 7, 2024
a1f813c
correct directory name - test instead of tests
sjib May 8, 2024
0df4769
plugin docker and scripts
sjib May 8, 2024
68e40a3
banned-words.sh added
sjib May 8, 2024
b186a3e
fix .env.example - TDH_PG_PORT=5432
sjib May 8, 2024
980e1e5
replace teksi_wastewater with teksi_distance_heating or tww by tdh
sjib May 8, 2024
ca49c7b
rename tww_app_roles.sql to tdh_app_roles.sql
sjib May 8, 2024
9fe0abd
Debug Testdaten FERNWAERME.xtf
sjib May 8, 2024
a90dc87
Add ilivalidator log
sjib May 8, 2024
74eef7c
Relations and fk_ to not yet existings classe commented out
sjib May 15, 2024
3478d40
Move to district_heating
ponceta May 15, 2024
e85dab5
Merge branch 'main' into 2024-05-datamodel
ponceta May 15, 2024
414623d
Avoid underscores in docker images names and tags
ponceta May 15, 2024
a064651
Revert to district_heating since it has no impact on docker
ponceta May 15, 2024
c48c7f2
readme
ponceta May 15, 2024
d4c3f02
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 15, 2024
5d88048
delete - wrong content
sjib May 17, 2024
507a1e4
new 09_tdh_dictionaries.sql
sjib May 17, 2024
ee8f2f1
09_tdh_control_cable_dictionaries
sjib May 17, 2024
e5c1b92
add 09_tdh_control_cable_dictionaries to setup
sjib May 17, 2024
0252cea
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 17, 2024
ecaab5c
adapt 03_tdh_db_sia405.sql geometries & status
sjib May 21, 2024
8ff99f8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 21, 2024
872104e
New 09_tdh_organisation_dictionaries,sql
sjib May 21, 2024
95b41e7
update setup.sh with 09_tdh_organisation_dictionaries.sql
sjib May 21, 2024
8ef2493
Update setup.sh
sjib May 21, 2024
b4f48d7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 21, 2024
254f6ac
Update 09_tdh_organisation_dictionaries.sql
jpdupuy May 22, 2024
cd6ec39
Update 09_tdh_organisation_dictionaries.sql
jpdupuy May 22, 2024
c28066d
add additional relations to organisation, skip text attributes / corr…
sjib May 23, 2024
b5f7714
fix typo geometry3d3d_geometry
sjib May 24, 2024
5d6fe89
Add empty line to better read code
sjib May 24, 2024
19a7f63
adapt docs-builder.yml
sjib May 24, 2024
f4d6a26
Add 00_extensions.sql
sjib May 24, 2024
8b7a315
add linebreak
sjib May 24, 2024
43f8565
add structure_line / trench_line tables and relations
sjib May 24, 2024
9e78787
add views / add last_modification in _line tables
sjib May 25, 2024
45b465f
03_tdh_control_cable_db_sia405.sql - POINTZ instead of POINT
sjib May 25, 2024
9c3f86c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 27, 2024
0314e71
Update cc dictionaries - order of entries and geometry3d
sjib May 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copy this file to .env
# ----------------------
# Define POSTGRES PORT for Docker when calling datamodel/scripts/run-docker.sh
TDH_PG_PORT=5432

QGIS_TEST_VERSION

POSTGIS_IMAGE=postgis/postgis:14-3.4

# fix access rights for schemaspy
UID=1000
GID=1001
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: monthly

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
2 changes: 1 addition & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Here come all GitHub CI actions workflows
Here come all GitHub CI actions workflows
57 changes: 57 additions & 0 deletions .github/workflows/datamodel-create-dumps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 📦 Datamodel | Create dumps

concurrency:
group: dumps-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- datamodel/**
- '.github/workflows/datamodel-create-dumps.yml'
workflow_dispatch:
workflow_call:


jobs:
datamodel-dumps:
name: Create dumps and schemaspy of datamodel
runs-on: ubuntu-latest
env:
COMPOSE_PROFILES: schemaspy

steps:
- uses: actions/checkout@v4

- name: Docker build
run: docker compose up -d --build

- name: Initialize container
run: docker compose exec db init_db.sh wait

- name: Create dumps
run: docker compose exec db /src/datamodel/scripts/create-dumps.py

- name: Schemaspy
run: docker compose run schemaspy

- name: Docker logs
if: failure()
run: docker compose logs db

- uses: actions/upload-artifact@v4
with:
name: datamodel-dumps
path: datamodel/artifacts/
if-no-files-found: error

- uses: actions/upload-artifact@v4
with:
name: datamodel-schemaspy
path: datamodel/schemaspy/
if-no-files-found: error
10 changes: 5 additions & 5 deletions .github/workflows/datamodel-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ jobs:
--build-arg RUN_TEST=True \
--build-arg PSYCOPG_VERSION=${{ matrix.psycopg-version }} \
-f datamodel/.docker/Dockerfile \
--tag teksi/distance_heating:unstable .
--tag teksi/district_heating:unstable .

- name: Initialize container
run: |
docker run -d -p 5432:5432 --name teksi-distance_heating teksi/distance_heating:unstable
docker exec teksi-distance_heating init_db.sh wait
docker run -d -p 5432:5432 --name teksi-district_heating teksi/district_heating:unstable
docker exec teksi-district_heating init_db.sh wait

- name: Run tests
run: docker exec teksi-distance_heating pytest datamodel
run: docker exec teksi-district_heating pytest datamodel

- name: Docker logs
if: failure()
run: docker logs teksi-distance_heating
run: docker logs teksi-district_heating

static-tests:
name: Run static tests on datamodel
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/docs-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: 📚 Documentation builder

concurrency:
group: docs-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
push:
branches:
- main
paths:
- docs/**
- '.github/workflows/docs-builder.yml'
pull_request:
branches:
- main
paths:
- docs/**
- '.github/workflows/docs-builder.yml'
workflow_dispatch:


jobs:
datamodel-documentation:
uses: ./.github/workflows/datamodel-create-dumps.yml

build:
needs: datamodel-documentation
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: install requirements
working-directory: docs
run: |
pip install -r requirements.txt
sudo apt-get install -y gettext
curl -OL https://github.com/transifex/cli/releases/download/v1.6.10/tx-linux-amd64.tar.gz
tar -xvzf tx-linux-amd64.tar.gz
make gettext

- name: tx pull
if: ${{ github.event.pull_request.head.repo.full_name == 'teksi/district_heating' }}
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
working-directory: docs
run: make transifex_pull

- name: tx push
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
working-directory: docs
run: make transifex_sync

- name: copy datamodel documentation
uses: actions/download-artifact@v4
with:
name: datamodel-schemaspy
path: docs/_static/datamodel

- name: build documentation
working-directory: docs
run: |
make html
touch build/html/.nojekyll

- uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/build/html
if-no-files-found: error

- name: Deploy 🚀
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/build/html
64 changes: 64 additions & 0 deletions .github/workflows/plugin-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 🔌 Plugin | Package and release

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- plugin/**
- '.github/workflows/datamodel-create-dumps.yml'
workflow_dispatch:


jobs:
plugin-package:
name: Packages and releases plugin
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install Qt lrelease
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev qttools5-dev-tools

- name: Install qgis-plugin-ci
run: pip install qgis-plugin-ci>=2.8.6

- name: 🌍 Push translations
if: ${{ github.event_name == 'push' }}
run: qgis-plugin-ci push-translation ${{ secrets.TX_TOKEN }}

- name: Package PyPI Packages
run: ./plugin/scripts/package-pip-packages.sh

- name: Download Interlis libs
run: ./plugin/scripts/download-interlis-libs.sh

- name: Package
run: |
VERSION=0.0.0
qgis-plugin-ci -v package ${VERSION} \
--allow-uncommitted-changes \
--asset-path plugin/teksi_district_heating/libs \
--asset-path plugin/teksi_district_heating/interlis/bin \
--transifex-token "${{ secrets.TX_TOKEN }}"

- uses: actions/upload-artifact@v4
with:
name: teksi_district_heating_plugin_dev
path: plugin/teksi_district_heating.0.0.0.zip
if-no-files-found: error
69 changes: 69 additions & 0 deletions .github/workflows/plugin-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: 🪲 Plugin | Tests

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
push:
branches:
- main
paths:
- datamodel/**
- plugin/**
- '.github/workflows/plugin-test.yml'
pull_request:
branches:
- main
paths:
- datamodel/**
- plugin/**
- '.github/workflows/plugin-test.yml'
workflow_dispatch:


jobs:
plugin-tests:
name: Run unit tests on plugin
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
qgis_version: [3.34-jammy, latest]
env:
QGIS_TEST_VERSION: ${{ matrix.qgis_version }}
COMPOSE_PROFILES: qgis

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup env
run: cp .env.example .env

- name: Package PyPI Packages
run: sudo ./plugin/scripts/package-pip-packages.sh

- name: Download Interlis libs
run: sudo ./plugin/scripts/download-interlis-libs.sh

- name: Docker build
run: docker compose --profile qgis up -d --build

- name: Test on QGIS
run: docker-compose run qgis /usr/src/plugin/.docker/run-docker-tests.sh

- name: Test command line import orgs
run: docker-compose run qgis sh -c 'xvfb-run /usr/src/plugin/tdh_cmd.py interlis_import --xtf_file /usr/src/plugin/teksi_district_heating/tests/data/minimal-dataset-organisation-arbon-only.xtf --pghost db --pgdatabase tdh --pguser postgres --pgpass postgres --pgport 5432'

- name: Test command line import minimal sia405 Distance heating
run: docker-compose run qgis sh -c 'xvfb-run /usr/src/plugin/tdh_cmd.py interlis_import --xtf_file /usr/src/plugin/teksi_district_heating/tests/data/minimal-dataset-SIA405-FERNWAERME.xtf --pghost db --pgdatabase tdh --pguser postgres --pgpass postgres --pgport 5432'

- name: Test command line minimal export
run: docker-compose run qgis sh -c 'xvfb-run /usr/src/plugin/tdh_cmd.py interlis_export --xtf_file "output.xtf" --pghost db --pgdatabase tdh --pguser postgres --pgpass postgres --pgport 5432'

- name: docker logs
#if: failure()
run: docker compose logs db
58 changes: 58 additions & 0 deletions .github/workflows/project-translation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: 🌎 Update project translations

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
push:
branches:
- main
paths:
- project/**
- '.github/workflows/project-translation.yml'
workflow_dispatch:


jobs:
build:
name: Update project translations
runs-on: ubuntu-latest

env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
COMPOSE_PROFILES: qgis

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Transifex
working-directory: project
run: |
curl -OL https://github.com/transifex/cli/releases/download/v1.6.10/tx-linux-amd64.tar.gz
tar -xvzf tx-linux-amd64.tar.gz

- name: Start Docker compose
run: |
docker compose up --build -d
docker compose exec db init_db.sh wait

- name: Translate (create sources)
run: docker compose run qgis sh -c 'xvfb-run /usr/src/project/scripts/project-translation-create-source.py /usr/src/project/teksi_district_heating.qgs'

- name: Push to TX
working-directory: project
run: ./tx push --source

- name: Compile Translations (fetch translated content)
working-directory: project
run: |
./tx pull -a
docker compose run qgis sh -c '/usr/src/project/scripts/project-translation-compile.sh /usr/src/project/teksi_district_heating.qgs'

- uses: actions/upload-artifact@v4
with:
name: project-translations
path: project/teksi_district_heating*
if-no-files-found: error
Loading
Loading