Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging for Development #901

Merged
merged 13 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions next/components/molecules/ColumnsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ export default function ColumnsTable({
Não precisa de tradução
</Text>
)
const cloudValues = value?.table?.cloudTables?.edges?.[0]?.node
const gcpDatasetID = cloudValues?.gcpDatasetId || ""
const gcpTableId = cloudValues?.gcpTableId || ""

if(gcpDatasetID === "br_bd_diretorios_data_tempo") return "Não precisa de tradução"
if(gcpDatasetID === "br_bd_diretorios_brasil") {
if(gcpTableId === "empresa" || gcpTableId === "cep") return "Não precisa de tradução"
}
if(value?.name === "ddd") return "Não precisa de tradução"

if(value?.table?.isClosed) return (
<Box>
Expand All @@ -244,10 +253,6 @@ export default function ColumnsTable({
</Box>
)

const cloudValues = value?.table?.cloudTables?.edges?.[0]?.node

const gcpDatasetID = cloudValues?.gcpDatasetId || ""
const gcpTableId = cloudValues?.gcpTableId || ""
const downloadUrl = `https://storage.googleapis.com/basedosdados-public/one-click-download/${gcpDatasetID}/${gcpTableId}/${gcpTableId}.csv.gz`

const datasetName = value?.table?.dataset?.name || ""
Expand Down Expand Up @@ -385,6 +390,22 @@ export default function ColumnsTable({
)
}

function TranslationColumnException({ value }) {
const cloudValues = value?.node?.directoryPrimaryKey?.table?.cloudTables?.edges?.[0]?.node
const gcpDatasetID = cloudValues?.gcpDatasetId || ""
const gcpTableId = cloudValues?.gcpTableId || ""

if(gcpDatasetID === "br_bd_diretorios_data_tempo") return "Não"
if(gcpDatasetID === "br_bd_diretorios_brasil") {
if(gcpTableId === "empresa" || gcpTableId === "cep") return "Não"
}
if(value?.node?.name === "ddd") return "Não"
if(value?.node?.coveredByDictionary === true) return "Sim"
if(value?.node?.directoryPrimaryKey?._id) return "Sim"
if(value?.node?.coveredByDictionary === false) return "Não"
return "Não informado"
}

if(isError) return (
<Stack justifyContent="center" alignItems="center">
<InternalError
Expand Down Expand Up @@ -521,12 +542,7 @@ export default function ColumnsTable({
{template === "download" ?
<TranslationTable value={elm?.node?.directoryPrimaryKey}/>
:

elm?.node?.coveredByDictionary === true ? "Sim" :
elm?.node?.directoryPrimaryKey?._id ? "Sim" :
elm?.node?.coveredByDictionary === false ? "Não"
:
"Não informado"
<TranslationColumnException value={elm}/>
}
</TableValue>

Expand Down
26 changes: 13 additions & 13 deletions next/components/molecules/DataInformationQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,13 +790,13 @@ export default function DataInformationQuery({ resource }) {
>
<CodeHighlight language="python">{`import basedosdados as bd

billing_id = <seu_billing_id>
billing_id = <seu_billing_id>

query = """
${sqlCode}
"""
query = """
${sqlCode}
"""

bd.read_sql(query = query, billing_project_id = billing_id)`}
bd.read_sql(query = query, billing_project_id = billing_id)`}
</CodeHighlight>
</Skeleton>
</TabPanel>
Expand Down Expand Up @@ -860,16 +860,16 @@ export default function DataInformationQuery({ resource }) {
isLoaded={!isLoadingCode}
>
<CodeHighlight language="r">{`
# Defina o seu projeto no Google Cloud
set_billing_id("<YOUR_PROJECT_ID>")
# Defina o seu projeto no Google Cloud
set_billing_id("<YOUR_PROJECT_ID>")

# Para carregar o dado direto no R
query <- "
${sqlCode}
"
# Para carregar o dado direto no R
query <- "
${sqlCode}
"

read_sql(query, billing_project_id = get_billing_id())
`}
read_sql(query, billing_project_id = get_billing_id())
`}
</CodeHighlight>
</Skeleton>
</TabPanel>
Expand Down
18 changes: 17 additions & 1 deletion next/components/organisms/BdmTablePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ export default function BdmTablePage({ id }) {
:
"Não informado"
}: Última vez que atualizaram na fonte original
{resource?.rawDataSource?.[0]?.updates?.[0]?.entity?.slug &&
{resource?.rawDataSource?.[0]?.updates?.[0]?.entity?.slug ?
<Text
backgroundColor="#EEEEEE"
padding="2px 4px"
Expand All @@ -403,6 +403,22 @@ export default function BdmTablePage({ id }) {
>
{getUpdateFormat(resource?.rawDataSource?.[0]?.updates?.[0]?.entity?.slug)}
</Text>
:
!resource?.rawDataSource?.[0]?.updates?.[0] || !resource?.updates?.[0]?.frequency ?
<Text
backgroundColor="#EEEEEE"
padding="2px 4px"
borderRadius="4px"
fontFamily="Roboto"
fontWeight="500"
fontSize="12px"
lineHeight="18px"
color="#252A32"
>
Sem previsão de atualização
</Text>
:
<></>
}
</Box>
<Text
Expand Down
1 change: 1 addition & 0 deletions next/pages/dataset/[dataset].js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default function DatasetPage ({ dataset }) {
>
<GridItem
display="flex"
height="fit-content"
justifyContent="center"
border="1px solid #DEDFE0"
borderRadius="16px"
Expand Down
Loading
Loading