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

[HCI] Lançamento da Versão 2.1 do HCI #109

Merged
merged 76 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
0ee2b83
feat: add cns validator
d116626 Aug 29, 2024
492dc9e
chore: add cns logic ref
d116626 Aug 29, 2024
d68ff65
feat: add cns validator
d116626 Sep 26, 2024
9b5ad74
add vitai rules
vitmesquita Oct 7, 2024
269fcfd
chore: add proper br and timestamp to endereto field
d116626 Oct 8, 2024
5e11f21
chore: lint sql files
d116626 Oct 8, 2024
8441b87
chore: padronize email and endereco fields to proper_ber or lower case
d116626 Oct 8, 2024
54bf13b
chore: padronize sistema to lower case
d116626 Oct 8, 2024
cf9be4a
fix: dbt materialization error in endereco field tipo_logradouro
d116626 Oct 8, 2024
b207250
Merge branch 'master' into fix/deceased-table
ThiagoTrabach Oct 8, 2024
92f7ae2
removing null cpf row
vitmesquita Oct 8, 2024
0dc2859
Merge branch 'fix/deceased-table' of https://github.com/prefeitura-ri…
vitmesquita Oct 8, 2024
f2b7a98
fear: add cellphone padronization
d116626 Oct 8, 2024
545c64d
chore: merge master
d116626 Oct 8, 2024
ce10998
chore: merge master
d116626 Oct 8, 2024
59c1d2f
chore: add telefone padronization
d116626 Oct 8, 2024
531c2c8
chore: add ddd to mart_historico_clinico__paciente
d116626 Oct 8, 2024
618750e
chore: add cpf_particao in vitacare intermediate
d116626 Oct 8, 2024
09161cd
chore: add cpf_particao in vitacare intermediate
d116626 Oct 8, 2024
f48900c
chore: add cpf_particao in vitacare intermediate
d116626 Oct 8, 2024
4c884a3
chore: remove validate_cns macro from this branch
d116626 Oct 8, 2024
9ca5cae
fix: add ddd to mart_historico_cliniclo__paciente
d116626 Oct 8, 2024
54e5d9f
fix: sistema as lower case for mart_historico_cliniclo__paciente
d116626 Oct 8, 2024
28f7ecf
Merge branch 'master' into feat/add_cns_validation
TanookiVerde Oct 9, 2024
f252486
Merge branch 'master' into feat/add_cns_validation
TanookiVerde Oct 9, 2024
d1dc7c2
Merge pull request #108 from prefeitura-rio/master
TanookiVerde Oct 9, 2024
36f2be3
feat: add cep padronization
d116626 Oct 9, 2024
ba4004a
feat: filtering cns values using the validator
TanookiVerde Oct 9, 2024
3251c72
Merge branch 'feat/add_cns_validation' into release
TanookiVerde Oct 9, 2024
2fb7dc2
Merge branch 'release' into feat/padronize_patient_contato
TanookiVerde Oct 9, 2024
992590c
Update dbt_project.yml
TanookiVerde Oct 9, 2024
075af73
Remove underage exhibition rule
TanookiVerde Oct 9, 2024
9a65625
fix: format estado as lower case
TanookiVerde Oct 9, 2024
f1663b6
Merge pull request #110 from prefeitura-rio/feat/padronize_patient_co…
TanookiVerde Oct 9, 2024
aa8bd5e
Refactor: Update motivos field to be an empty array in mart_historico…
TanookiVerde Oct 9, 2024
d24735e
Merge pull request #111 from prefeitura-rio/remove-exhibition-restric…
TanookiVerde Oct 9, 2024
2890747
chore: Add SQL script for processing pharmacy statistics in the digit…
TanookiVerde Oct 10, 2024
0ad29fa
feat: including list of health units without data
TanookiVerde Oct 10, 2024
c91f1de
Merge pull request #112 from prefeitura-rio/feat/monitoramento-farmacia
TanookiVerde Oct 10, 2024
2821efd
Merge branch 'release' into fix/deceased-table
TanookiVerde Oct 10, 2024
7c9001f
Merge pull request #113 from prefeitura-rio/fix/deceased-table
TanookiVerde Oct 11, 2024
dc81a29
Refactor GitHub workflows for dbt compilation and deployment
TanookiVerde Oct 11, 2024
10cad7b
Add pre-commit hooks for preventing large files, detecting private ke…
TanookiVerde Oct 11, 2024
aedb50d
Refactor GitHub workflows to trigger dbt compilation only on pull req…
TanookiVerde Oct 11, 2024
df89c4a
Refactor GitHub workflows to install DBT dependencies before compilin…
TanookiVerde Oct 11, 2024
3f77169
Refactor GitHub workflows to add SQLFluff linting
TanookiVerde Oct 11, 2024
8a1d265
Refactor raw_prontuario_vitacare__estoque_posicao.sql for primary key…
TanookiVerde Oct 11, 2024
45d0f0d
Trigger Action
TanookiVerde Oct 11, 2024
951fe80
Refactor SQL linter workflow to use correct folder path for models
TanookiVerde Oct 11, 2024
f2a824e
Refactor GitHub workflows to install SQLFluff and sqlfluff-templater-…
TanookiVerde Oct 11, 2024
c38cd38
Refactor SQL linter workflow to remove unnecessary flag in the run co…
TanookiVerde Oct 11, 2024
d3e6735
chore: Update SQLFluff configuration for BigQuery dialect and dbt tem…
TanookiVerde Oct 11, 2024
82470fd
chore: Update SQLFluff configuration for BigQuery dialect and dbt tem…
TanookiVerde Oct 11, 2024
0b7eca8
chore: Update DBT and SQLFluff dependencies in SQL linter workflow
TanookiVerde Oct 11, 2024
2c20ea9
chore: Update Python version to 3.8 in SQL linter workflow
TanookiVerde Oct 11, 2024
aee2a7e
chore: Update Python version to 3.8 and install DBT dependencies in S…
TanookiVerde Oct 11, 2024
c96fbc7
chore: Increase max line length to 120 characters in SQLFluff configu…
TanookiVerde Oct 11, 2024
d75ef80
Merge branch 'release' of https://github.com/prefeitura-rio/queries-r…
TanookiVerde Oct 11, 2024
e93c376
chore: Update SQLFluff configuration to include large_file_skip_byte_…
TanookiVerde Oct 11, 2024
419d74b
chore: Using poetry env in SQL Linter Action
TanookiVerde Oct 11, 2024
53cb4ec
Merge branch 'release' of https://github.com/prefeitura-rio/queries-r…
TanookiVerde Oct 11, 2024
f086679
Merge branch 'release' of https://github.com/prefeitura-rio/queries-r…
TanookiVerde Oct 11, 2024
b631a44
chore: updating environment to include sqlfluff linter
TanookiVerde Oct 11, 2024
afb8402
chore: Remove virtual environment caching in SQL linter workflow
TanookiVerde Oct 11, 2024
74fd719
fix: Update SQL query to include prontuario_estoque_tem_dado filter
TanookiVerde Oct 11, 2024
6f22ae6
chore: Update poetry version to 1.7.1 in SQL linter workflow
TanookiVerde Oct 12, 2024
99fd7bd
chore: Update SQL linter workflow to use poetry run for dbt dependencies
TanookiVerde Oct 12, 2024
1192bd4
chore: Update SQL linter workflow to use poetry run for dbt dependencies
TanookiVerde Oct 12, 2024
e5bdcd1
fix: activating venv
TanookiVerde Oct 12, 2024
56f4263
chore: Ading poetry venv to path
TanookiVerde Oct 12, 2024
6b7a6a1
fix: using githubpath
TanookiVerde Oct 12, 2024
efd7a97
chore: Update SQL linter workflow to include verbose output
TanookiVerde Oct 12, 2024
1c7b075
chore: Update SQL linter workflow to individually lint each SQL file
TanookiVerde Oct 12, 2024
62f14a0
fix: lint all files
TanookiVerde Oct 12, 2024
505a8bd
chore: Linting files in models
TanookiVerde Oct 12, 2024
6109c21
Merge branch 'master' into release
TanookiVerde Oct 14, 2024
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
77 changes: 0 additions & 77 deletions .github/workflows/cd.yaml

This file was deleted.

9 changes: 6 additions & 3 deletions .github/workflows/dbt-compile.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: DBT Compile

on: [pull_request, push]
on: [pull_request]

jobs:
dbt-compile:
Expand All @@ -21,11 +21,14 @@ jobs:
- name: Mount credentials
env:
DBT_CREDENTIALS_DEV: ${{ secrets.DBT_CREDENTIALS_DEV }}
run: echo "$DBT_CREDENTIALS_DEV" > credentials/dev.json
run: echo "$DBT_CREDENTIALS_DEV" > /tmp/credentials.json

- name: Install dbt
run: pip install dbt-core dbt-bigquery setuptools

- name: Install DBT Dependencies
run: dbt deps

- name: Compile dbt models
run: dbt compile --profiles-dir . --profile default --target compile
run: dbt compile --profiles-dir . --profile default --target dev

15 changes: 0 additions & 15 deletions .github/workflows/lint_docker.yaml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/metadata_automation.yaml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/query_automation.yaml

This file was deleted.

96 changes: 96 additions & 0 deletions .github/workflows/sql-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: SQLFluff

on:
- pull_request

jobs:
lint-models:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: Install Python
uses: "actions/setup-python@v2"
with:
python-version: "3.10"

- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.7.1'

- name: Setup a local virtual environment (if no poetry.toml file)
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Install the project dependencies
run: poetry install --no-interaction

