Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dados_rastreador
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Camex Público
dados_rastreador
Commits
90b7ac3f
Commit
90b7ac3f
authored
Oct 23, 2025
by
Miguel Guerrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adiciona dados de descrições
parent
ad6aeb85
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
0 deletions
+99
-0
dados_gerados/descricoes_ncm.parquet
dados_gerados/descricoes_ncm.parquet
+0
-0
scripts/gera_correlacoes.R
scripts/gera_correlacoes.R
+99
-0
No files found.
dados_gerados/descricoes_ncm.parquet
0 → 100644
View file @
90b7ac3f
File added
scripts/gera_correlacoes.R
View file @
90b7ac3f
...
...
@@ -55,6 +55,13 @@ path_naladi <- file.path(
"correlacao_completa_naladi_ncmtracker.Rda"
)
path_descricoes
<-
file.path
(
Sys.getenv
(
"general"
),
"Bases"
,
"NCM_sh1996_a_sh2022"
,
"NCMs_sh.xlsx"
)
# Obter códigos que mudaram nas revisões ----------------------------------
...
...
@@ -162,3 +169,95 @@ correlacao_completa <- correlacao_completa_naladi_naladi_ncmtracker |>
colunas
<-
names
(
correlacao_completa
)
write_parquet
(
correlacao_completa
,
"dados_gerados/dataset_naladi.parquet"
)
# Processa e organiza descrições NCM --------------------------------------
# obtem abas disponíveis
abas
<-
excel_sheets
(
path_descricoes
)
# obtem nome da ultima aba
ultimo_sh
<-
abas
[
length
(
abas
)]
# remove ultima aba
abas
<-
abas
[
-
length
(
abas
)]
append_descricoes
<-
function
(
aba
)
{
read_xlsx
(
path_descricoes
,
sheet
=
aba
)
%>%
mutate
(
across
(
everything
(),
~
if_else
(
is.na
(
.x
),
""
,
.x
)
),
across
(
everything
(),
~
str_replace
(
.x
,
"^- "
,
"-"
)
),
across
(
everything
(),
~
str_replace
(
.x
,
"^-- "
,
"--"
)
),
)
%>%
transmute
(
codigoFormatado
,
sh
,
descricao
=
paste
(
desc_pos
,
desc_subpos5
,
desc_subpos6
,
desc_item
,
desc_subitem
,
sep
=
"\n"
)
)
%>%
mutate
(
descricao
=
str_replace_all
(
descricao
,
"\n\n\n\n\n|\n\n\n\n|\n\n\n|\n\n"
,
"\n"
)
)
%>%
mutate
(
descricao
=
str_remove
(
descricao
,
"\n$"
)
)
}
descricoes_por_sh
<-
purrr
::
map_dfr
(
abas
,
~
append_descricoes
(
.x
)
)
%>%
rename
(
ncm
=
codigoFormatado
)
%>%
mutate
(
sh
=
str_replace
(
sh
,
"SH"
,
"NCM"
))
descricoes_atuais
<-
readRDS
(
file.path
(
Sys.getenv
(
"general"
),
"Bases"
,
"NCM_sh1996_a_sh2022"
,
"descricoes_atuais.rds"
)
)
%>%
as_tibble
()
%>%
mutate
(
ncm
=
paste0
(
str_sub
(
ncm
,
1
,
4
),
"."
,
str_sub
(
ncm
,
5
,
6
),
"."
,
str_sub
(
ncm
,
7
,
8
)
),
sh
=
paste
(
"NCM"
,
ultimo_sh
)
)
%>%
relocate
(
sh
,
.after
=
ncm
)
descricoes_por_sh
<-
descricoes_por_sh
%>%
bind_rows
(
descricoes_atuais
)
%>%
distinct
()
descricoes_por_sh
%>%
write_parquet
(
"dados_gerados/descricoes_ncm.parquet"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment