Exemple #1
0
def test_get_document_type():
    document = DocumentRecord(LawStatusRecord.from_config('inForce'),
                              datetime.date.today(), {'de': 'Test'},
                              OfficeRecord({'de': 'Test'}))
    legal_provision = LegalProvisionRecord(
        LawStatusRecord.from_config('inForce'), datetime.date.today(),
        {'de': 'Test'}, OfficeRecord({'de': 'Test'}))
    assert Renderer._get_document_type(document) == 'data:Document'
    assert Renderer._get_document_type(
        legal_provision) == 'data:LegalProvisions'
Exemple #2
0
def test_extract_collection(input_geom, result, extracted):
    law_status_record = LawStatusRecord("runningModifications",
                                        {u'de': u'BlaBla'})
    geometry_record = GeometryRecord(law_status_record,
                                     datetime.date(1985, 8, 29), input_geom,
                                     'test')
    assert geometry_record._extract_collection(result) == extracted
def test_init_with_relation():
    office_record = OfficeRecord({'en': 'name'})
    law_status = LawStatusRecord.from_config(u'inForce')
    articles = [ArticleRecord(law_status, datetime.date(1985, 8, 29), '123.4')]
    references = [
        DocumentRecord('Law', law_status, datetime.date(1985, 8,
                                                        29), {'de': 'Titel 1'},
                       office_record, {'en': 'http://my.document.com'})
    ]
    record = DocumentRecord('Hint',
                            law_status,
                            datetime.date(1985, 8, 29), {'de': 'title'},
                            office_record, {'en': 'http://my.document.com'},
                            articles=articles,
                            references=references,
                            article_numbers=['test'])
    assert isinstance(record.document_type, str)
    assert isinstance(record.law_status, LawStatusRecord)
    assert isinstance(record.published_from, datetime.date)
    assert isinstance(record.title, dict)
    assert isinstance(record.responsible_office, OfficeRecord)
    assert isinstance(record.text_at_web, dict)
    assert record.abbreviation is None
    assert record.official_number is None
    assert record.official_title is None
    assert record.canton is None
    assert record.municipality is None
    assert record.article_numbers == ['test']
    assert isinstance(record.articles, list)
    assert isinstance(record.references, list)
Exemple #4
0
    def from_db_to_geometry_records(self, geometries_from_db):
        geometry_records = []
        for geometry_from_db in geometries_from_db:

            # Create law status record
            law_status = LawStatusRecord.from_config(
                Config.get_law_status(
                    self._plr_info.get('code'),
                    self._plr_info.get('law_status'),
                    geometry_from_db.law_status
                )
            )

            # Create office record
            office = self.from_db_to_office_record(geometry_from_db.responsible_office)

            # Create geometry records
            geometry_records.extend(self.create_geometry_records_(
                law_status,
                geometry_from_db.published_from,
                to_shape(geometry_from_db.geom),
                geometry_from_db.geo_metadata,
                office
            ))

        return geometry_records
Exemple #5
0
 def from_db_to_document_records(self,
                                 legal_provisions_from_db,
                                 article_numbers=None):
     document_records = []
     for i, legal_provision in enumerate(legal_provisions_from_db):
         referenced_documents_db = []
         referenced_article_numbers = []
         for join in legal_provision.referenced_documents:
             referenced_documents_db.append(join.referenced_document)
             referenced_article_nrs = join.article_numbers.split(
                 '|') if join.article_numbers else None
             referenced_article_numbers.append(referenced_article_nrs)
         referenced_document_records = self.from_db_to_document_records(
             referenced_documents_db, referenced_article_numbers)
         article_records = self.from_db_to_article_records(
             legal_provision.articles)
         office_record = self.from_db_to_office_record(
             legal_provision.responsible_office)
         article_nrs = article_numbers[i] if isinstance(
             article_numbers, list) else None
         law_status = LawStatusRecord.from_config(
             Config.get_law_status(self._plr_info.get('code'),
                                   self._plr_info.get('law_status'),
                                   legal_provision.law_status))
         document_records.append(
             self._documents_reocord_class(
                 law_status, legal_provision.published_from,
                 legal_provision.title, office_record,
                 legal_provision.text_at_web, legal_provision.abbreviation,
                 legal_provision.official_number,
                 legal_provision.official_title, legal_provision.canton,
                 legal_provision.municipality, article_nrs,
                 legal_provision.file, article_records,
                 referenced_document_records))
     return document_records
