2 391
edições
(correct descriptors) |
Sem resumo de edição |
||
Linha 63: | Linha 63: | ||
TABLE "optim.donor" CONSTRAINT "donor_scope_osm_id_fkey" FOREIGN KEY (scope_osm_id) REFERENCES optim.jurisdiction(osm_id) | TABLE "optim.donor" CONSTRAINT "donor_scope_osm_id_fkey" FOREIGN KEY (scope_osm_id) REFERENCES optim.jurisdiction(osm_id) | ||
TABLE "optim.jurisdiction" CONSTRAINT "jurisdiction_parent_id_fkey" FOREIGN KEY (parent_id) REFERENCES optim.jurisdiction(osm_id) | TABLE "optim.jurisdiction" CONSTRAINT "jurisdiction_parent_id_fkey" FOREIGN KEY (parent_id) REFERENCES optim.jurisdiction(osm_id) | ||
Access method: heap | |||
</pre></small> | |||
=== Queries === | |||
Queries que geram reports e sugestão de análise das views próprias. | |||
<syntaxhighlight lang="sql"> | |||
-- R0a | |||
select '* '||vw_name from optim.admin_views_dependency_summary | |||
where ref_tab_name='optim.jurisdiction' order by 1 | |||
; | |||
-- R0b | |||
select schema_name, name, arguments_simplified , return_type | |||
from doc_UDF_using_a_table('optim.jurisdiction') t order by 1,2,3 | |||
; | |||
... | |||
</syntaxhighlight> | |||
=== Reports === | |||
'''R0a'''. Views que fazem uso da tabela: | |||
* api.jurisdiction: reproduz a tabela na API. | |||
* api.stats_donated_packcomponent: fornece estatísticas de pacotes doados, organizada por jurisdição. | |||
* optim.jurisdiction_lexlabel: reformata isolabel_ext como URN LEX. | |||
* optim.vw01donorevidencecmd: | |||
* optim.vw01full_donated_packtpl: pacotes doados em join completo. | |||
* optim.vw01full_jurisdiction_geom: jurisdição completa, com geometria. | |||
* optim.vw01int_country_id: (lixo) lista o ID interno de país. | |||
* optim.vw02generate_list: gera JSON com árvore de países, com optim.vw01generate_list. | |||
* optim.vw02publication: metadados para ato de publicação de um pacote. | |||
* optim.vwjurisdiction_synonym: lista de-para de todos os sinônimos válidos de uma jurisdição (CEP, abreviação, URN LEX etc.). | |||
* osmc.jurisdictions_select: JSON para interface de seletor de jurisdição. | |||
* public.qwerty: (resgatar para optim) gerador de comando bash "curl" para criar CSVs de todas as jurisdições. | |||
'''R0b'''. Funções que fazem uso da tabela: | |||
{| class="wikitable" | |||
! schema_name !! name !! arguments_simplified !! return_type | |||
|- | |||
| api || jurisdiction_autocomplete || {text} || jsonb | |||
|- | |||
| api || osmcode_decode_postal || {text,text} || jsonb | |||
|- | |||
| api || osmcode_encode || {text,integer} || jsonb | |||
|- | |||
| api || osmcode_encode_sci || {text,integer} || jsonb | |||
|- | |||
| optim || generate_synonym_csv || {text,text} || text | |||
|- | |||
| optim || generate_synonym_ref_csv || {text} || text | |||
|- | |||
| optim || insert_donor_pack || {text} || text | |||
|- | |||
| optim || insert_jurisdpoint || {NULL} || text | |||
|- | |||
| osmc || encode_short_code || {text,"bit varying",text,USER-DEFINED,text,integer,text} || record | |||
|- | |||
| osmc || l0cover_upsert_co || {NULL} || text | |||
|} | |||
== Table <code>optim.jurisdiction_geom</code> == | |||
Geometrias de [[#optim.jurisdiction]]. Geometrias das jurisdições nacionais e locais. | |||
{| class="wikitable" | |||
! Column !! Type !! Nullable !! Description | |||
|- | |||
| osm_id || bigint || not null || Relation identifier in OpenStreetMap. | |||
|- | |||
| isolabel_ext || text || not null || ISO 3166-1 alpha-2 code and name (camel case); e.g. BR-SP-SaoPaulo. | |||
|- | |||
| geom || geometry(Geometry,4326) || || Geometry for osm_id identifier | |||
|- | |||
| geom_svg || geometry(Geometry,4326) || || Simplified geometry version to use in svg interface. | |||
|- | |||
| kx_ghs1_intersects || text[] || || | |||
|- | |||
| kx_ghs2_intersects || text[] || || | |||
|} | |||
<small><pre> | |||
Indexes: | |||
"jurisdiction_geom_pkey" PRIMARY KEY, btree (osm_id) | |||
"jurisdiction_geom_isolabel_ext_key" UNIQUE CONSTRAINT, btree (isolabel_ext) | |||
"optim_jurisdiction_geom_idx1" gist (geom) | |||
"optim_jurisdiction_geom_isolabel_ext_idx1" btree (isolabel_ext) | |||
"optim_jurisdiction_geom_svg_idx1" gist (geom_svg) | |||
Access method: heap | Access method: heap | ||
</pre></small> | </pre></small> | ||
Linha 117: | Linha 198: | ||
; | ; | ||
-- R0b | -- R0b | ||
select schema_name, name, arguments_simplified , return_type | select schema_name, name, arguments_simplified , return_type | ||
from doc_UDF_using_a_table('osmc.cover') t order by 1,2,3 | from doc_UDF_using_a_table('osmc.cover') t order by 1,2,3 | ||
; | ; | ||
Linha 335: | Linha 416: | ||
order by u.view_schema, u.view_name | order by u.view_schema, u.view_name | ||
; | ; | ||
CREATE VIEW optim.admin_views_dependency_summary AS | |||
select schema_name||'.'||view_name as vw_name, | |||
referenced_table_schema||'.'||referenced_table_name as ref_tab_name | |||
from optim.admin_views_dependency | |||
; | |||
-- DROP VIEW optim.admin_udf_summary; | -- DROP VIEW optim.admin_udf_summary; | ||
CREATE VIEW optim.admin_udf_summary AS | CREATE VIEW optim.admin_udf_summary AS | ||
Linha 373: | Linha 460: | ||
WHERE u.definition ilike '%'|| p_table ||'%' | WHERE u.definition ilike '%'|| p_table ||'%' | ||
$f$ LANGUAGE SQL IMMUTABLE; | $f$ LANGUAGE SQL IMMUTABLE; | ||
</pre> | </pre> |
edições