- name: Add Poetry virtualenv to PATH
run: |
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
- name: Install DBT Dependencies
run: "dbt deps"

- name: Get changed files
id: get_file_changes
uses: trilom/file-changes-action@v1.2.4
with:
output: ' '

- name: Display changed files
run: |
echo "Modified files: ${{ steps.get_file_changes.outputs.files_modified }}"
echo "Added files: ${{ steps.get_file_changes.outputs.files_added }}"
- name: Get changed .sql files in /models to lint
id: get_files_to_lint
shell: bash -l {0}
run: |
# Set the command in the $() brackets as an output to use in later steps
echo "::set-output name=lintees::$(
# Issue where grep regular expressions don't work as expected on the
# Github Actions shell, check models/ folder
echo \
$(echo ${{ steps.get_file_changes.outputs.files_modified }} |
tr -s ' ' '\n' |
grep -E '^models.*[.]sql$' |
tr -s '\n' ' ') \
$(echo ${{ steps.get_file_changes.outputs.files_added }} |
tr -s ' ' '\n' |
grep -E '^models.*[.]sql$' |
tr -s '\n' ' ')
)"
- name: Lint each SQL file individually
run: |
# Loop through each changed SQL file and lint them individually
for file in ${{ steps.get_file_changes.outputs.files_modified }} ${{ steps.get_file_changes.outputs.files_added }}; do
if [[ $file == *.sql ]]; then
echo "Linting $file"
sqlfluff lint failure $file || exit_code=$?
fi
done
shell: bash

- name: Fail if any file had a linting error
run: |
if [[ -n "$exit_code" ]]; then
exit $exit_code
fi
- name: Lint dbt models
id: sqlfluff_json
if: steps.get_files_to_lint.outputs.lintees != ''
shell: bash -l {0}
run: sqlfluff lint ./models/ > annotations.json

- name: Annotate
uses: yuzutech/annotations-action@v0.3.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
title: "SQLFluff Lint"
input: "./annotations.json"
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files # prevents adding large files
- id: detect-private-key # detects private keys
- id: fix-byte-order-marker # fixes BOM
54 changes: 54 additions & 0 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[sqlfluff]

dialect = bigquery

templater = dbt

runaway_limit = 10

max_line_length = 120

indent_unit = space
large_file_skip_byte_limit = 30000

[sqlfluff:indentation]

tab_space_size = 4

[sqlfluff:layout:type:comma]

spacing_before = touch

line_position = trailing

[sqlfluff:rules:capitalisation.keywords]

capitalisation_policy = upper

[sqlfluff:rules:aliasing.table]

aliasing = explicit

[sqlfluff:rules:aliasing.column]

aliasing = explicit

[sqlfluff:rules:aliasing.expression]

allow_scalar = False

[sqlfluff:rules:capitalisation.identifiers]

extended_capitalisation_policy = lower

[sqlfluff:rules:capitalisation.functions]

capitalisation_policy = lower

[sqlfluff:rules:capitalisation.literals]

capitalisation_policy = lower

[sqlfluff:rules:ambiguous.column_references] # Number in group by

group_by_and_order_by_style = implicit
Loading
Loading