def test_future_document():
    office_record = OfficeRecord({'en': 'name'})
    law_status = LawStatusRecord.from_config(u'inForce')
    record = DocumentRecord(
        'Hint', law_status,
        (datetime.datetime.now().date() + datetime.timedelta(days=7)),
        {'en': 'title'}, office_record, {'en': 'http://my.document.com'})
    assert not record.published
def test_legal_provision():
    office_record = OfficeRecord({'en': 'name'})
    law_status = LawStatusRecord.from_config(u'inForce')
    legal_provision = LegalProvisionRecord(law_status,
                                           datetime.date(1985, 8, 29),
                                           {'de': 'title'}, office_record)
    assert isinstance(legal_provision.document_type, str)
    assert legal_provision.document_type == 'LegalProvision'
def test_from_config():
    record = LawStatusRecord.from_config(u'inForce')
    assert record.code == u'inForce'
    assert isinstance(record.text, dict)
    assert record.text.get('de')
    assert record.text.get('fr')
    assert record.text.get('it')
    assert record.text.get('rm')
    assert record.text.get('en')

    record = LawStatusRecord.from_config(u'runningModifications')
    assert record.code == u'runningModifications'
    assert isinstance(record.text, dict)
    assert record.text.get('de')
    assert record.text.get('fr')
    assert record.text.get('it')
    assert record.text.get('rm')
    assert record.text.get('en')
Exemple #9
0
def create_dummy_plr():
    office = OfficeRecord({'en': 'Office'})
    view_service = ViewServiceRecord('http://my.wms.com', 1, 1.0)
    law_status = LawStatusRecord.from_config(u'inForce')
    geometry = GeometryRecord(law_status, datetime.date.today(), Point(1, 1))
    record = PlrRecord(ThemeRecord('code',
                                   dict()), {'en': 'Content'}, law_status,
                       datetime.date(1985, 8, 29), office,
                       ImageRecord('1'.encode('utf-8')), view_service,
                       [geometry])
    return record
Exemple #10
0
 def from_db_to_article_records(self, articles_from_db):
     article_records = []
     for article_from_db in articles_from_db:
         law_status = LawStatusRecord.from_config(
             Config.get_law_status(self._plr_info.get('code'),
                                   self._plr_info.get('law_status'),
                                   article_from_db.law_status))
         article_records.append(
             self._article_record_class(law_status,
                                        article_from_db.published_from,
                                        article_from_db.number,
                                        article_from_db.text_at_web,
                                        article_from_db.text))
     return article_records
Exemple #11
0
def test_calculate(geometry, real_estate_geometry, length_limit, area_limit,
                   length_share, area_share, nr_of_points, test):
    law_status_record = LawStatusRecord("runningModifications",
                                        {u'de': u'BlaBla'})
    geometry_record = GeometryRecord(law_status_record,
                                     datetime.date(1985, 8, 29), geometry,
                                     'test')
    real_estate = RealEstateRecord('Liegenschaft', 'BL', 'Aesch BL', 2761, 1,
                                   real_estate_geometry)
    geometry_record.calculate(real_estate, length_limit, area_limit, 'm', 'm2')
    assert geometry_record._test_passed == test
    assert geometry_record._length_share == length_share
    assert geometry_record._area_share == area_share
    assert geometry_record._nr_of_points == nr_of_points
Exemple #12
0
def test_init():
    office = OfficeRecord({'en': 'Office'})
    view_service = ViewServiceRecord('http://my.wms.com', 1, 1.0)
    law_status = LawStatusRecord.from_config(u'inForce')
    geometry = GeometryRecord(law_status, datetime.date.today(), Point(1, 1))
    record = PlrRecord(ThemeRecord('code',
                                   dict()), {'en': 'Content'}, law_status,
                       datetime.date(1985, 8, 29), office,
                       ImageRecord('1'.encode('utf-8')), view_service,
                       [geometry])
    assert record.information == {'en': 'Content'}
    assert record.sub_theme is None
    assert isinstance(record.geometries, list)
    assert isinstance(record.responsible_office, OfficeRecord)
    assert isinstance(record.theme, ThemeRecord)
    assert isinstance(record.symbol, ImageRecord)
