sih-br-mcp 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/dist/cache.d.ts +108 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +270 -0
- package/dist/cache.js.map +1 -0
- package/dist/data/brazil-regions.json +68 -0
- package/dist/data/cid-chapters.json +163 -0
- package/dist/data/csap-groups-cid9.json +4281 -0
- package/dist/data/csap-groups.json +262 -0
- package/dist/db/duckdb.d.ts +263 -0
- package/dist/db/duckdb.d.ts.map +1 -0
- package/dist/db/duckdb.js +837 -0
- package/dist/db/duckdb.js.map +1 -0
- package/dist/freshness.d.ts +101 -0
- package/dist/freshness.d.ts.map +1 -0
- package/dist/freshness.js +303 -0
- package/dist/freshness.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1504 -0
- package/dist/index.js.map +1 -0
- package/dist/provenance.d.ts +217 -0
- package/dist/provenance.d.ts.map +1 -0
- package/dist/provenance.js +534 -0
- package/dist/provenance.js.map +1 -0
- package/dist/utils/age-groups.d.ts +164 -0
- package/dist/utils/age-groups.d.ts.map +1 -0
- package/dist/utils/age-groups.js +112 -0
- package/dist/utils/age-groups.js.map +1 -0
- package/dist/utils/population.d.ts +39 -0
- package/dist/utils/population.d.ts.map +1 -0
- package/dist/utils/population.js +114 -0
- package/dist/utils/population.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilitários para manipulação de faixas etárias
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Faixas etárias padrão utilizadas no projeto
|
|
6
|
+
*/
|
|
7
|
+
export declare const AGE_GROUPS: readonly [{
|
|
8
|
+
readonly code: "<1";
|
|
9
|
+
readonly label: "Menor de 1 ano";
|
|
10
|
+
readonly min: 0;
|
|
11
|
+
readonly max: 0;
|
|
12
|
+
}, {
|
|
13
|
+
readonly code: "1-4";
|
|
14
|
+
readonly label: "1 a 4 anos";
|
|
15
|
+
readonly min: 1;
|
|
16
|
+
readonly max: 4;
|
|
17
|
+
}, {
|
|
18
|
+
readonly code: "5-9";
|
|
19
|
+
readonly label: "5 a 9 anos";
|
|
20
|
+
readonly min: 5;
|
|
21
|
+
readonly max: 9;
|
|
22
|
+
}, {
|
|
23
|
+
readonly code: "10-14";
|
|
24
|
+
readonly label: "10 a 14 anos";
|
|
25
|
+
readonly min: 10;
|
|
26
|
+
readonly max: 14;
|
|
27
|
+
}, {
|
|
28
|
+
readonly code: "15-19";
|
|
29
|
+
readonly label: "15 a 19 anos";
|
|
30
|
+
readonly min: 15;
|
|
31
|
+
readonly max: 19;
|
|
32
|
+
}, {
|
|
33
|
+
readonly code: "20-29";
|
|
34
|
+
readonly label: "20 a 29 anos";
|
|
35
|
+
readonly min: 20;
|
|
36
|
+
readonly max: 29;
|
|
37
|
+
}, {
|
|
38
|
+
readonly code: "30-39";
|
|
39
|
+
readonly label: "30 a 39 anos";
|
|
40
|
+
readonly min: 30;
|
|
41
|
+
readonly max: 39;
|
|
42
|
+
}, {
|
|
43
|
+
readonly code: "40-49";
|
|
44
|
+
readonly label: "40 a 49 anos";
|
|
45
|
+
readonly min: 40;
|
|
46
|
+
readonly max: 49;
|
|
47
|
+
}, {
|
|
48
|
+
readonly code: "50-59";
|
|
49
|
+
readonly label: "50 a 59 anos";
|
|
50
|
+
readonly min: 50;
|
|
51
|
+
readonly max: 59;
|
|
52
|
+
}, {
|
|
53
|
+
readonly code: "60-69";
|
|
54
|
+
readonly label: "60 a 69 anos";
|
|
55
|
+
readonly min: 60;
|
|
56
|
+
readonly max: 69;
|
|
57
|
+
}, {
|
|
58
|
+
readonly code: "70-79";
|
|
59
|
+
readonly label: "70 a 79 anos";
|
|
60
|
+
readonly min: 70;
|
|
61
|
+
readonly max: 79;
|
|
62
|
+
}, {
|
|
63
|
+
readonly code: "80+";
|
|
64
|
+
readonly label: "80 anos ou mais";
|
|
65
|
+
readonly min: 80;
|
|
66
|
+
readonly max: 150;
|
|
67
|
+
}];
|
|
68
|
+
export type AgeGroupCode = (typeof AGE_GROUPS)[number]["code"];
|
|
69
|
+
/**
|
|
70
|
+
* Converte idade em anos para código de faixa etária
|
|
71
|
+
*/
|
|
72
|
+
export declare function ageToGroup(age: number): AgeGroupCode;
|
|
73
|
+
/**
|
|
74
|
+
* Retorna informações de uma faixa etária pelo código
|
|
75
|
+
*/
|
|
76
|
+
export declare function getAgeGroup(code: string): {
|
|
77
|
+
readonly code: "<1";
|
|
78
|
+
readonly label: "Menor de 1 ano";
|
|
79
|
+
readonly min: 0;
|
|
80
|
+
readonly max: 0;
|
|
81
|
+
} | {
|
|
82
|
+
readonly code: "1-4";
|
|
83
|
+
readonly label: "1 a 4 anos";
|
|
84
|
+
readonly min: 1;
|
|
85
|
+
readonly max: 4;
|
|
86
|
+
} | {
|
|
87
|
+
readonly code: "5-9";
|
|
88
|
+
readonly label: "5 a 9 anos";
|
|
89
|
+
readonly min: 5;
|
|
90
|
+
readonly max: 9;
|
|
91
|
+
} | {
|
|
92
|
+
readonly code: "10-14";
|
|
93
|
+
readonly label: "10 a 14 anos";
|
|
94
|
+
readonly min: 10;
|
|
95
|
+
readonly max: 14;
|
|
96
|
+
} | {
|
|
97
|
+
readonly code: "15-19";
|
|
98
|
+
readonly label: "15 a 19 anos";
|
|
99
|
+
readonly min: 15;
|
|
100
|
+
readonly max: 19;
|
|
101
|
+
} | {
|
|
102
|
+
readonly code: "20-29";
|
|
103
|
+
readonly label: "20 a 29 anos";
|
|
104
|
+
readonly min: 20;
|
|
105
|
+
readonly max: 29;
|
|
106
|
+
} | {
|
|
107
|
+
readonly code: "30-39";
|
|
108
|
+
readonly label: "30 a 39 anos";
|
|
109
|
+
readonly min: 30;
|
|
110
|
+
readonly max: 39;
|
|
111
|
+
} | {
|
|
112
|
+
readonly code: "40-49";
|
|
113
|
+
readonly label: "40 a 49 anos";
|
|
114
|
+
readonly min: 40;
|
|
115
|
+
readonly max: 49;
|
|
116
|
+
} | {
|
|
117
|
+
readonly code: "50-59";
|
|
118
|
+
readonly label: "50 a 59 anos";
|
|
119
|
+
readonly min: 50;
|
|
120
|
+
readonly max: 59;
|
|
121
|
+
} | {
|
|
122
|
+
readonly code: "60-69";
|
|
123
|
+
readonly label: "60 a 69 anos";
|
|
124
|
+
readonly min: 60;
|
|
125
|
+
readonly max: 69;
|
|
126
|
+
} | {
|
|
127
|
+
readonly code: "70-79";
|
|
128
|
+
readonly label: "70 a 79 anos";
|
|
129
|
+
readonly min: 70;
|
|
130
|
+
readonly max: 79;
|
|
131
|
+
} | {
|
|
132
|
+
readonly code: "80+";
|
|
133
|
+
readonly label: "80 anos ou mais";
|
|
134
|
+
readonly min: 80;
|
|
135
|
+
readonly max: 150;
|
|
136
|
+
} | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Valida se um código de faixa etária é válido
|
|
139
|
+
*/
|
|
140
|
+
export declare function isValidAgeGroup(code: string): code is AgeGroupCode;
|
|
141
|
+
/**
|
|
142
|
+
* Retorna faixas etárias para população idosa (60+)
|
|
143
|
+
*/
|
|
144
|
+
export declare function getElderlyAgeGroups(): AgeGroupCode[];
|
|
145
|
+
/**
|
|
146
|
+
* Retorna faixas etárias para crianças (0-14)
|
|
147
|
+
*/
|
|
148
|
+
export declare function getChildrenAgeGroups(): AgeGroupCode[];
|
|
149
|
+
/**
|
|
150
|
+
* Retorna faixas etárias para adultos em idade ativa (15-59)
|
|
151
|
+
*/
|
|
152
|
+
export declare function getWorkingAgeGroups(): AgeGroupCode[];
|
|
153
|
+
/**
|
|
154
|
+
* Pesos populacionais padrão OMS para ajuste por idade
|
|
155
|
+
* (Distribuição etária padrão mundial 2000-2025)
|
|
156
|
+
*/
|
|
157
|
+
export declare const WHO_STANDARD_POPULATION: Record<AgeGroupCode, number>;
|
|
158
|
+
/**
|
|
159
|
+
* Calcula taxa ajustada por idade usando método direto
|
|
160
|
+
* @param ratesByAge Taxas específicas por faixa etária
|
|
161
|
+
* @returns Taxa padronizada (ajustada)
|
|
162
|
+
*/
|
|
163
|
+
export declare function calculateAgeAdjustedRate(ratesByAge: Record<AgeGroupCode, number>): number;
|
|
164
|
+
//# sourceMappingURL=age-groups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"age-groups.d.ts","sourceRoot":"","sources":["../../src/utils/age-groups.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU;aACnB,IAAI,EAAE,IAAI;aAAE,KAAK,EAAE,gBAAgB;aAAE,GAAG,EAAE,CAAC;aAAE,GAAG,EAAE,CAAC;;aACnD,IAAI,EAAE,KAAK;aAAE,KAAK,EAAE,YAAY;aAAE,GAAG,EAAE,CAAC;aAAE,GAAG,EAAE,CAAC;;aAChD,IAAI,EAAE,KAAK;aAAE,KAAK,EAAE,YAAY;aAAE,GAAG,EAAE,CAAC;aAAE,GAAG,EAAE,CAAC;;aAChD,IAAI,EAAE,OAAO;aAAE,KAAK,EAAE,cAAc;aAAE,GAAG,EAAE,EAAE;aAAE,GAAG,EAAE,EAAE;;aACtD,IAAI,EAAE,OAAO;aAAE,KAAK,EAAE,cAAc;aAAE,GAAG,EAAE,EAAE;aAAE,GAAG,EAAE,EAAE;;aACtD,IAAI,EAAE,OAAO;aAAE,KAAK,EAAE,cAAc;aAAE,GAAG,EAAE,EAAE;aAAE,GAAG,EAAE,EAAE;;aACtD,IAAI,EAAE,OAAO;aAAE,KAAK,EAAE,cAAc;aAAE,GAAG,EAAE,EAAE;aAAE,GAAG,EAAE,EAAE;;aACtD,IAAI,EAAE,OAAO;aAAE,KAAK,EAAE,cAAc;aAAE,GAAG,EAAE,EAAE;aAAE,GAAG,EAAE,EAAE;;aACtD,IAAI,EAAE,OAAO;aAAE,KAAK,EAAE,cAAc;aAAE,GAAG,EAAE,EAAE;aAAE,GAAG,EAAE,EA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eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,YAAY,CAElE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CAEpD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,YAAY,EAAE,CAErD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CAEpD;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAahE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,GACvC,MAAM,CASR"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilitários para manipulação de faixas etárias
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Faixas etárias padrão utilizadas no projeto
|
|
6
|
+
*/
|
|
7
|
+
export const AGE_GROUPS = [
|
|
8
|
+
{ code: "<1", label: "Menor de 1 ano", min: 0, max: 0 },
|
|
9
|
+
{ code: "1-4", label: "1 a 4 anos", min: 1, max: 4 },
|
|
10
|
+
{ code: "5-9", label: "5 a 9 anos", min: 5, max: 9 },
|
|
11
|
+
{ code: "10-14", label: "10 a 14 anos", min: 10, max: 14 },
|
|
12
|
+
{ code: "15-19", label: "15 a 19 anos", min: 15, max: 19 },
|
|
13
|
+
{ code: "20-29", label: "20 a 29 anos", min: 20, max: 29 },
|
|
14
|
+
{ code: "30-39", label: "30 a 39 anos", min: 30, max: 39 },
|
|
15
|
+
{ code: "40-49", label: "40 a 49 anos", min: 40, max: 49 },
|
|
16
|
+
{ code: "50-59", label: "50 a 59 anos", min: 50, max: 59 },
|
|
17
|
+
{ code: "60-69", label: "60 a 69 anos", min: 60, max: 69 },
|
|
18
|
+
{ code: "70-79", label: "70 a 79 anos", min: 70, max: 79 },
|
|
19
|
+
{ code: "80+", label: "80 anos ou mais", min: 80, max: 150 },
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Converte idade em anos para código de faixa etária
|
|
23
|
+
*/
|
|
24
|
+
export function ageToGroup(age) {
|
|
25
|
+
if (age < 0)
|
|
26
|
+
return "<1";
|
|
27
|
+
if (age < 1)
|
|
28
|
+
return "<1";
|
|
29
|
+
if (age < 5)
|
|
30
|
+
return "1-4";
|
|
31
|
+
if (age < 10)
|
|
32
|
+
return "5-9";
|
|
33
|
+
if (age < 15)
|
|
34
|
+
return "10-14";
|
|
35
|
+
if (age < 20)
|
|
36
|
+
return "15-19";
|
|
37
|
+
if (age < 30)
|
|
38
|
+
return "20-29";
|
|
39
|
+
if (age < 40)
|
|
40
|
+
return "30-39";
|
|
41
|
+
if (age < 50)
|
|
42
|
+
return "40-49";
|
|
43
|
+
if (age < 60)
|
|
44
|
+
return "50-59";
|
|
45
|
+
if (age < 70)
|
|
46
|
+
return "60-69";
|
|
47
|
+
if (age < 80)
|
|
48
|
+
return "70-79";
|
|
49
|
+
return "80+";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Retorna informações de uma faixa etária pelo código
|
|
53
|
+
*/
|
|
54
|
+
export function getAgeGroup(code) {
|
|
55
|
+
return AGE_GROUPS.find((g) => g.code === code);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Valida se um código de faixa etária é válido
|
|
59
|
+
*/
|
|
60
|
+
export function isValidAgeGroup(code) {
|
|
61
|
+
return AGE_GROUPS.some((g) => g.code === code);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Retorna faixas etárias para população idosa (60+)
|
|
65
|
+
*/
|
|
66
|
+
export function getElderlyAgeGroups() {
|
|
67
|
+
return ["60-69", "70-79", "80+"];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Retorna faixas etárias para crianças (0-14)
|
|
71
|
+
*/
|
|
72
|
+
export function getChildrenAgeGroups() {
|
|
73
|
+
return ["<1", "1-4", "5-9", "10-14"];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Retorna faixas etárias para adultos em idade ativa (15-59)
|
|
77
|
+
*/
|
|
78
|
+
export function getWorkingAgeGroups() {
|
|
79
|
+
return ["15-19", "20-29", "30-39", "40-49", "50-59"];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Pesos populacionais padrão OMS para ajuste por idade
|
|
83
|
+
* (Distribuição etária padrão mundial 2000-2025)
|
|
84
|
+
*/
|
|
85
|
+
export const WHO_STANDARD_POPULATION = {
|
|
86
|
+
"<1": 0.0177,
|
|
87
|
+
"1-4": 0.0707,
|
|
88
|
+
"5-9": 0.0879,
|
|
89
|
+
"10-14": 0.0858,
|
|
90
|
+
"15-19": 0.0847,
|
|
91
|
+
"20-29": 0.1620,
|
|
92
|
+
"30-39": 0.1399,
|
|
93
|
+
"40-49": 0.1210,
|
|
94
|
+
"50-59": 0.0905,
|
|
95
|
+
"60-69": 0.0661,
|
|
96
|
+
"70-79": 0.0448,
|
|
97
|
+
"80+": 0.0289,
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Calcula taxa ajustada por idade usando método direto
|
|
101
|
+
* @param ratesByAge Taxas específicas por faixa etária
|
|
102
|
+
* @returns Taxa padronizada (ajustada)
|
|
103
|
+
*/
|
|
104
|
+
export function calculateAgeAdjustedRate(ratesByAge) {
|
|
105
|
+
let adjustedRate = 0;
|
|
106
|
+
for (const [ageGroup, weight] of Object.entries(WHO_STANDARD_POPULATION)) {
|
|
107
|
+
const rate = ratesByAge[ageGroup] || 0;
|
|
108
|
+
adjustedRate += rate * weight;
|
|
109
|
+
}
|
|
110
|
+
return adjustedRate;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=age-groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"age-groups.js","sourceRoot":"","sources":["../../src/utils/age-groups.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,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,mBAAmB;IACjC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAiC;IACnE,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,MAAM;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,UAAwC;IAExC,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,GAAG,UAAU,CAAC,QAAwB,CAAC,IAAI,CAAC,CAAC;QACvD,YAAY,IAAI,IAAI,GAAG,MAAM,CAAC;IAChC,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilitários para manipulação de dados populacionais
|
|
3
|
+
*
|
|
4
|
+
* NOTA: Dados populacionais foram adiados para fase futura.
|
|
5
|
+
* Este arquivo contém apenas funções utilitárias de mapeamento.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Calcula taxa por 10.000 habitantes
|
|
9
|
+
*/
|
|
10
|
+
export declare function calculateRate(count: number, population: number, per?: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Calcula percentual
|
|
13
|
+
*/
|
|
14
|
+
export declare function calculatePercentage(numerator: number, denominator: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* Mapeamento código IBGE UF (2 dígitos) -> Sigla
|
|
17
|
+
*/
|
|
18
|
+
export declare const UF_CODE_TO_SIGLA: Record<string, string>;
|
|
19
|
+
/**
|
|
20
|
+
* Mapeamento Sigla UF -> Código IBGE
|
|
21
|
+
*/
|
|
22
|
+
export declare const UF_SIGLA_TO_CODE: Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Mapeamento UF -> Região
|
|
25
|
+
*/
|
|
26
|
+
export declare const UF_TO_REGION: Record<string, string>;
|
|
27
|
+
/**
|
|
28
|
+
* Lista de UFs por região
|
|
29
|
+
*/
|
|
30
|
+
export declare const REGION_UFS: Record<string, string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Extrai código da UF (2 primeiros dígitos) do código do município
|
|
33
|
+
*/
|
|
34
|
+
export declare function getUfFromMunicipio(municipioCode: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Obtém sigla da UF a partir do código do município
|
|
37
|
+
*/
|
|
38
|
+
export declare function getUfSiglaFromMunicipio(municipioCode: string): string;
|
|
39
|
+
//# sourceMappingURL=population.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"population.d.ts","sourceRoot":"","sources":["../../src/utils/population.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,GAAG,GAAE,MAAc,GAClB,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,MAAM,CAGR;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA4BnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAEnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA4B/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAM/C,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAGrE"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilitários para manipulação de dados populacionais
|
|
3
|
+
*
|
|
4
|
+
* NOTA: Dados populacionais foram adiados para fase futura.
|
|
5
|
+
* Este arquivo contém apenas funções utilitárias de mapeamento.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Calcula taxa por 10.000 habitantes
|
|
9
|
+
*/
|
|
10
|
+
export function calculateRate(count, population, per = 10000) {
|
|
11
|
+
if (population === 0)
|
|
12
|
+
return 0;
|
|
13
|
+
return (count / population) * per;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Calcula percentual
|
|
17
|
+
*/
|
|
18
|
+
export function calculatePercentage(numerator, denominator) {
|
|
19
|
+
if (denominator === 0)
|
|
20
|
+
return 0;
|
|
21
|
+
return (numerator / denominator) * 100;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Mapeamento código IBGE UF (2 dígitos) -> Sigla
|
|
25
|
+
*/
|
|
26
|
+
export const UF_CODE_TO_SIGLA = {
|
|
27
|
+
"11": "RO",
|
|
28
|
+
"12": "AC",
|
|
29
|
+
"13": "AM",
|
|
30
|
+
"14": "RR",
|
|
31
|
+
"15": "PA",
|
|
32
|
+
"16": "AP",
|
|
33
|
+
"17": "TO",
|
|
34
|
+
"21": "MA",
|
|
35
|
+
"22": "PI",
|
|
36
|
+
"23": "CE",
|
|
37
|
+
"24": "RN",
|
|
38
|
+
"25": "PB",
|
|
39
|
+
"26": "PE",
|
|
40
|
+
"27": "AL",
|
|
41
|
+
"28": "SE",
|
|
42
|
+
"29": "BA",
|
|
43
|
+
"31": "MG",
|
|
44
|
+
"32": "ES",
|
|
45
|
+
"33": "RJ",
|
|
46
|
+
"35": "SP",
|
|
47
|
+
"41": "PR",
|
|
48
|
+
"42": "SC",
|
|
49
|
+
"43": "RS",
|
|
50
|
+
"50": "MS",
|
|
51
|
+
"51": "MT",
|
|
52
|
+
"52": "GO",
|
|
53
|
+
"53": "DF",
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Mapeamento Sigla UF -> Código IBGE
|
|
57
|
+
*/
|
|
58
|
+
export const UF_SIGLA_TO_CODE = Object.fromEntries(Object.entries(UF_CODE_TO_SIGLA).map(([code, sigla]) => [sigla, code]));
|
|
59
|
+
/**
|
|
60
|
+
* Mapeamento UF -> Região
|
|
61
|
+
*/
|
|
62
|
+
export const UF_TO_REGION = {
|
|
63
|
+
AC: "Norte",
|
|
64
|
+
AP: "Norte",
|
|
65
|
+
AM: "Norte",
|
|
66
|
+
PA: "Norte",
|
|
67
|
+
RO: "Norte",
|
|
68
|
+
RR: "Norte",
|
|
69
|
+
TO: "Norte",
|
|
70
|
+
AL: "Nordeste",
|
|
71
|
+
BA: "Nordeste",
|
|
72
|
+
CE: "Nordeste",
|
|
73
|
+
MA: "Nordeste",
|
|
74
|
+
PB: "Nordeste",
|
|
75
|
+
PE: "Nordeste",
|
|
76
|
+
PI: "Nordeste",
|
|
77
|
+
RN: "Nordeste",
|
|
78
|
+
SE: "Nordeste",
|
|
79
|
+
DF: "Centro-Oeste",
|
|
80
|
+
GO: "Centro-Oeste",
|
|
81
|
+
MT: "Centro-Oeste",
|
|
82
|
+
MS: "Centro-Oeste",
|
|
83
|
+
ES: "Sudeste",
|
|
84
|
+
MG: "Sudeste",
|
|
85
|
+
RJ: "Sudeste",
|
|
86
|
+
SP: "Sudeste",
|
|
87
|
+
PR: "Sul",
|
|
88
|
+
RS: "Sul",
|
|
89
|
+
SC: "Sul",
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Lista de UFs por região
|
|
93
|
+
*/
|
|
94
|
+
export const REGION_UFS = {
|
|
95
|
+
Norte: ["AC", "AP", "AM", "PA", "RO", "RR", "TO"],
|
|
96
|
+
Nordeste: ["AL", "BA", "CE", "MA", "PB", "PE", "PI", "RN", "SE"],
|
|
97
|
+
"Centro-Oeste": ["DF", "GO", "MT", "MS"],
|
|
98
|
+
Sudeste: ["ES", "MG", "RJ", "SP"],
|
|
99
|
+
Sul: ["PR", "RS", "SC"],
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Extrai código da UF (2 primeiros dígitos) do código do município
|
|
103
|
+
*/
|
|
104
|
+
export function getUfFromMunicipio(municipioCode) {
|
|
105
|
+
return municipioCode.substring(0, 2);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Obtém sigla da UF a partir do código do município
|
|
109
|
+
*/
|
|
110
|
+
export function getUfSiglaFromMunicipio(municipioCode) {
|
|
111
|
+
const ufCode = getUfFromMunicipio(municipioCode);
|
|
112
|
+
return UF_CODE_TO_SIGLA[ufCode] || "";
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=population.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"population.js","sourceRoot":"","sources":["../../src/utils/population.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAa,EACb,UAAkB,EAClB,GAAG,GAAW,KAAK;IAEnB,IAAI,UAAU,KA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AO,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,aAAqB;IAC3D,MAAM,MAAM,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACjD,OAAO,gBAAgB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACxC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sih-br-mcp",
|
|
3
|
+
"version": "0.12.0",
|
|
4
|
+
"description": "Servidor MCP do SIH/SUS (internações hospitalares do Brasil, 1992–2025): causas, séries mensais, ICSAP e taxas por 100 mil, lendo cubos agregados e denominadores populacionais do canal público healthbr-data sob demanda",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/SidneyBissoli/sih-br-mcp.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/SidneyBissoli/sih-br-mcp#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/SidneyBissoli/sih-br-mcp/issues"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"bin": {
|
|
16
|
+
"sih-br-mcp": "dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsc --watch",
|
|
21
|
+
"start": "node dist/index.js",
|
|
22
|
+
"prepare": "npm run build",
|
|
23
|
+
"smoke:stdio": "node scripts/smoke-stdio.mjs --fixtures tests/fixtures/sih --baseline baselines/surface-stdio.json",
|
|
24
|
+
"smoke:stdio:baseline": "node scripts/smoke-stdio.mjs --fixtures tests/fixtures/sih --write baselines/surface-stdio.json",
|
|
25
|
+
"golden:tools": "node scripts/golden-tools.mjs --fixtures tests/fixtures/sih --baseline baselines/golden-tools.json",
|
|
26
|
+
"golden:tools:baseline": "node scripts/golden-tools.mjs --fixtures tests/fixtures/sih --write baselines/golden-tools.json",
|
|
27
|
+
"freshness": "node scripts/freshness-check.mjs",
|
|
28
|
+
"freshness:selftest": "node scripts/freshness-check.mjs --fixtures tests/fixtures/sih --selftest",
|
|
29
|
+
"freshness:excerpt": "node scripts/freshness-check.mjs --fixtures tests/fixtures/sih --write-excerpt",
|
|
30
|
+
"cache:selftest": "node scripts/cache-selftest.mjs",
|
|
31
|
+
"tables:check": "node scripts/tables-check.mjs",
|
|
32
|
+
"tables:check:offline": "node scripts/tables-check.mjs --manifest tests/fixtures/sih/cubes-manifest-excerpt.json"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"mcp",
|
|
36
|
+
"sus",
|
|
37
|
+
"sih",
|
|
38
|
+
"icsap",
|
|
39
|
+
"csap",
|
|
40
|
+
"datasus",
|
|
41
|
+
"saude-publica",
|
|
42
|
+
"epidemiologia"
|
|
43
|
+
],
|
|
44
|
+
"author": "Sidney Bissoli",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@duckdb/node-api": "^1.5.5-r.4",
|
|
48
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
49
|
+
"@sbissoli/mcp-provenance": "^0.1.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^26.4.0",
|
|
53
|
+
"typescript": "^7.0.2"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=22"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"files": [
|
|
62
|
+
"dist"
|
|
63
|
+
]
|
|
64
|
+
}
|