SINAN FTP Database

Available diseases and years to download

[1]:
from pysus.ftp.databases.sinan import SINAN
sinan = SINAN().load() # Loads the files from DATASUS
[2]:
sinan.metadata
[2]:
{'long_name': 'Doenças e Agravos de Notificação',
 'source': 'https://portalsinan.saude.gov.br/',
 'description': 'The Notifiable Diseases Information System - Sinan is primarilyfed by the notification and investigation of cases of diseases and conditions listed in the national list of compulsorily notifiable diseases (Consolidation Ordinance No. 4, September 28, 2017, Annex).However, states and municipalities are allowed to include other important health problems in their region, such as difilobotriasis in the municipality of São Paulo. Its effective use enables the dynamic diagnosis of the occurrence of an event in the population, providing evidence for causal explanations of compulsorily notifiable diseases and indicating risks to which people are exposed. This contributes to identifying the epidemiological reality of a specific geographical area. Its systematic, decentralized use contributes to the democratization of information, allowing all healthcare professionals to access and make it available to the community. Therefore, it is a relevant tool to assist in health planning, define intervention priorities, and evaluate the impact of interventions.'}

Listing SINAN Codes & Diseases

[3]:
sinan.diseases
[3]:
{'ACBI': 'Acidente de trabalho com material biológico',
 'ACGR': 'Acidente de trabalho',
 'ANIM': 'Acidente por Animais Peçonhentos',
 'ANTR': 'Atendimento Antirrabico',
 'BOTU': 'Botulismo',
 'CANC': 'Cancêr relacionado ao trabalho',
 'CHAG': 'Doença de Chagas Aguda',
 'CHIK': 'Febre de Chikungunya',
 'COLE': 'Cólera',
 'COQU': 'Coqueluche',
 'DENG': 'Dengue',
 'DERM': 'Dermatoses ocupacionais',
 'DIFT': 'Difteria',
 'ESQU': 'Esquistossomose',
 'EXAN': 'Doença exantemáticas',
 'FMAC': 'Febre Maculosa',
 'FTIF': 'Febre Tifóide',
 'HANS': 'Hanseníase',
 'HANT': 'Hantavirose',
 'HEPA': 'Hepatites Virais',
 'IEXO': 'Intoxicação Exógena',
 'INFL': 'Influenza Pandêmica',
 'LEIV': 'Leishmaniose Visceral',
 'LEPT': 'Leptospirose',
 'LERD': 'LER/Dort',
 'LTAN': 'Leishmaniose Tegumentar Americana',
 'MALA': 'Malária',
 'MENI': 'Meningite',
 'MENT': 'Transtornos mentais relacionados ao trabalho',
 'NTRA': 'Notificação de Tracoma',
 'PAIR': 'Perda auditiva por ruído relacionado ao trabalho',
 'PEST': 'Peste',
 'PFAN': 'Paralisia Flácida Aguda',
 'PNEU': 'Pneumoconioses realacionadas ao trabalho',
 'RAIV': 'Raiva',
 'SDTA': 'Surto Doenças Transmitidas por Alimentos',
 'SIFA': 'Sífilis Adquirida',
 'SIFC': 'Sífilis Congênita',
 'SIFG': 'Sífilis em Gestante',
 'SRC': 'Síndrome da Rubéola Congênia',
 'TETA': 'Tétano Acidental',
 'TETN': 'Tétano Neonatal',
 'TOXC': 'Toxoplasmose Congênita',
 'TOXG': 'Toxoplasmose Gestacional',
 'TRAC': 'Inquérito de Tracoma',
 'TUBE': 'Tuberculose',
 'VARC': 'Varicela',
 'VIOL': 'Violência doméstica, sexual e/ou outras violências',
 'ZIKA': 'Zika Vírus'}

Getting specific files

[4]:
sinan.get_files(dis_code=["ZIKA", "CHIK"])
[4]:
[CHIKBR15.dbc,
 CHIKBR16.dbc,
 CHIKBR17.dbc,
 CHIKBR18.dbc,
 CHIKBR19.dbc,
 CHIKBR20.dbc,
 CHIKBR21.dbc,
 CHIKBR22.dbc,
 CHIKBR23.dbc,
 ZIKABR16.dbc,
 ZIKABR17.dbc,
 ZIKABR18.dbc,
 ZIKABR19.dbc,
 ZIKABR20.dbc,
 ZIKABR21.dbc,
 ZIKABR22.dbc,
 ZIKABR23.dbc]
[5]:
sinan.get_files(year=2023)
[5]:
[BOTUBR23.dbc,
 CHIKBR23.dbc,
 DENGBR23.dbc,
 ESQUBR23.dbc,
 FTIFBR23.dbc,
 HANSBR23.dbc,
 MENIBR23.dbc,
 TOXCBR23.dbc,
 TOXGBR23.dbc,
 TUBEBR23.dbc,
 VARCBR23.dbc,
 ZIKABR23.dbc]
[6]:
sinan.get_files(dis_code=["DENG", "ZIKA"], year=[2022, 2023])
[6]:
[DENGBR22.dbc, DENGBR23.dbc, ZIKABR22.dbc, ZIKABR23.dbc]
[7]:
files = sinan.get_files(dis_code="BOTU", year=[2007, 2008])
botu_2007, botu_2008 = files