def test_init():
    office_record = OfficeRecord({'en': 'name'})
    law_status = LawStatusRecord.from_config(u'inForce')
    record = HintRecord(law_status, datetime.date(1985, 8, 29), {'en': 'title'},
                        office_record, {'en': 'http://my.legal-provision.com'})
    assert isinstance(record.document_type, str)
    assert isinstance(record.law_status, LawStatusRecord)
    assert isinstance(record.published_from, datetime.date)
    assert isinstance(record.title, dict)
    assert isinstance(record.responsible_office, OfficeRecord)
    assert isinstance(record.text_at_web, dict)
    assert record.abbreviation is None
    assert record.official_number is None
    assert record.official_title is None
    assert record.canton is None
    assert record.municipality is None
    assert isinstance(record.articles, list)
    assert isinstance(record.references, list)
def test_sub_theme():
    parameters = Parameter(flavour='reduced',
                           format='xml',
                           geometry=False,
                           images=True,
                           identdn='BL0200002829',
                           number='1000',
                           egrid='CH775979211712',
                           language='de')
    renderer = Renderer(DummyRenderInfo())
    renderer._language = u'de'
    renderer._request = MockRequest()
    renderer._request.route_url = lambda url, **kwargs: "http://example.com/current/view"
    office = OfficeRecord(name={'de': 'office de'})
    law_status = LawStatusRecord(code='runningModifications',
                                 text={'de': 'law status de'})
    geometry = GeometryRecord(law_status,
                              datetime.now(),
                              Polygon(),
                              'test',
                              office=office)
    public_law_restriction = PlrRecord(
        theme=ThemeRecord(u'LandUsePlans', {'de': 'Theme 1'}),
        information={'de': 'information de'},
        law_status=law_status,
        published_from=datetime.now(),
        responsible_office=office,
        symbol=ImageRecord('1'.encode('utf-8')),
        view_service=ViewServiceRecord(reference_wms='',
                                       layer_index=0,
                                       layer_opacity=1.0),
        geometries=[geometry],
        sub_theme={'de': 'sub theme de'})
    content = template.render(
        **{
            'params': parameters,
            'localized': renderer.get_localized_text,
            'multilingual': renderer.get_multilingual_text,
            'public_law_restriction': public_law_restriction
        }).decode('utf-8').split('\n')
    no_empty_lines = list(filter(lambda line: line != '', content))
    assert no_empty_lines[
        18] == '    <data:SubTheme>sub theme de</data:SubTheme>'
    assert len(no_empty_lines) == 72
Exemple #15
0
def test_processor_get_legend_entries():
    theme1 = ThemeRecord(u'TEST', {'de': 'Theme 1'})
    theme2 = ThemeRecord(u'TEST', {'de': 'Theme 2'})
    office = OfficeRecord({'de': 'Test Office'})
    law_status = LawStatusRecord.from_config(u'inForce')
    geometries = [
        GeometryRecord(law_status, datetime.date.today(), Point(1, 1))
    ]
    legend1 = LegendEntryRecord(ImageRecord('1'.encode('utf-8')),
                                {'de': 'legend1'},
                                'CodeA',
                                'bla',
                                theme1,
                                view_service_id=1)
    legend2 = LegendEntryRecord(ImageRecord('1'.encode('utf-8')),
                                {'de': 'legend2'},
                                'CodeB',
                                'bla',
                                theme1,
                                view_service_id=1)
    legend3 = LegendEntryRecord(ImageRecord('1'.encode('utf-8')),
                                {'de': 'legend3'},
                                'CodeC',
                                'bla',
                                theme2,
                                view_service_id=1)
    legend4 = LegendEntryRecord(ImageRecord('1'.encode('utf-8')),
                                {'de': 'legend4'},
                                'CodeD',
                                'bla',
                                theme2,
                                view_service_id=1)
    view_service1 = ViewServiceRecord(
        'http://www.test1.url.ch',
        1,
        1.0,
        legend_at_web={'de': 'http://www.test1.url.ch'},
        legends=[legend1, legend2])
    view_service2 = ViewServiceRecord(
        'http://www.test2.url.ch',
        1,
        1.0,
        legend_at_web={'de': 'http://www.test2.url.ch'},
        legends=[legend3, legend4])
    image = ImageRecord('1'.encode('utf-8'))
    plr1 = PlrRecord(
        theme1,
        {'de': 'CONTENT'},
        law_status,
        datetime.datetime.now(),
        office,
        image,
        view_service1,
        geometries,
        type_code='CodeA',
    )
    plr2 = PlrRecord(theme1, {'de': 'CONTENT'},
                     law_status,
                     datetime.datetime.now(),
                     office,
                     image,
                     view_service1,
                     geometries,
                     type_code='CodeB')
    plr3 = PlrRecord(theme1, {'de': 'CONTENT'},
                     law_status,
                     datetime.datetime.now(),
                     office,
                     image,
                     view_service2,
                     geometries,
                     type_code='CodeB')
    plr4 = PlrRecord(theme1, {'de': 'CONTENT'},
                     law_status,
                     datetime.datetime.now(),
                     office,
                     image,
                     view_service2,
                     geometries,
                     type_code='CodeB')

    inside_plrs = [plr1]
    outside_plrs = [plr2, plr3]
    after_process = Processor.get_legend_entries(inside_plrs, outside_plrs)
    assert len(inside_plrs) == len(after_process)
    inside_plrs = [plr3]
    outside_plrs = [plr4]
    after_process = Processor.get_legend_entries(inside_plrs, outside_plrs)
    assert len(after_process) == 1
