teste_docs / models /construction_identity.py
gui-sparim's picture
Publica gerador evolutivo e carrega modelos do repositório MESA
55d9355 verified
Raw History Blame Contribute Delete
763 Bytes
"""Annual MQC copies get new UUIDs; group by property and sequence instead."""
import json
import re
def construction_identity(source, construction, index):
name = str((source.get('construcao') or {}).get('fonteNome') or '')
registration = re.search(r'inscri[çc][aã]o\s*[:\-]?\s*([\d.\-/]+)',name,re.I)
unit = source.get('imovelId') or source.get('unidadeId') or source.get('identificacaoImovel')
unit = unit or (registration[1] if registration else '')
location = (source.get('terreno') or {}).get('localizacao') or {}
return json.dumps([unit,location.get('lat'),location.get('lon'),construction.get('seq') or index+1,
construction.get('nome') or '',construction.get('anoConstrucao') or ''],ensure_ascii=False)