Describing a file inside DATASUS server

[8]:
sinan.describe(botu_2007)
[8]:
{'name': 'BOTUBR07.dbc',
 'disease': 'Botulismo',
 'year': 2007,
 'size': '7.5 kB',
 'last_update': '2021-11-23 11:55AM'}
[9]:
sinan.describe(botu_2008)
[9]:
{'name': 'BOTUBR08.dbc',
 'disease': 'Botulismo',
 'year': 2008,
 'size': '8.3 kB',
 'last_update': '2021-11-23 11:56AM'}

Downloading files

You can rather download multiple files or download them individually:

[10]:
sinan.download(files) # Downloads to default directory
100%|████████████████████████████| 8.35k/8.35k [00:00<00:00, 6.12MB/s]
[10]:
[/home/bida/pysus/BOTUBR07.parquet, /home/bida/pysus/BOTUBR08.parquet]
[11]:
botu_2007.download() # or specify a custom directory with `local_dir=`
[11]:
/home/bida/pysus/BOTUBR07.parquet

@Note: If the file has been downloaded already, it’s required to delete it in order to download the lastest updated file from DATASUS.

Reading files

PySUS uses Parquets as output, use the method to_dataframe() to read the file as pandas DataFrame

[12]:
parquet = botu_2007.download()
[13]:
parquet.to_dataframe()
[13]:
TP_NOT ID_AGRAVO DT_NOTIFIC SEM_NOT NU_ANO SG_UF_NOT ID_MUNICIP ID_REGIONA ID_UNIDADE DT_SIN_PRI ... NU_PROTEI DT_LIQUOR TP_SENSITI TP_MOTORA TP_REPETE DS_ALI1 DS_ALI2 DS_LOCAL1 DS_LOCAL2 DT_ENCERRA
0 2 A051 2007-01-12 200702 2007 41 410690 1356 2384299 2006-12-31 ... 53 20070112 2 2 3 20070222
1 2 A051 2007-01-12 200702 2007 35 355030 1331 2077485 2007-01-10 ... TORTA DE PALMITO/ FRANGO . 20070323
2 2 A051 2007-01-03 200701 2007 52 521180 1791 2381532 2006-11-16 ... 20070515
3 2 A051 2007-01-08 200702 2007 43 431410 1611 2246988 2007-01-03 ... 31 20070107 SALAME DOMICILIO
4 2 A051 2007-02-27 200709 2007 50 500830 1973 2757206 2007-02-27 ... 20070816
5 2 A051 2007-02-16 200707 2007 35 354340 1348 2082187 2006-12-12 ... 1 2 2
6 2 A051 2007-02-15 200707 2007 33 330170 2290227 2007-02-12 ... 27 20070214 20070724
7 2 A051 2007-02-28 200709 2007 22 220800 1888 4009622 2007-02-28 ... 20070503
8 2 A051 2007-05-12 200719 2007 27 270710 1539 2721643 2007-05-09 ... 20070716
9 2 A051 2007-06-11 200724 2007 35 354850 1349 2025752 2007-06-11 ... 20071120
10 2 A051 2007-06-22 200725 2007 35 352340 1342 2023709 2007-06-12 ... 40 20070616 20070704
11 2 A051 2007-06-27 200726 2007 29 292740 1380 0004057 2007-06-25 ... 39 20070625 2 2 20070730
12 2 A051 2007-07-30 200731 2007 53 530010 0010456 2007-07-26 ... 83 20070728 1 2 2 20070730
13 2 A051 2007-07-10 200728 2007 52 520870 1779 2338262 2007-05-08 ... 20070814
14 2 A051 2007-08-28 200735 2007 35 354850 1349 2079720 2007-08-17 ... SALGADO TORTA PAO COM QUEIJO C CASA DE MASSAS ROMANA EM SANTO 20070903
15 2 A051 2007-08-24 200734 2007 35 354850 1349 2079720 2007-08-17 ... 20070819 20071025
16 2 A051 2007-08-17 200733 2007 35 355030 1331 2077574 2007-08-12 ... 40 20070813
17 2 A051 2007-08-20 200734 2007 51 510340 1578 2495015 2007-08-18 ... 20070918
18 2 A051 2007-08-23 200734 2007 23 230440 1519 2482169 2007-08-19 ... MORTADELA DOMICILIO 20071023
19 2 A051 2007-09-16 200738 2007 31 317010 1461 2206595 2007-09-08 ... 20070915 20071017
20 2 A051 2007-09-06 200736 2007 35 354340 1348 2082187 2007-08-31 ...
21 2 A051 2007-09-04 200736 2007 35 355220 1353 2081695 2007-08-31 ...
22 2 A051 2007-10-08 200741 2007 35 355220 1353 2081695 2007-10-08 ...
23 2 A051 2007-10-02 200740 2007 31 314330 1473 2149990 2007-09-28 ... 19 20070930 20080601
24 2 A051 2007-11-06 200745 2007 35 355220 1353 2078732 2007-11-03 ... 20071105 20080108
25 2 A051 2007-11-01 200744 2007 52 520870 1779 2518406 2007-10-02 ... 1 1 1 20071112

26 rows × 140 columns