Exemple #16
0
    def from_db_to_plr_record(self, public_law_restriction_from_db,
                              legend_entries_from_db):
        thresholds = self._plr_info.get('thresholds')
        min_length = thresholds.get('length').get('limit')
        length_unit = thresholds.get('length').get('unit')
        min_area = thresholds.get('area').get('limit')
        area_unit = thresholds.get('area').get('unit')
        legend_entry_records = self.from_db_to_legend_entry_record(
            self._theme_record, legend_entries_from_db,
            public_law_restriction_from_db)
        symbol = None
        for legend_entry_record in legend_entry_records:
            if public_law_restriction_from_db.type_code == legend_entry_record.type_code:
                symbol = legend_entry_record.symbol

        if symbol is None:
            error_msg = u'No symbol was found for plr in topic {topic} with id {id}'.format(
                topic=self._plr_info.get('code'),
                id=public_law_restriction_from_db.id)
            log.error(error_msg)
            raise AttributeError(error_msg)
        view_service_record = self.from_db_to_view_service_record(
            public_law_restriction_from_db.view_service, legend_entry_records,
            self._plr_info.get('code'))

        document_records = self.get_document_records(
            public_law_restriction_from_db)
        geometry_records = self.from_db_to_geometry_records(
            public_law_restriction_from_db.geometries)

        basis_plr_records = []
        for join in public_law_restriction_from_db.basis:
            basis_plr_records.append(self.from_db_to_plr_record(join.base, []))
        refinements_plr_records = []
        for join in public_law_restriction_from_db.refinements:
            refinements_plr_records.append(
                self.from_db_to_plr_record(join.refinement, []))
        law_status = LawStatusRecord.from_config(
            Config.get_law_status(self._plr_info.get('code'),
                                  self._plr_info.get('law_status'),
                                  public_law_restriction_from_db.law_status))

        plr_record = self._plr_record_class(
            self._theme_record,
            public_law_restriction_from_db.information,
            law_status,
            public_law_restriction_from_db.published_from,
            self.from_db_to_office_record(
                public_law_restriction_from_db.responsible_office),
            symbol,
            view_service_record,
            geometry_records,
            sub_theme=public_law_restriction_from_db.sub_theme,
            other_theme=public_law_restriction_from_db.other_theme,
            type_code=public_law_restriction_from_db.type_code,
            type_code_list=public_law_restriction_from_db.type_code_list,
            basis=basis_plr_records,
            refinements=refinements_plr_records,
            documents=document_records,
            min_area=min_area,
            min_length=min_length,
            area_unit=area_unit,
            length_unit=length_unit,
            view_service_id=public_law_restriction_from_db.view_service.id)

        return plr_record
Exemple #17
0
def law_status(config):
    assert isinstance(config._config, dict)
    return LawStatusRecord.from_config(u'inForce')
def law_status():
    return LawStatusRecord(u'inForce', {'de': u'In Kraft'})
