From 0fbd41f34889a348b412cadd4864926f644f6059 Mon Sep 17 00:00:00 2001
From: lcd22 <lcd22@inf.ufpr.br>
Date: Thu, 6 Mar 2025 14:17:41 +0000
Subject: [PATCH] testando json simplificado

---
 gen_bronze.py | 182 ++++++++++++++++++++++++--------------------------
 1 file changed, 86 insertions(+), 96 deletions(-)

diff --git a/gen_bronze.py b/gen_bronze.py
index c8c652d..aa25648 100644
--- a/gen_bronze.py
+++ b/gen_bronze.py
@@ -22,103 +22,93 @@ schema = StructType([
     StructField("cnes", LongType(), True),
     StructField("ine", LongType(), True),
     StructField("dataAtendimento", DateType(), True),
-    StructField("condicoesDeSaude", StructType([
-        StructField("descricaoCausaInternacaoEm12Meses", StringType(), True),
-        StructField("descricaoOutraCondicao1", StringType(), True),
-        StructField("descricaoOutraCondicao2", StringType(), True),
-        StructField("descricaoOutraCondicao3", StringType(), True),
-        StructField("descricaoPlantasMedicinaisUsadas", ArrayType(StringType()), True),
-        StructField("doencaRespiratoria", ArrayType(StringType()), True),
-        StructField("doencaRins", ArrayType(StringType()), True),
-        StructField("maternidadeDeReferencia", StringType(), True),
-        StructField("situacaoPeso", StringType(), True),
-        StructField("statusEhDependenteAlcool", BooleanType(), True),
-        StructField("statusEhDependenteOutrasDrogas", BooleanType(), True),
-        StructField("statusEhFumante", BooleanType(), True),
-        StructField("statusEhGestante", BooleanType(), True),
-        StructField("statusEstaAcamado", BooleanType(), True),
-        StructField("statusEstaDomiciliado", BooleanType(), True),
-        StructField("statusTemDiabetes", BooleanType(), True),
-        StructField("statusTemDoencaRespiratoria", BooleanType(), True),
-        StructField("statusTemHanseniase", BooleanType(), True),
-        StructField("statusTemHipertensaoArterial", BooleanType(), True),
-        StructField("statusTemTeveCancer", BooleanType(), True),
-        StructField("statusTemTeveDoencasRins", BooleanType(), True),
-        StructField("statusTemTuberculose", BooleanType(), True),
-        StructField("statusTeveAvcDerrame", BooleanType(), True),
-        StructField("statusTeveDoencaCardiaca", BooleanType(), True),
-        StructField("statusTeveInfarto", BooleanType(), True),
-        StructField("statusTeveInternadoem12Meses", BooleanType(), True),
-        StructField("statusUsaOutrasPraticasIntegrativasOuComplementares", BooleanType(), True),
-        StructField("statusUsaPlantasMedicinais", BooleanType(), True),
-        StructField("statusDiagnosticoMental", StringType(), True)
-    ]), True),
-    StructField("emSituacaoDeRua", StructType([
-        StructField("grauParentescoFamiliarFrequentado", StringType(), True),
-        StructField("higienePessoalSituacaoRua", ArrayType(StringType()), True),
-        StructField("origemAlimentoSituacaoRua", ArrayType(StringType()), True),
-        StructField("outraInstituicaoQueAcompanha", StringType(), True),
-        StructField("quantidadeAlimentacoesAoDiaSituacaoRua", StringType(), True),
-        StructField("statusAcompanhadoPorOutraInstituicao", BooleanType(), True),
-        StructField("statusPossuiReferenciaFamiliar", BooleanType(), True),
-        StructField("statusRecebeBeneficio", BooleanType(), True),
-        StructField("statusSituacaoRua", BooleanType(), True),
-        StructField("statusTemAcessoHigienePessoalSituacaoRua", BooleanType(), True),
-        StructField("statusVisitaFamiliarFrequentemente", BooleanType(), True),
-        StructField("tempoSituacaoRua", StringType(), True)
-    ]), True),
-    StructField("identificacaoUsuarioCidadao", StructType([
-        StructField("nomeSocial", StringType(), True),
-        StructField("municĂ­pio", StringType(), True),
-        StructField("dataNascimentoCidadao", DateType(), True),
-        StructField("emailCidadao", StringType(), True),
-        StructField("nacionalidadeCidadao", StringType(), True),
-        StructField("nomeCidadao", StringType(), True),
-        StructField("nomeMaeCidadao", StringType(), True),
-        StructField("cnsCidadao", LongType(), True),
-        StructField("cnsResponsavelFamiliar", LongType(), True),
-        StructField("telefoneCelular", StringType(), True),
-        StructField("numeroNisPisPasep", LongType(), True),
-        StructField("paisNascimento", StringType(), True),
-        StructField("racaCorCidadao", StringType(), True),
-        StructField("sexoCidadao", StringType(), True),
-        StructField("statusEhResponsavel", BooleanType(), True),
-        StructField("etnia", StringType(), True),
-        StructField("nomePaiCidadao", StringType(), True),
-        StructField("desconheceNomePai", BooleanType(), True),
-        StructField("dtNaturalizacao", DateType(), True),
-        StructField("portariaNaturalizacao", StringType(), True),
-        StructField("dtEntradaBrasil", DateType(), True),
-        StructField("microarea", LongType(), True),
-        StructField("stForaArea", BooleanType(), True),
-        StructField("cpfCidadao", StringType(), True),
-        StructField("cpfResponsavelFamiliar", StringType(), True)
-    ]), True),
-    StructField("InformacoesSocioDemograficas", StructType([
-        StructField("deficienciasCidadao", ArrayType(StringType()), True),
-        StructField("grauInstrucaoCidadao", StringType(), True),
-        StructField("ocupacao", StringType(), True),
-        StructField("orientacaoSexualCidadao", StringType(), True),
-        StructField("relacaoParentescoCidadao", StringType(), True),
-        StructField("situacaoMercadoTrabalhoCidadao", StringType(), True),
-        StructField("statusDesejaInformarOrientacaoSexual", BooleanType(), True),
-        StructField("statusFrequentaBenzedeira", BooleanType(), True),
-        StructField("statusFrequentaEscola", BooleanType(), True),
-        StructField("statusMembroPovoComunidadeTradicional", BooleanType(), True),
-        StructField("statusParticipaGrupoComunitario", BooleanType(), True),
-        StructField("statusPossuiPlanoSaudePrivado", BooleanType(), True),
-        StructField("statusTemAlgumaDeficiencia", BooleanType(), True),
-        StructField("identidadeGeneroCidadao", StringType(), True),
-        StructField("statusDesejaInformarIdentidadeGenero", BooleanType(), True),
-        StructField("responsavelPorCrianca", StringType(), True),
-        StructField("coPovoComunidadeTradicional", StringType(), True)
-    ]), True),
+    StructField("descricaoCausaInternacaoEm12Meses", StringType(), True),
+    StructField("descricaoOutraCondicao1", StringType(), True),
+    StructField("descricaoOutraCondicao2", StringType(), True),
+    StructField("descricaoOutraCondicao3", StringType(), True),
+    StructField("descricaoPlantasMedicinaisUsadas", ArrayType(StringType()), True),
+    StructField("doencaRespiratoria", ArrayType(StringType()), True),
+    StructField("doencaRins", ArrayType(StringType()), True),
+    StructField("maternidadeDeReferencia", StringType(), True),
+    StructField("situacaoPeso", StringType(), True),
+    StructField("statusEhDependenteAlcool", BooleanType(), True),
+    StructField("statusEhDependenteOutrasDrogas", BooleanType(), True),
+    StructField("statusEhFumante", BooleanType(), True),
+    StructField("statusEhGestante", BooleanType(), True),
+    StructField("statusEstaAcamado", BooleanType(), True),
+    StructField("statusEstaDomiciliado", BooleanType(), True),
+    StructField("statusTemDiabetes", BooleanType(), True),
+    StructField("statusTemDoencaRespiratoria", BooleanType(), True),
+    StructField("statusTemHanseniase", BooleanType(), True),
+    StructField("statusTemHipertensaoArterial", BooleanType(), True),
+    StructField("statusTemTeveCancer", BooleanType(), True),
+    StructField("statusTemTeveDoencasRins", BooleanType(), True),
+    StructField("statusTemTuberculose", BooleanType(), True),
+    StructField("statusTeveAvcDerrame", BooleanType(), True),
+    StructField("statusTeveDoencaCardiaca", BooleanType(), True),
+    StructField("statusTeveInfarto", BooleanType(), True),
+    StructField("statusTeveInternadoem12Meses", BooleanType(), True),
+    StructField("statusUsaOutrasPraticasIntegrativasOuComplementares", BooleanType(), True),
+    StructField("statusUsaPlantasMedicinais", BooleanType(), True),
+    StructField("statusDiagnosticoMental", StringType(), True),
+    StructField("grauParentescoFamiliarFrequentado", StringType(), True),
+    StructField("higienePessoalSituacaoRua", ArrayType(StringType()), True),
+    StructField("origemAlimentoSituacaoRua", ArrayType(StringType()), True),
+    StructField("outraInstituicaoQueAcompanha", StringType(), True),
+    StructField("quantidadeAlimentacoesAoDiaSituacaoRua", StringType(), True),
+    StructField("statusAcompanhadoPorOutraInstituicao", BooleanType(), True),
+    StructField("statusPossuiReferenciaFamiliar", BooleanType(), True),
+    StructField("statusRecebeBeneficio", BooleanType(), True),
+    StructField("statusSituacaoRua", BooleanType(), True),
+    StructField("statusTemAcessoHigienePessoalSituacaoRua", BooleanType(), True),
+    StructField("statusVisitaFamiliarFrequentemente", BooleanType(), True),
+    StructField("tempoSituacaoRua", StringType(), True),
+    StructField("nomeSocial", StringType(), True),
+    StructField("municĂ­pio", StringType(), True),
+    StructField("dataNascimentoCidadao", DateType(), True),
+    StructField("emailCidadao", StringType(), True),
+    StructField("nacionalidadeCidadao", StringType(), True),
+    StructField("nomeCidadao", StringType(), True),
+    StructField("nomeMaeCidadao", StringType(), True),
+    StructField("cnsCidadao", LongType(), True),
+    StructField("cnsResponsavelFamiliar", LongType(), True),
+    StructField("telefoneCelular", StringType(), True),
+    StructField("numeroNisPisPasep", LongType(), True),
+    StructField("paisNascimento", StringType(), True),
+    StructField("racaCorCidadao", StringType(), True),
+    StructField("sexoCidadao", StringType(), True),
+    StructField("statusEhResponsavel", BooleanType(), True),
+    StructField("etnia", StringType(), True),
+    StructField("nomePaiCidadao", StringType(), True),
+    StructField("desconheceNomePai", BooleanType(), True),
+    StructField("dtNaturalizacao", DateType(), True),
+    StructField("portariaNaturalizacao", StringType(), True),
+    StructField("dtEntradaBrasil", DateType(), True),
+    StructField("microarea", LongType(), True),
+    StructField("stForaArea", BooleanType(), True),
+    StructField("cpfCidadao", StringType(), True),
+    StructField("cpfResponsavelFamiliar", StringType(), True),
+    StructField("deficienciasCidadao", ArrayType(StringType()), True),
+    StructField("grauInstrucaoCidadao", StringType(), True),
+    StructField("ocupacao", StringType(), True),
+    StructField("orientacaoSexualCidadao", StringType(), True),
+    StructField("relacaoParentescoCidadao", StringType(), True),
+    StructField("situacaoMercadoTrabalhoCidadao", StringType(), True),
+    StructField("statusDesejaInformarOrientacaoSexual", BooleanType(), True),
+    StructField("statusFrequentaBenzedeira", BooleanType(), True),
+    StructField("statusFrequentaEscola", BooleanType(), True),
+    StructField("statusMembroPovoComunidadeTradicional", BooleanType(), True),
+    StructField("statusParticipaGrupoComunitario", BooleanType(), True),
+    StructField("statusPossuiPlanoSaudePrivado", BooleanType(), True),
+    StructField("statusTemAlgumaDeficiencia", BooleanType(), True),
+    StructField("identidadeGeneroCidadao", StringType(), True),
+    StructField("statusDesejaInformarIdentidadeGenero", BooleanType(), True),
+    StructField("responsavelPorCrianca", StringType(), True),
+    StructField("coPovoComunidadeTradicional", StringType(), True),
     StructField("statusTermoRecusaCadastroIndividualAtencaoBasica", BooleanType(), True),
-    StructField("saidaCidadaoCadastro", StructType([
-        StructField("motivoSaidaCidadao", StringType(), True),
-        StructField("dataObito", DateType(), True),
-        StructField("numeroDO", StringType(), True)
-    ]), True)
+    StructField("motivoSaidaCidadao", StringType(), True),
+    StructField("dataObito", DateType(), True),
+    StructField("numeroDO", StringType(), True)
 ])
 
 
-- 
GitLab