Skip to content

Commit

Permalink
final fix of doc refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
vvmruder committed Oct 30, 2023
1 parent ee7612d commit 7ae6813
Show file tree
Hide file tree
Showing 19 changed files with 166 additions and 362 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ __pycache__/
/doc/source/contrib/print_proxy.rst
/doc/source/contrib/stats.rst
/doc/source/api.rst
/doc/source/contrib/print_proxy/index.rst
/doc/source/contrib/print_proxy/mapfish-print.rst
/doc/source/contrib/print_proxy/xml2pdf.rst
/doc/source/contrib/data_sources/standard/models-main.rst
/doc/source/contrib/data_sources/standard/models-theme.rst
/doc/source/contrib/data_sources/standard/models.rst
/doc/source/contrib/data_sources/swisstopo/index.rst
/doc/build/

# Standard configuration
Expand Down
10 changes: 4 additions & 6 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@
'../../.venv/bin/mako-render' if os.path.exists('../../.venv/bin/mako-render') else 'mako-render',
'core/sources.rst.mako']).decode('utf-8'))

with open('contrib/print_proxy.rst', 'w') as sources:
sources.write(subprocess.check_output([
'../../.venv/bin/mako-render' if os.path.exists('../../.venv/bin/mako-render') else 'mako-render',
'contrib/print_proxy.rst.mako']).decode('utf-8'))

with open('contrib/stats.rst', 'w') as sources:
sources.write(subprocess.check_output([
'../../.venv/bin/mako-render' if os.path.exists('../../.venv/bin/mako-render') else 'mako-render',
Expand All @@ -80,7 +75,10 @@
'contrib/data_sources/interlis_2_3/index.rst',
'contrib/data_sources/oereblex/index.rst',
'contrib/data_sources/swisstopo/index.rst',
'contrib/data_sources/index.rst'
'contrib/data_sources/index.rst',
'contrib/print_proxy/index.rst',
'contrib/print_proxy/mapfish-print.rst',
'contrib/print_proxy/xml2pdf.rst'
]

for target_path in target_paths:
Expand Down
46 changes: 2 additions & 44 deletions doc/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,48 +109,6 @@ structure. This method is recommended if you are using an existing database supp
already containing all the necessary data but in a different structure. In this case you should check, if it
is possible to transform the data by extending the existing models with a mapping to fit your structure.

The easiest example is a simple mapping of table and column names, if you use a different language. Using the
possibilities of SQLAlchemy, you could extend the existing
:ref:`api-pyramid_oereb-standard-models-motorways_building_lines-office` like this:

.. code-block:: python
from pyramid_oereb.lib.standard.models import motorways_building_lines
class Office(motorways_building_lines.Office):
"""
The bucket to fill in all the offices you need to reference from public law restriction,
document, geometry.
Attributes:
id (int): The identifier. This is used in the database only and must not be set manually.
If you don't like it - don't care about.
name (dict): The multilingual name of the office.
office_at_web (str): A web accessible url to a presentation of this office.
uid (str): The uid of this office from https
line1 (str): The first address line for this office.
line2 (str): The second address line for this office.
street (str): The streets name of the offices address.
number (str): The number on street.
postal_code (int): The ZIP-code.
city (str): The name of the city.
"""
__table_args__ = {'schema': 'baulinien_nationalstrassen'}
__tablename__ = 'amt'
id = sa.Column('oid', sa.Integer, primary_key=True)
office_at_web = sa.Column('amt_im_web', sa.String, nullable=True)
line1 = sa.Column('zeile1', sa.String, nullable=True)
line2 = sa.Column('zeile2', sa.String, nullable=True)
street = sa.Column('strasse', sa.String, nullable=True)
number = sa.Column('hausnr', sa.String, nullable=True)
postal_code = sa.Column('plz', sa.Integer, nullable=True)
city = sa.Column('ort', sa.String, nullable=True)
(...)
The only thing, you have to care about, if you want to stay using the standard sources, is to keep the class
name, the names of the properties and their data types.

After extending the models, do not forget to change the models module in the configuration of the topic's
source.

Expand Down Expand Up @@ -204,11 +162,11 @@ restrictions on implementing a custom source:

1. The source has to implement the method `read()` with the arguments used in its base source. For
example, your custom real estate source has to accept the arguments defined in
:ref:`api-pyramid_oereb-lib-sources-real_estate-realestatebasesource`.
:ref:`api-pyramid_oereb-contrib-data_sources-standard-sources-real_estate-databasesource`.

2. The method `read()` has to add records of the corresponding type to the source' records list. Every
source has list property called `records`. In case of a real estate source, the method `read()` has to
create one or more instances of the :ref:`api-pyramid_oereb-lib-records-real_estate-realestaterecord`
create one or more instances of the :ref:`api-pyramid_oereb-core-records-real_estate-realestaterecord`
and add them to this list.

This way, you should be able to create sources for nearly every possible data source.
Expand Down
8 changes: 0 additions & 8 deletions doc/source/contrib/data_sources/interlis_2_3/index.rst

This file was deleted.

5 changes: 3 additions & 2 deletions doc/source/contrib/data_sources/interlis_2_3/index.rst.mako
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.. _contrib-data-sources-interlis-23:

Application schema Models
=========================
INTERLIS 2.3
============



.. toctree::
Expand Down
192 changes: 0 additions & 192 deletions doc/source/contrib/data_sources/standard/models-main.rst

This file was deleted.

24 changes: 0 additions & 24 deletions doc/source/contrib/data_sources/standard/models-theme.rst

This file was deleted.

6 changes: 0 additions & 6 deletions doc/source/contrib/data_sources/standard/models.rst

This file was deleted.

8 changes: 0 additions & 8 deletions doc/source/contrib/data_sources/swisstopo/index.rst

This file was deleted.

6 changes: 4 additions & 2 deletions doc/source/contrib/data_sources/swisstopo/index.rst.mako
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.. _contrib-data-sources-swisstopo:

Application schema Models
=========================
Swisstopo Adapter
=================




.. toctree::
Expand Down
4 changes: 2 additions & 2 deletions doc/source/contrib/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Would you like to contribute to the project? Please see :ref:`contributing`.
.. toctree::
:hidden:

contributing
data_sources/index
print_proxy
print_proxy/index
stats
contributing
20 changes: 20 additions & 0 deletions doc/source/contrib/print_proxy/index.rst.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. _contrib-print-proxy:

Print Proxy
-----------

Part of ``pyramid_oereb`` plugable system is also the production of PDF files of the extracts.

It is solved via a proxy approach. The extract is passed to a service which knows how to produce a PDF
satisfying the federal specifications.

As of now ``pyramid_oereb`` offers the following print proxies:

* :ref:`contrib-print_proxy-mapfish-print`
* :ref:`contrib-print_proxy-xml2pdf`

.. toctree::
:hidden:

mapfish-print
xml2pdf
Loading

0 comments on commit 7ae6813

Please sign in to comment.