Exemple #19
0
    def _get_document_records(self, document, references=list()):
        """
        Converts the received documents into records.

        Args:
            document (geolink_formatter.entity.Document): The geoLink document to be returned as document
                record.
            references (list of geolink_formatter.entity.Document): Referenced geoLink documents.

        Returns:
            list of pyramid_oereb.lib.records.documents.DocumentRecord: The converted record.
        """

        # Cancel if document contains no files
        if len(document.files) == 0:
            log.warning(
                'Document with OEREBlex ID {0} has been skipped because of missing file.'
                .format(document.id))
            return []

        # Check mandatory attributes
        assert document.title is not None
        assert document.enactment_date is not None
        assert document.authority is not None

        # Get document type
        if document.doctype == 'decree':
            document_class = LegalProvisionRecord
        elif document.doctype == 'edict':
            document_class = LawRecord
        else:
            raise TypeError(
                'Wrong doctype: expected decree or edict, got {0}'.format(
                    document.doctype))

        # Convert referenced documents
        referenced_records = []
        for reference in references:
            referenced_records.extend(self._get_document_records(reference))

        # Create related office record
        office = OfficeRecord({self._language: document.authority},
                              office_at_web=document.authority_url)

        # Check for available abbreviation
        abbreviation = {
            self._language: document.abbreviation
        } if document.abbreviation else None

        # Get files
        records = []
        for f in document.files:
            arguments = {
                'law_status':
                LawStatusRecord.from_config(u'inForce'),
                'published_from':
                document.enactment_date,
                'title':
                self._get_document_title(document, f),
                'responsible_office':
                office,
                'text_at_web': {
                    self._language: f.href
                },
                'abbreviation':
                abbreviation,
                'official_number':
                document.number,
                'official_title':
                self._get_mapped_value(document, 'official_title', True),
                'canton':
                self._canton,
                'municipality':
                self._get_mapped_value(document, 'municipality'),
                'references':
                referenced_records if len(referenced_records) > 0 else None
            }
            records.append(document_class(**arguments))

        return records
def test_invalid_code():
    with pytest.raises(AttributeError):
        LawStatusRecord(u'inValid', {u'de': u'In Kraft'})
def test_init():
    record = LawStatusRecord(u'inForce', {u'de': u'In Kraft'})
    assert record.code == u'inForce'
    assert isinstance(record.text, dict)
    assert record.text.get('de') == u'In Kraft'
def test_mandatory_fields():
    with pytest.raises(TypeError):
        LawStatusRecord()
Exemple #23
0
    def _get_document_records(self, document, language, references=None):
        """
        Converts the received documents into records.

        Args:
            document (geolink_formatter.entity.Document): The geoLink document to be returned as document
                record.
            language (str): The language of the returned documents.
            references (list of geolink_formatter.entity.Document): Referenced geoLink documents.

        Returns:
            list of pyramid_oereb.lib.records.documents.DocumentRecord: The converted record.
        """

        references = references or list()

        # Cancel if document contains no files
        if len(document.files) == 0:
            log.warning('Document with OEREBlex ID {0} has been skipped because of missing file.'.format(
                document.id
            ))
            return []

        enactment_date = document.enactment_date
        authority = document.authority
        if document.doctype == 'notice':
            # Oereblex notices documents can have no enactment_date while it is require by pyramid_oereb to
            # have one. Add a fake default one that is identifiable and always older than now (01.0.1.1970).
            if enactment_date is None:
                enactment_date = datetime.date(1970, 1, 1)
            # Oereblex notices documents can have no `authority` while it is require by pyramid_oereb to
            # have one. Replace None by '-' in this case.
            if authority is None:
                authority = '-'

        # Cancel if enactment_date is not set
        if enactment_date is None:
            log.warning('Document with OEREBlex ID {0} has been skipped because of missing enactment_date.'
                        .format(document.id))
            return []

        # Check mandatory attributes
        if document.title is None:
            raise AssertionError('Missing title for document #{0}'.format(document.id))
        if authority is None:
            raise AssertionError('Missing authority for document #{0}'.format(document.id))

        # Get document type
        if document.doctype == 'decree':
            document_class = LegalProvisionRecord
        elif document.doctype == 'edict':
            document_class = LawRecord
        elif document.doctype == 'notice':
            document_class = HintRecord
        else:
            raise TypeError('Wrong doctype: expected decree, edict or notice, got {0}'.format(
                document.doctype
            ))

        # Convert referenced documents
        referenced_records = []
        for reference in references:
            referenced_records.extend(self._get_document_records(reference, language))

        # Create related office record
        office = OfficeRecord({language: authority}, office_at_web=document.authority_url)

        # Check for available abbreviation
        abbreviation = {language: document.abbreviation} if document.abbreviation else None

        # Get files
        records = []
        for f in document.files:
            arguments = {'law_status': LawStatusRecord.from_config(u'inForce'),
                         'published_from': enactment_date,
                         'title': self._get_document_title(document, f, language),
                         'responsible_office': office,
                         'text_at_web': {language: f.href},
                         'abbreviation': abbreviation,
                         'official_number': document.number,
                         'official_title': self._get_mapped_value(
                             document,
                             'official_title',
                             language=language
                         ),
                         'canton': self._canton,
                         'municipality': self._get_mapped_value(document, 'municipality'),
                         'references': referenced_records if len(referenced_records) > 0 else None}
            records.append(document_class(**arguments))

        return records
Exemple #24
0
    def from_db_to_plr_record(self, public_law_restriction_from_db):
        thresholds = self._plr_info.get('thresholds')
        min_length = thresholds.get('length').get('limit')
        length_unit = thresholds.get('length').get('unit')
        length_precision = thresholds.get('length').get('precision')
        min_area = thresholds.get('area').get('limit')
        area_unit = thresholds.get('area').get('unit')
        area_precision = thresholds.get('area').get('precision')
        percentage_precision = thresholds.get('percentage').get('precision')
        legend_entry_records = self.from_db_to_legend_entry_record(
            self._theme_record,
            public_law_restriction_from_db.view_service.legends)
        symbol = None
        for legend_entry_record in legend_entry_records:
            if public_law_restriction_from_db.type_code == legend_entry_record.type_code \
                    and public_law_restriction_from_db.information == legend_entry_record.legend_text:
                symbol = legend_entry_record.symbol
        if symbol is None:
            # TODO: raise real error here when data is correct, emit warning for now
            msg = u'No symbol was found for plr in topic {topic} with id {id}'.format(
                topic=self._plr_info.get('code'),
                id=public_law_restriction_from_db.id)
            log.warning(msg)
            symbol = ImageRecord('1'.encode('utf-8'))
            # raise AttributeError(msg)
        view_service_record = self.from_db_to_view_service_record(
            public_law_restriction_from_db.view_service, legend_entry_records)
        documents_from_db = []
        article_numbers = []
        for i, legal_provision in enumerate(
                public_law_restriction_from_db.legal_provisions):
            documents_from_db.append(legal_provision.document)
            article_nrs = legal_provision.article_numbers.split('|') if legal_provision.article_numbers \
                else None
            article_numbers.append(article_nrs)
        document_records = self.from_db_to_document_records(
            documents_from_db, article_numbers)
        geometry_records = self.from_db_to_geometry_records(
            public_law_restriction_from_db.geometries)

        basis_plr_records = []
        for join in public_law_restriction_from_db.basis:
            basis_plr_records.append(self.from_db_to_plr_record(join.base))
        refinements_plr_records = []
        for join in public_law_restriction_from_db.refinements:
            refinements_plr_records.append(
                self.from_db_to_plr_record(join.refinement))
        law_status = LawStatusRecord.from_config(
            Config.get_law_status(self._plr_info.get('code'),
                                  self._plr_info.get('law_status'),
                                  public_law_restriction_from_db.law_status))

        plr_record = self._plr_record_class(
            self._theme_record,
            public_law_restriction_from_db.information,
            law_status,
            public_law_restriction_from_db.published_from,
            self.from_db_to_office_record(
                public_law_restriction_from_db.responsible_office),
            symbol,
            view_service_record,
            geometry_records,
            sub_theme=public_law_restriction_from_db.sub_theme,
            other_theme=public_law_restriction_from_db.other_theme,
            type_code=public_law_restriction_from_db.type_code,
            type_code_list=public_law_restriction_from_db.type_code_list,
            basis=basis_plr_records,
            refinements=refinements_plr_records,
            documents=document_records,
            min_area=min_area,
            min_length=min_length,
            area_unit=area_unit,
            length_unit=length_unit,
            area_precision=area_precision,
            length_precision=length_precision,
            percentage_precision=percentage_precision)

        return plr_record