Compare commits
221 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29d021b347 | |||
| 98e9b60e83 | |||
| 5061350dd8 | |||
| eb887be447 | |||
| 0b22b3c309 | |||
| 6ade415f63 | |||
| 5791928976 | |||
| f4d1829cd3 | |||
| 069cc459a4 | |||
| 881c613744 | |||
| be46429627 | |||
| 25f584c864 | |||
| 561a5dde36 | |||
| bf89099ce8 | |||
| ff1f6758ba | |||
| f38a2c6bb4 | |||
| 40c19a6a1f | |||
| 329c0891ae | |||
| 34c6f2af3a | |||
| 7ab2567dc9 | |||
| 14d6875d9b | |||
| f82ce8cc38 | |||
| 61867ff973 | |||
| 8bca0fbcdf | |||
| ec8542de9f | |||
| 29c9e6853b | |||
| b1ff6cadb2 | |||
| 26285a87fa | |||
| f058f1f476 | |||
| 7f1e43bdc5 | |||
| 5bf6af8ecf | |||
| 253290ed6a | |||
| ec5b8fde6b | |||
| 2a36397fac | |||
| eada50d2ff | |||
| 396902541d | |||
| 68b5e927e7 | |||
| 990cab0e37 | |||
| 39e1e3e094 | |||
| 4e08bb8c4b | |||
| 686580af81 | |||
| 60c71bfc3d | |||
| ad4edbe2a1 | |||
| 1af0c21291 | |||
| dd356efb6b | |||
| 01271621b7 | |||
| 4c181af291 | |||
| b8bf57e235 | |||
| 17cef51d90 | |||
| 7692952ec9 | |||
| feaed5ff0e | |||
| 999bc4ecf5 | |||
| 6ed87ff3d8 | |||
| ff4ad2c964 | |||
| b5f8e5bfc2 | |||
| f04478e600 | |||
| 6a0c3c9e92 | |||
| e3c9849e29 | |||
| 10773edcc1 | |||
| 8b80e1d26c | |||
| 2a48c28245 | |||
| e1a8127c22 | |||
| 6de193f44e | |||
| 0059427179 | |||
| 8192f92be9 | |||
| 1fef7812b4 | |||
| 6465165e34 | |||
| a26df55214 | |||
| 72e5f9bf93 | |||
| 08f1d812ac | |||
| ce207a72a5 | |||
| 5094880622 | |||
| 093ceffa36 | |||
| 6a7c1d0cbd | |||
| fb5a4ed5cc | |||
| e8ce7a487b | |||
| a3a552ad0e | |||
| fb54cfb188 | |||
| 7adceb86bf | |||
| 4e9b25bd8f | |||
| a7b5f4c50b | |||
| 4d159ae0d0 | |||
| 4fba4fa861 | |||
| db4d743413 | |||
| d6c52c8536 | |||
| 1969ffdb5f | |||
| 699d4b13e1 | |||
| c5cbaaab13 | |||
| cc802cbb57 | |||
| e7a6398168 | |||
| 62027f2216 | |||
| 88dc7537c2 | |||
| 0cb9395cd6 | |||
| e74e3d8fd4 | |||
| 0fc80bd29a | |||
| dae8bc517e | |||
| 68e2930e65 | |||
| bb957ec6a4 | |||
| 02e28e624b | |||
| 08161db1c4 | |||
| fa029d69b8 | |||
| 67ae7f482f | |||
| 304c563845 | |||
| efe4404c4e | |||
| 7d180417d8 | |||
| 00f773dd75 | |||
| 3bb1c8dd84 | |||
| ef4f606648 | |||
| 54b3e50ca5 | |||
| 680cc0adc6 | |||
| b53322ed72 | |||
| c32d2b6012 | |||
| 7aa3d2c6e6 | |||
| c2c6d9ef47 | |||
| d4d3ea3837 | |||
| 3385df4ba3 | |||
| 96b1cabb5a | |||
| 366591f247 | |||
| 241631b884 | |||
| 6c063344a3 | |||
| 2f5b1ce1f2 | |||
| 56b3ac6b0c | |||
| f6603ae76e | |||
| 21ae95b5ed | |||
| ce2e86c045 | |||
| 0f8eb0ec94 | |||
| 2f6d419453 | |||
| f34f9e1607 | |||
| c7dd134fce | |||
| 03cc9c9800 | |||
| 04795a09cc | |||
| de3d247d0d | |||
| ee87bcb8d0 | |||
| aaeea7a7b0 | |||
| 7f17681409 | |||
| d72c18756f | |||
| baf5edca42 | |||
| fefa28ae7a | |||
| a217ddae38 | |||
| 97fcb37761 | |||
| 58ff3870be | |||
| 439a039ff4 | |||
| 049a9ca43c | |||
| f128f2e13a | |||
| 20b8c80aaf | |||
| 8e85c91f15 | |||
| 1ac8d5c258 | |||
| 23cd89e882 | |||
| 47a0ab5f1b | |||
| dc37c54938 | |||
| 2834fac85c | |||
| be77c50b45 | |||
| 40d8c8655e | |||
| 7580319fc8 | |||
| 7a2f0f42a9 | |||
| 4ffd3797b6 | |||
| b42428b068 | |||
| 01d6e71f07 | |||
| 3b246b4f1f | |||
| caf5f954b7 | |||
| edb868f372 | |||
| d9009a2e1e | |||
| 2e0938628c | |||
| 3783505dbd | |||
| 0acee49de2 | |||
| 18e9260705 | |||
| 3f4cf2217f | |||
| 7971a49dcd | |||
| c06cce20df | |||
| 2b0f6dfbed | |||
| c509cb7f87 | |||
| 5807f218b1 | |||
| 1d43ebff3b | |||
| eb92b99a1d | |||
| ee75e7a2a0 | |||
| b84d428814 | |||
| 17a91d3924 | |||
| cda3563184 | |||
| 7a6f87d141 | |||
| 78313adb4a | |||
| 7dc420773f | |||
| 552e2c194f | |||
| 8f01f8693d | |||
| ad8444a788 | |||
| f78db1ae37 | |||
| 0914b8db23 | |||
| 8aa66c6277 | |||
| 1e1999f264 | |||
| e95c175f9b | |||
| ff03a88ea0 | |||
| d761a6fb1a | |||
| 2982d482bf | |||
| 5e16f5454b | |||
| ce3ed34fbf | |||
| d159067efd | |||
| 7b8fd9e01d | |||
| 8a3f68df6b | |||
| bc75c058e1 | |||
| 62cdb252ca | |||
| 8f2906fe6f | |||
| e8628508d8 | |||
| 53edec8692 | |||
| a1ea31039e | |||
| ef631e2c0b | |||
| 27dc7a0166 | |||
| e6353f9f4c | |||
| 3bb9c2121d | |||
| 737c6f9f14 | |||
| 8e543cbcc6 | |||
| ea7aad5067 | |||
| 09b52e6b0a | |||
| 078db53ae4 | |||
| 957f4cd024 | |||
| 1ce8d98663 | |||
| 1771cb7ec6 | |||
| b74f188b15 | |||
| 5196f20e47 | |||
| 5d4cd6f654 | |||
| a05717f92d | |||
| 123232592f | |||
| 2cbb994667 |
@@ -62,6 +62,17 @@
|
|||||||
"optimization": false,
|
"optimization": false,
|
||||||
"extractLicenses": false,
|
"extractLicenses": false,
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
|
},
|
||||||
|
"simulado": {
|
||||||
|
"optimization": false,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"sourceMap": true,
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/app/app.config.ts",
|
||||||
|
"with": "src/app/app.config.simulado.ts"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultConfiguration": "production"
|
"defaultConfiguration": "production"
|
||||||
@@ -77,6 +88,10 @@
|
|||||||
},
|
},
|
||||||
"development": {
|
"development": {
|
||||||
"buildTarget": "WebApp:build:development"
|
"buildTarget": "WebApp:build:development"
|
||||||
|
},
|
||||||
|
"simulado": {
|
||||||
|
"buildTarget": "WebApp:build:simulado",
|
||||||
|
"proxyConfig": "simulado/proxy.simulado.json"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultConfiguration": "development"
|
"defaultConfiguration": "development"
|
||||||
|
|||||||
Generated
+246
-2
@@ -20,9 +20,11 @@
|
|||||||
"@fontsource/roboto": "^5.3.0",
|
"@fontsource/roboto": "^5.3.0",
|
||||||
"@fontsource/roboto-mono": "^5.3.0",
|
"@fontsource/roboto-mono": "^5.3.0",
|
||||||
"material-icons": "^1.13.14",
|
"material-icons": "^1.13.14",
|
||||||
|
"pdfmake": "0.3.14",
|
||||||
"plotly.js-cartesian-dist-min": "4.1.2",
|
"plotly.js-cartesian-dist-min": "4.1.2",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0",
|
||||||
|
"write-excel-file": "4.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/build": "^22.1.8",
|
"@angular/build": "^22.1.8",
|
||||||
@@ -2701,6 +2703,30 @@
|
|||||||
"@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4"
|
"@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@noble/ciphers": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^14.21.3 || >=16"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@noble/hashes": {
|
||||||
|
"version": "1.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz",
|
||||||
|
"integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^14.21.3 || >=16"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@oxc-parser/binding-android-arm-eabi": {
|
"node_modules/@oxc-parser/binding-android-arm-eabi": {
|
||||||
"version": "0.142.0",
|
"version": "0.142.0",
|
||||||
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.142.0.tgz",
|
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.142.0.tgz",
|
||||||
@@ -3697,6 +3723,12 @@
|
|||||||
"integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
|
"integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@swc/helpers": {
|
||||||
|
"version": "0.5.24",
|
||||||
|
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.24.tgz",
|
||||||
|
"integrity": "sha512-6tcXo4kA8HgGO7AVmawB57RYi/piBPYVHVcO6dXjX+SZw8GoHmi262sp4v2Ha2kNP9Cx84qei27yT+fjS1lxgg==",
|
||||||
|
"license": "Apache-2.0"
|
||||||
|
},
|
||||||
"node_modules/@tybys/wasm-util": {
|
"node_modules/@tybys/wasm-util": {
|
||||||
"version": "0.10.4",
|
"version": "0.10.4",
|
||||||
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz",
|
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz",
|
||||||
@@ -4011,6 +4043,15 @@
|
|||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/base64-js": {
|
||||||
|
"version": "0.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.8.tgz",
|
||||||
|
"integrity": "sha512-3XSA2cR/h/73EzlXXdU6YNycmYI7+kicTxks4eJg2g39biHR84slg2+des+p7iHYhbRg/udIS4TD53WabcOUkw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/baseline-browser-mapping": {
|
"node_modules/baseline-browser-mapping": {
|
||||||
"version": "2.11.25",
|
"version": "2.11.25",
|
||||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.25.tgz",
|
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.25.tgz",
|
||||||
@@ -4101,6 +4142,35 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/brotli": {
|
||||||
|
"version": "1.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz",
|
||||||
|
"integrity": "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"base64-js": "^1.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/brotli/node_modules/base64-js": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/browserslist": {
|
"node_modules/browserslist": {
|
||||||
"version": "4.29.0",
|
"version": "4.29.0",
|
||||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.0.tgz",
|
||||||
@@ -4357,6 +4427,15 @@
|
|||||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/clone": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/content-disposition": {
|
"node_modules/content-disposition": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz",
|
||||||
@@ -4560,6 +4639,12 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/dfa": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/dfa/-/dfa-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/dom-serializer": {
|
"node_modules/dom-serializer": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
|
||||||
@@ -4921,7 +5006,6 @@
|
|||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/fast-string-truncated-width": {
|
"node_modules/fast-string-truncated-width": {
|
||||||
@@ -4986,6 +5070,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/fflate": {
|
||||||
|
"version": "0.8.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz",
|
||||||
|
"integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/finalhandler": {
|
"node_modules/finalhandler": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
|
||||||
@@ -5018,6 +5108,23 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/fontkit": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/fontkit/-/fontkit-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-syetQadaUEDNdxdugga9CpEYVaQIxOwk7GlwZWWZ19//qW4zE5bknOKeMBDYAASwnpaSHKJITRLMF9m1fp3s6g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@swc/helpers": "^0.5.12",
|
||||||
|
"brotli": "^1.3.2",
|
||||||
|
"clone": "^2.1.2",
|
||||||
|
"dfa": "^1.2.0",
|
||||||
|
"fast-deep-equal": "^3.1.3",
|
||||||
|
"restructure": "^3.0.0",
|
||||||
|
"tiny-inflate": "^1.0.3",
|
||||||
|
"unicode-properties": "^1.4.0",
|
||||||
|
"unicode-trie": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/forwarded": {
|
"node_modules/forwarded": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||||
@@ -5862,6 +5969,16 @@
|
|||||||
"url": "https://opencollective.com/parcel"
|
"url": "https://opencollective.com/parcel"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/linebreak": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/linebreak/-/linebreak-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-MHp03UImeVhB7XZtjd0E4n6+3xr5Dq/9xI/5FptGk5FrbDR3zagPa2DS6U8ks/3HjbKWG9Q1M2ufOzxV2qLYSQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"base64-js": "0.0.8",
|
||||||
|
"unicode-trie": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/listr2": {
|
"node_modules/listr2": {
|
||||||
"version": "11.0.0",
|
"version": "11.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/listr2/-/listr2-11.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/listr2/-/listr2-11.0.0.tgz",
|
||||||
@@ -6373,6 +6490,12 @@
|
|||||||
"@oxc-parser/binding-win32-x64-msvc": "0.142.0"
|
"@oxc-parser/binding-win32-x64-msvc": "0.142.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pako": {
|
||||||
|
"version": "0.2.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz",
|
||||||
|
"integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/parse5": {
|
"node_modules/parse5": {
|
||||||
"version": "8.0.1",
|
"version": "8.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz",
|
||||||
@@ -6476,6 +6599,34 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/pdfkit": {
|
||||||
|
"version": "0.20.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/pdfkit/-/pdfkit-0.20.2.tgz",
|
||||||
|
"integrity": "sha512-Q/w03ICAQyXfHNfTsg1udp0ADerdBN0s7a6XSPL7J7Ro6ABnafoBOCDBstIO9U02mvzHEV8HrvFIw5iV5ejIRA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@noble/ciphers": "^1.3.0",
|
||||||
|
"@noble/hashes": "^1.8.0",
|
||||||
|
"fflate": "^0.8.3",
|
||||||
|
"fontkit": "^2.0.4",
|
||||||
|
"linebreak": "^1.1.0",
|
||||||
|
"png-js": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pdfmake": {
|
||||||
|
"version": "0.3.14",
|
||||||
|
"resolved": "https://registry.npmjs.org/pdfmake/-/pdfmake-0.3.14.tgz",
|
||||||
|
"integrity": "sha512-EDyOlwiDnE8e0eITSpHwZCVAP/veWq0TxA2RyhoDO0cSLat7HEGNtKUN6UiW9+YovO2GhcWlK99Q7tj9sof9gg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"linebreak": "^1.1.0",
|
||||||
|
"pdfkit": "^0.20.2",
|
||||||
|
"xmldoc": "^2.0.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/picocolors": {
|
"node_modules/picocolors": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||||
@@ -6525,6 +6676,14 @@
|
|||||||
"integrity": "sha512-3UkyAT7/U8f3sOLavLnUjA6mqFmnqEe246GZhxT0J3TT9oZ0mh6SgwsL1yo/3/4xfmRSDFdGOxe+EsvT2XiE0g==",
|
"integrity": "sha512-3UkyAT7/U8f3sOLavLnUjA6mqFmnqEe246GZhxT0J3TT9oZ0mh6SgwsL1yo/3/4xfmRSDFdGOxe+EsvT2XiE0g==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/png-js": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/png-js/-/png-js-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-GdzJuUMc6ZSpxFJWVxtOH1bzYHym+TOnveqUjb+VJIbZWbZzyiRGFiKhbiielfpYbgMlhHVhsJ0FTazfuRFkMA==",
|
||||||
|
"dependencies": {
|
||||||
|
"fflate": "^0.8.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/postcss": {
|
"node_modules/postcss": {
|
||||||
"version": "8.5.28",
|
"version": "8.5.28",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz",
|
||||||
@@ -6755,6 +6914,12 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/restructure": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/restructure/-/restructure-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-gSfoiOEA0VPE6Tukkrr7I0RBdE0s7H1eFCDBk05l1KIQT1UIKNc5JZy6jdyW6eYH3aR3g5b3PuL77rq0hvwtAw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/rolldown": {
|
"node_modules/rolldown": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.0.tgz",
|
||||||
@@ -6853,6 +7018,15 @@
|
|||||||
"@parcel/watcher": "^2.4.1"
|
"@parcel/watcher": "^2.4.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/sax": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==",
|
||||||
|
"license": "BlueOak-1.0.0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/saxes": {
|
"node_modules/saxes": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
|
||||||
@@ -7187,6 +7361,12 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/tiny-inflate": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/tinybench": {
|
"node_modules/tinybench": {
|
||||||
"version": "2.9.0",
|
"version": "2.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",
|
||||||
@@ -7350,6 +7530,46 @@
|
|||||||
"node": ">=20.18.1"
|
"node": ">=20.18.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/unicode-properties": {
|
||||||
|
"version": "1.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/unicode-properties/-/unicode-properties-1.4.1.tgz",
|
||||||
|
"integrity": "sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"base64-js": "^1.3.0",
|
||||||
|
"unicode-trie": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/unicode-properties/node_modules/base64-js": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/unicode-trie": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/unicode-trie/-/unicode-trie-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"pako": "^0.2.5",
|
||||||
|
"tiny-inflate": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/unpipe": {
|
"node_modules/unpipe": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||||
@@ -8070,6 +8290,18 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/write-excel-file": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/write-excel-file/-/write-excel-file-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-MUnCnNtQrcZek832ZcU24uU0rSphFmKPD1DvIjXOlygVb93CV7Tme6H3jUTkxsMmjB2W7HIzERzjqTi5kui71A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"fflate": "^0.8.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/xml-name-validator": {
|
"node_modules/xml-name-validator": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
|
||||||
@@ -8087,6 +8319,18 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/xmldoc": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/xmldoc/-/xmldoc-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-6gRk4NY/Jvg67xn7OzJuxLRsGgiXBaPUQplVJ/9l99uIugxh4FTOewYz5ic8WScj7Xx/2WvhENiQKwkK9RpE4w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"sax": "^1.4.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/y18n": {
|
"node_modules/y18n": {
|
||||||
"version": "5.0.8",
|
"version": "5.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||||
|
|||||||
+3
-1
@@ -23,9 +23,11 @@
|
|||||||
"@fontsource/roboto": "^5.3.0",
|
"@fontsource/roboto": "^5.3.0",
|
||||||
"@fontsource/roboto-mono": "^5.3.0",
|
"@fontsource/roboto-mono": "^5.3.0",
|
||||||
"material-icons": "^1.13.14",
|
"material-icons": "^1.13.14",
|
||||||
|
"pdfmake": "0.3.14",
|
||||||
"plotly.js-cartesian-dist-min": "4.1.2",
|
"plotly.js-cartesian-dist-min": "4.1.2",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0",
|
||||||
|
"write-excel-file": "4.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/build": "^22.1.8",
|
"@angular/build": "^22.1.8",
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 717 B |
@@ -0,0 +1,38 @@
|
|||||||
|
# Modo simulado (solo nuestra copia local, rama `ulises/tea-seguimiento`)
|
||||||
|
|
||||||
|
Para ver y modificar la página de seguimiento de TEA sin la plataforma completa ni su preproceso.
|
||||||
|
Todo es **inventado**. No forma parte de la WebApp que se entrega.
|
||||||
|
|
||||||
|
| Archivo | Qué es |
|
||||||
|
|---|---|
|
||||||
|
| `datos_tea.json` | 120 niños inventados: lista, ficha y la relación con el ADOS-2 (modelo de OR de E27). Se genera; no se versiona |
|
||||||
|
| `servidor.py` | Servidor de prueba (Python, sin instalar nada) en `localhost:5051` |
|
||||||
|
| `proxy.simulado.json` | Las rutas de la API, al servidor de prueba |
|
||||||
|
| `../src/app/app.config.simulado.ts` | Igual que `app.config.ts`, pero el seguimiento de TEA lee el contrato JSON (`/tea/seguimiento`) |
|
||||||
|
|
||||||
|
## Cómo se usa
|
||||||
|
|
||||||
|
1. Generar los datos (una vez, o cuando cambie el modelo), desde `biomarcadores-tea/`:
|
||||||
|
```
|
||||||
|
python experimentos/E27_modelo_or/simulado_plataforma.py
|
||||||
|
```
|
||||||
|
2. Levantar el servidor de prueba, desde `webapp-tea/`:
|
||||||
|
```
|
||||||
|
python simulado/servidor.py
|
||||||
|
```
|
||||||
|
3. En otra terminal, la página, desde `webapp-tea/`:
|
||||||
|
```
|
||||||
|
npx ng serve --configuration simulado --port 4300
|
||||||
|
```
|
||||||
|
4. Abrir `http://localhost:4300/indicadores/tea`, entrar a **Seguimiento** y abrir un paciente.
|
||||||
|
|
||||||
|
## El panel nuevo: «Relación con el ADOS-2»
|
||||||
|
|
||||||
|
En la ficha del paciente (`tea-paciente-resumen.*`) muestra, por cada asociación clara de la cohorte (q < 0.05):
|
||||||
|
- la zona del EEG y el z del paciente, marcada si está alterada (|z| ≥ 2);
|
||||||
|
- el aspecto del ADOS-2 (reactivo o dominio);
|
||||||
|
- el OR de la cohorte con su intervalo y su q;
|
||||||
|
- la probabilidad que el modelo da a este paciente (con su edad y módulo) frente a la de un niño con z = 0;
|
||||||
|
- lo que muestra su ADOS-2.
|
||||||
|
|
||||||
|
El campo `relacion_ados2` es opcional: sin él (la plataforma real hoy), el panel no aparece.
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"/api": {
|
||||||
|
"target": "http://localhost:5051",
|
||||||
|
"secure": false,
|
||||||
|
"changeOrigin": true
|
||||||
|
},
|
||||||
|
"/imports": {
|
||||||
|
"target": "http://localhost:5051",
|
||||||
|
"secure": false,
|
||||||
|
"changeOrigin": true
|
||||||
|
},
|
||||||
|
"/data": {
|
||||||
|
"target": "http://localhost:5051",
|
||||||
|
"secure": false,
|
||||||
|
"changeOrigin": true
|
||||||
|
},
|
||||||
|
"/health": {
|
||||||
|
"target": "http://localhost:5051",
|
||||||
|
"secure": false,
|
||||||
|
"changeOrigin": true
|
||||||
|
},
|
||||||
|
"/cacu": {
|
||||||
|
"target": "http://localhost:5051",
|
||||||
|
"secure": false,
|
||||||
|
"changeOrigin": true
|
||||||
|
},
|
||||||
|
"/cama": {
|
||||||
|
"target": "http://localhost:5051",
|
||||||
|
"secure": false,
|
||||||
|
"changeOrigin": true
|
||||||
|
},
|
||||||
|
"/tea": {
|
||||||
|
"target": "http://localhost:5051",
|
||||||
|
"secure": false,
|
||||||
|
"changeOrigin": true
|
||||||
|
},
|
||||||
|
"/governance": {
|
||||||
|
"target": "http://localhost:5051",
|
||||||
|
"secure": false,
|
||||||
|
"changeOrigin": true
|
||||||
|
},
|
||||||
|
"/reportes": {
|
||||||
|
"target": "http://localhost:5051",
|
||||||
|
"secure": false,
|
||||||
|
"changeOrigin": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
"""
|
||||||
|
servidor.py — Servidor de prueba con datos SIMULADOS para ver la página de TEA sin la plataforma completa.
|
||||||
|
|
||||||
|
Solo para nuestra copia local (rama ulises/tea-seguimiento): no forma parte de la WebApp que se entrega.
|
||||||
|
Responde lo que pide la sección de seguimiento de TEA en su contrato JSON:
|
||||||
|
- `/tea/seguimiento`: la lista, con filtros y páginas;
|
||||||
|
- `/tea/seguimiento/<id>`: la ficha, incluido el campo nuevo `relacion_ados2`.
|
||||||
|
|
||||||
|
A lo demás de `/tea/...` contesta vacío, para que la página cargue.
|
||||||
|
|
||||||
|
Los datos los escribe `biomarcadores-tea/experimentos/E27_modelo_or/simulado_plataforma.py` en `datos_tea.json`.
|
||||||
|
|
||||||
|
python simulado/servidor.py # http://localhost:5051
|
||||||
|
npx ng serve --configuration simulado --port 4300
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import json
|
||||||
|
import math
|
||||||
|
import sys
|
||||||
|
from datetime import date, timedelta
|
||||||
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||||
|
from pathlib import Path
|
||||||
|
from urllib.parse import parse_qs, unquote, urlparse
|
||||||
|
|
||||||
|
PUERTO = 5051
|
||||||
|
DATOS = json.loads((Path(__file__).with_name("datos_tea.json")).read_text(encoding="utf-8"))
|
||||||
|
VACIO_FHIR = {"resourceType": "Bundle", "type": "searchset", "total": 0, "entry": []}
|
||||||
|
|
||||||
|
|
||||||
|
def _num(q, k):
|
||||||
|
v = q.get(k, [None])[0]
|
||||||
|
try:
|
||||||
|
return float(v) if v is not None else None
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def lista(q: dict) -> dict:
|
||||||
|
meses = int(q.get("meses", ["12"])[0]) if q.get("meses", ["12"])[0] in ("1", "3", "6", "12") else 12
|
||||||
|
corte = q.get("corte", [date.today().isoformat()])[0]
|
||||||
|
page = max(1, int(q.get("page", ["1"])[0]))
|
||||||
|
size = min(200, max(1, int(q.get("page_size", ["25"])[0])))
|
||||||
|
filtro = q.get("alteraciones_eeg", [None])[0]
|
||||||
|
ps = DATOS["pacientes"]
|
||||||
|
if filtro in ("normal", "anormal"):
|
||||||
|
ps = [p for p in ps if p["alteraciones_eeg"] == filtro]
|
||||||
|
elif filtro == "sin_eeg_valido":
|
||||||
|
ps = [p for p in ps if p["ultimo_eeg"] is None]
|
||||||
|
if q.get("grupo_edad"):
|
||||||
|
ps = [p for p in ps if p["grupo_edad"].startswith(q["grupo_edad"][0].replace("_", "-"))]
|
||||||
|
for campo, lo, hi in (("mchat", "mchat_min", "mchat_max"), ("css_ados2", "css_min", "css_max")):
|
||||||
|
a, b = _num(q, lo), _num(q, hi)
|
||||||
|
if a is not None:
|
||||||
|
ps = [p for p in ps if p[campo] is not None and a <= p[campo] <= (b if b is not None else 99)]
|
||||||
|
if q.get("estado_caso"):
|
||||||
|
ps = [p for p in ps if p["estado_caso"] == q["estado_caso"][0]]
|
||||||
|
if q.get("alteracion"):
|
||||||
|
ps = [p for p in ps if q["alteracion"][0] in p["alteraciones"]]
|
||||||
|
total = len(ps)
|
||||||
|
por_alt = [{"codigo": t["codigo"], "etiqueta": t["etiqueta"], "n": sum(t["codigo"] in p["alteraciones"] for p in ps)}
|
||||||
|
for t in DATOS["tipos_alteracion"]]
|
||||||
|
hasta = date.fromisoformat(corte)
|
||||||
|
return {
|
||||||
|
"simulado": True, "corte": corte,
|
||||||
|
"ventana": {"meses": meses, "desde": (hasta - timedelta(days=30 * meses)).isoformat(), "hasta": corte},
|
||||||
|
"filtros": {"alteraciones_eeg": filtro},
|
||||||
|
"paginacion": {"page": page, "page_size": size, "total_items": total, "total_pages": max(1, math.ceil(total / size))},
|
||||||
|
"items": ps[(page - 1) * size: page * size],
|
||||||
|
"tipos_alteracion": DATOS["tipos_alteracion"],
|
||||||
|
"resumen_eeg": {"validadas": True, "con_eeg_valido": total,
|
||||||
|
"normales": sum(p["alteraciones_eeg"] == "normal" for p in ps),
|
||||||
|
"anormales": sum(p["alteraciones_eeg"] == "anormal" for p in ps), "sin_eeg": 0,
|
||||||
|
"por_alteracion": por_alt},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Manejador(BaseHTTPRequestHandler):
|
||||||
|
def _json(self, cuerpo, codigo=200):
|
||||||
|
datos = json.dumps(cuerpo, ensure_ascii=False).encode("utf-8")
|
||||||
|
self.send_response(codigo)
|
||||||
|
self.send_header("Content-Type", "application/json; charset=utf-8")
|
||||||
|
self.send_header("Content-Length", str(len(datos)))
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(datos)
|
||||||
|
|
||||||
|
def do_GET(self): # noqa: N802
|
||||||
|
u = urlparse(self.path)
|
||||||
|
ruta, q = u.path.rstrip("/"), parse_qs(u.query)
|
||||||
|
if ruta == "/tea/seguimiento":
|
||||||
|
return self._json(lista(q))
|
||||||
|
if ruta.startswith("/tea/seguimiento/"):
|
||||||
|
d = DATOS["detalles"].get(unquote(ruta.rsplit("/", 1)[1]))
|
||||||
|
return self._json(d) if d else self._json({"error": "no encontrado"}, 404)
|
||||||
|
if "/fhir/" in ruta:
|
||||||
|
return self._json(VACIO_FHIR)
|
||||||
|
if ruta.endswith("/indicadores"):
|
||||||
|
return self._json([])
|
||||||
|
if ruta == "/health":
|
||||||
|
return self._json({"status": "ok", "simulado": True})
|
||||||
|
return self._json({"error": "sin datos simulados para esta ruta"}, 404)
|
||||||
|
|
||||||
|
def log_message(self, fmt, *args):
|
||||||
|
sys.stderr.write(" " + fmt % args + "\n")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print(f"Servidor simulado en http://localhost:{PUERTO} ({len(DATOS['pacientes'])} niños inventados)")
|
||||||
|
ThreadingHTTPServer(("127.0.0.1", PUERTO), Manejador).serve_forever()
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
// Covers the shell's header: on an indicators page it carries the platform title and the domain selector; on
|
||||||
|
// the institutional routes it keeps the breadcrumb. The pages are stubs: only the header and the router matter.
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { Location } from '@angular/common';
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { provideRouter, Router } from '@angular/router';
|
||||||
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
|
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||||
|
import { App } from './app';
|
||||||
|
import { routes } from './app.routes';
|
||||||
|
import { DOMINIOS } from './features/indicadores/indicadores.models';
|
||||||
|
|
||||||
|
@Component({ template: 'página', selector: 'app-stub' })
|
||||||
|
class Stub {}
|
||||||
|
|
||||||
|
describe('Encabezado del marco', () => {
|
||||||
|
const rutas = [
|
||||||
|
{ path: '', component: Stub },
|
||||||
|
{ path: 'conectar', component: Stub, data: { workspace: true, breadcrumb: 'Conectar datos' } },
|
||||||
|
{ path: 'gobernanza', component: Stub, data: { workspace: true, breadcrumb: 'Gobernanza de modelos' } },
|
||||||
|
...DOMINIOS.map(dominio => ({ path: `indicadores/${dominio}`, component: Stub, data: { workspace: true, breadcrumb: 'Indicadores', dominio } })),
|
||||||
|
];
|
||||||
|
let fixture: ReturnType<typeof TestBed.createComponent<App>>, router: Router;
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({ imports: [App], providers: [provideRouter(rutas), provideHttpClient(), provideHttpClientTesting()] }).compileComponents();
|
||||||
|
fixture = TestBed.createComponent(App); router = TestBed.inject(Router);
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
afterEach(() => { fixture.destroy(); document.querySelectorAll('.cdk-overlay-container').forEach(e => e.replaceChildren()); });
|
||||||
|
const root = () => fixture.nativeElement as HTMLElement;
|
||||||
|
async function ir(url: string) { await router.navigateByUrl(url); await fixture.whenStable(); fixture.detectChanges(); }
|
||||||
|
const selector = () => root().querySelector('.domain-selector') as HTMLButtonElement | null;
|
||||||
|
async function abrirMenu() {
|
||||||
|
selector()!.click(); fixture.detectChanges(); await fixture.whenStable(); fixture.detectChanges();
|
||||||
|
return [...document.querySelectorAll('.mat-mdc-menu-panel a[mat-menu-item]')] as HTMLAnchorElement[];
|
||||||
|
}
|
||||||
|
|
||||||
|
it('las rutas de los tres dominios existen en el enrutador de la aplicación', () => {
|
||||||
|
// Fails if the selector would point at a route the application does not have.
|
||||||
|
// The application's routes live under the guarded parent ('login' is its sibling).
|
||||||
|
const paths = routes.flatMap((ruta) => [ruta.path, ...(ruta.children ?? []).map((hijo) => hijo.path)]);
|
||||||
|
for (const dominio of DOMINIOS) expect(paths).toContain(`indicadores/${dominio}`);
|
||||||
|
});
|
||||||
|
it.each([['tea', 'Trastorno del espectro autista'], ['cacu', 'Cáncer cervicouterino'], ['cama', 'Cáncer de mama']] as const)('en /indicadores/%s muestra el título de la plataforma y el selector con «%s»', async (dominio, etiqueta) => {
|
||||||
|
await ir('/indicadores/' + dominio);
|
||||||
|
expect(root().querySelector('.platform-title')?.textContent).toBe('Plataforma de Indicadores');
|
||||||
|
expect(selector()?.textContent?.replace(/\s+/g, ' ').trim()).toBe(etiqueta + ' ▾');
|
||||||
|
expect(root().querySelector('.brand img')?.getAttribute('alt')).toBe('ISSSTELEON');
|
||||||
|
// The breadcrumb is replaced, not duplicated beside the selector.
|
||||||
|
expect(root().querySelector('.site-header__nav')).toBeNull();
|
||||||
|
expect(root().querySelector('.app-shell--indicadores')).not.toBeNull();
|
||||||
|
});
|
||||||
|
it('el selector tiene nombre accesible con el dominio actual y anuncia un menú', async () => {
|
||||||
|
await ir('/indicadores/cama');
|
||||||
|
expect(selector()!.getAttribute('aria-label')).toBe('Dominio actual: Cáncer de mama. Cambiar dominio');
|
||||||
|
expect(selector()!.getAttribute('aria-haspopup')).toBe('menu');
|
||||||
|
expect(selector()!.tagName).toBe('BUTTON');
|
||||||
|
expect(selector()!.tabIndex).toBeGreaterThanOrEqual(0);
|
||||||
|
});
|
||||||
|
it('el menú ofrece los otros dos dominios con sus rutas institucionales', async () => {
|
||||||
|
await ir('/indicadores/cama');
|
||||||
|
const items = await abrirMenu();
|
||||||
|
expect(items.map(a => a.textContent?.trim())).toEqual(['Trastorno del espectro autista', 'Cáncer cervicouterino']);
|
||||||
|
expect(items.map(a => a.getAttribute('href'))).toEqual(['/indicadores/tea', '/indicadores/cacu']);
|
||||||
|
expect(selector()!.getAttribute('aria-expanded')).toBe('true');
|
||||||
|
});
|
||||||
|
it('elegir otro dominio navega por el enrutador, actualiza el selector y deja una entrada en el historial', async () => {
|
||||||
|
await ir('/indicadores/cama');
|
||||||
|
const items = await abrirMenu();
|
||||||
|
items[1].click(); await fixture.whenStable(); fixture.detectChanges();
|
||||||
|
expect(router.url).toBe('/indicadores/cacu');
|
||||||
|
expect(selector()!.textContent).toContain('Cáncer cervicouterino');
|
||||||
|
// The choice is a router navigation (a history entry), not a page reload: going back lands on the previous domain.
|
||||||
|
const ubicacion = TestBed.inject(Location);
|
||||||
|
ubicacion.back(); await new Promise(r => setTimeout(r, 100));
|
||||||
|
expect(ubicacion.path()).toBe('/indicadores/cama');
|
||||||
|
});
|
||||||
|
it.each(['/', '/conectar', '/gobernanza'])('en %s conserva el encabezado institucional sin selector', async url => {
|
||||||
|
// Fails if the indicators header leaks into the institutional routes.
|
||||||
|
await ir(url);
|
||||||
|
expect(selector()).toBeNull();
|
||||||
|
expect(root().querySelector('.platform-title')).toBeNull();
|
||||||
|
expect(root().querySelector('.site-header__section')).toBeNull();
|
||||||
|
expect(root().querySelector('.site-header__nav')?.textContent).not.toContain('Análisis de información');
|
||||||
|
expect(root().querySelector('.app-shell--indicadores')).toBeNull();
|
||||||
|
if (url !== '/') expect(root().querySelector('.site-header__crumb')?.textContent).toContain(url === '/conectar' ? 'Conectar datos' : 'Gobernanza de modelos');
|
||||||
|
});
|
||||||
|
it('una ruta parecida que no es de indicadores no activa el selector', async () => {
|
||||||
|
await router.navigateByUrl('/'); fixture.detectChanges();
|
||||||
|
expect(selector()).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
|
||||||
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
|
import { provideRouter } from '@angular/router';
|
||||||
|
import { routes } from './app.routes';
|
||||||
|
import { IndicadoresService } from './features/indicadores/indicadores.service';
|
||||||
|
import { IndicadoresPeriodos } from './features/indicadores/indicadores-periodos';
|
||||||
|
import { FhirIndicadoresPeriodos, FhirIndicadoresService } from './features/indicadores/indicadores-fhir';
|
||||||
|
|
||||||
|
// SOLO para el modo «simulado» (ng serve --configuration simulado): igual que app.config.ts, pero el seguimiento
|
||||||
|
// de TEA lee el contrato JSON (`/tea/seguimiento`) del servidor de prueba (`simulado/servidor.py`).
|
||||||
|
export const appConfig: ApplicationConfig = {
|
||||||
|
providers: [
|
||||||
|
provideBrowserGlobalErrorListeners(),
|
||||||
|
provideRouter(routes),
|
||||||
|
provideHttpClient(),
|
||||||
|
// The indicator page reads the WebApi's FHIR endpoint; without these lines it reads the indicator JSON contract
|
||||||
|
// (`/<domain>/indicadores/<id>/datos`, `/tea/seguimiento`).
|
||||||
|
{ provide: IndicadoresService, useClass: FhirIndicadoresService },
|
||||||
|
{ provide: IndicadoresPeriodos, useClass: FhirIndicadoresPeriodos },
|
||||||
|
]
|
||||||
|
};
|
||||||
@@ -2,11 +2,23 @@ import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/
|
|||||||
import { provideHttpClient } from '@angular/common/http';
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
import { provideRouter } from '@angular/router';
|
import { provideRouter } from '@angular/router';
|
||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
|
import { IndicadoresService } from './features/indicadores/indicadores.service';
|
||||||
|
import { IndicadoresPeriodos } from './features/indicadores/indicadores-periodos';
|
||||||
|
import { TeaSeguimientoService } from './features/indicadores/tea-seguimiento.service';
|
||||||
|
import { FhirIndicadoresPeriodos, FhirIndicadoresService } from './features/indicadores/indicadores-fhir';
|
||||||
|
import { FhirTeaSeguimientoService } from './features/indicadores/tea-seguimiento-fhir';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
provideBrowserGlobalErrorListeners(),
|
provideBrowserGlobalErrorListeners(),
|
||||||
provideRouter(routes),
|
provideRouter(routes),
|
||||||
|
// La sesión es del navegador (`auth/auth.service.ts`): no hay interceptor
|
||||||
|
// porque la WebApi no responde 401.
|
||||||
provideHttpClient(),
|
provideHttpClient(),
|
||||||
|
// The indicator page reads the WebApi's FHIR endpoint; without these lines it reads the indicator JSON contract
|
||||||
|
// (`/<domain>/indicadores/<id>/datos`, `/tea/seguimiento`).
|
||||||
|
{ provide: IndicadoresService, useClass: FhirIndicadoresService },
|
||||||
|
{ provide: IndicadoresPeriodos, useClass: FhirIndicadoresPeriodos },
|
||||||
|
{ provide: TeaSeguimientoService, useClass: FhirTeaSeguimientoService },
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
+42
-14
@@ -1,23 +1,51 @@
|
|||||||
<div class="app-shell" [class.app-shell--workspace]="workspace()">
|
<div class="app-shell" [class.app-shell--workspace]="workspace()" [class.app-shell--indicadores]="!!activeDomain()">
|
||||||
<header class="site-header">
|
@if (!sinCromo()) {
|
||||||
<div class="site-header__content">
|
<header class="site-header">
|
||||||
<a class="brand" routerLink="/" aria-label="ISSSTELEON, inicio">
|
<div class="site-header__content">
|
||||||
<img src="assets/branding/isssteleon-logo.png" alt="ISSSTELEON" />
|
<a class="brand" routerLink="/" aria-label="ISSSTELEON, inicio">
|
||||||
</a>
|
<img src="assets/branding/isssteleon-logo.png" alt="ISSSTELEON" />
|
||||||
<nav class="site-header__nav" aria-label="Secciones">
|
</a>
|
||||||
<a class="site-header__section" routerLink="/">Análisis de información</a>
|
@if (activeDomain(); as domain) {
|
||||||
@if (breadcrumb(); as crumb) {
|
<span class="platform-title">{{ title }}</span>
|
||||||
<span class="site-header__crumb" aria-current="page">› {{ crumb }}</span>
|
@if (otherDomains().length) {
|
||||||
|
@defer (on immediate) {
|
||||||
|
<app-domain-selector [actual]="domain" [otros]="otherDomains()" [labels]="domainLabels" />
|
||||||
|
} @placeholder {
|
||||||
|
<!-- Same size as the selector until its code arrives, so the header does not jump. -->
|
||||||
|
<span class="domain-selector domain-selector--espera" aria-hidden="true">{{ domainLabels[domain] }}</span>
|
||||||
|
}
|
||||||
|
} @else {
|
||||||
|
<!-- An account with a single domain has nothing to switch to: the domain is a label. -->
|
||||||
|
<span class="domain-selector domain-selector--espera">{{ domainLabels[domain] }}</span>
|
||||||
|
}
|
||||||
|
} @else {
|
||||||
|
<nav class="site-header__nav" aria-label="Secciones">
|
||||||
|
@if (breadcrumb(); as crumb) {
|
||||||
|
<span class="site-header__crumb" aria-current="page">{{ crumb }}</span>
|
||||||
|
}
|
||||||
|
</nav>
|
||||||
}
|
}
|
||||||
</nav>
|
@if (usuario(); as sesion) {
|
||||||
</div>
|
<button
|
||||||
</header>
|
class="site-header__salir"
|
||||||
|
type="button"
|
||||||
|
(click)="salir()"
|
||||||
|
[attr.title]="'Cerrar sesión de ' + sesion.nombre"
|
||||||
|
[attr.aria-label]="'Cerrar sesión de ' + sesion.nombre"
|
||||||
|
>
|
||||||
|
<mat-icon aria-hidden="true">logout</mat-icon>
|
||||||
|
<span class="site-header__salir-nombre">{{ sesion.nombre }}</span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
}
|
||||||
|
|
||||||
<main class="app-main">
|
<main class="app-main">
|
||||||
<router-outlet />
|
<router-outlet />
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
@if (!workspace()) {
|
@if (!workspace() && !sinCromo()) {
|
||||||
<footer class="site-footer">
|
<footer class="site-footer">
|
||||||
<div class="site-footer__content">
|
<div class="site-footer__content">
|
||||||
<img src="assets/branding/isssteleon-logo.png" alt="ISSSTELEON" />
|
<img src="assets/branding/isssteleon-logo.png" alt="ISSSTELEON" />
|
||||||
|
|||||||
+57
-31
@@ -1,43 +1,69 @@
|
|||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
import { Home } from './home';
|
import { Home } from './home';
|
||||||
|
import { authGuard } from './auth/auth.guard';
|
||||||
|
import { dominioGuard } from './auth/dominio.guard';
|
||||||
import { DOMINIOS } from './features/indicadores/indicadores.models';
|
import { DOMINIOS } from './features/indicadores/indicadores.models';
|
||||||
|
|
||||||
const loadIndicadores = () => import('./features/indicadores/indicadores-page').then(module => module.IndicadoresPage);
|
const loadIndicadores = () => import('./features/indicadores/indicadores-page').then(module => module.IndicadoresPage);
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{ path: '', component: Home, title: 'Análisis de información | ISSSTELEON' },
|
|
||||||
{
|
{
|
||||||
path: 'conectar',
|
path: 'login',
|
||||||
title: 'Conectar datos | ISSSTELEON',
|
title: 'Inicio de sesión | ISSSTELEON',
|
||||||
// Lazy: the workspace (and the ~15 Material modules it uses) only
|
loadComponent: () => import('./auth/login-page').then((m) => m.LoginPage),
|
||||||
// downloads when someone actually opens it.
|
// Sin encabezado ni pie: la pantalla ocupa la ventana completa.
|
||||||
loadComponent: () => import('./connect/components/connect-page/connect-page').then((m) => m.ConnectPage),
|
data: { sinCromo: true },
|
||||||
data: { workspace: true, breadcrumb: 'Conectar datos' },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'gobernanza',
|
// Todo lo demás vive detrás de la sesión; el guard corre en cada ruta hija.
|
||||||
title: 'Gobernanza de modelos | ISSSTELEON',
|
path: '',
|
||||||
loadComponent: () => import('./governance/components/governance-page/governance-page').then((m) => m.GovernancePage),
|
canActivateChild: [authGuard],
|
||||||
data: { workspace: true, breadcrumb: 'Gobernanza de modelos' },
|
children: [
|
||||||
|
{ path: '', component: Home, title: 'Análisis de información | ISSSTELEON' },
|
||||||
|
{
|
||||||
|
path: 'indicadores/tea-estatus',
|
||||||
|
title: 'Casos por estatus | ISSSTELEON',
|
||||||
|
loadComponent: () => import('./features/indicadores/tea-status-page').then(m => m.TeaStatusPage),
|
||||||
|
canActivate: [dominioGuard],
|
||||||
|
data: { workspace: true, breadcrumb: 'Casos por estatus', dominio: 'tea' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'conectar',
|
||||||
|
title: 'Conectar datos | ISSSTELEON',
|
||||||
|
// Lazy: the workspace (and the ~15 Material modules it uses) only
|
||||||
|
// downloads when someone actually opens it.
|
||||||
|
loadComponent: () => import('./connect/components/connect-page/connect-page').then((m) => m.ConnectPage),
|
||||||
|
data: { workspace: true, breadcrumb: 'Conectar datos' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'gobernanza',
|
||||||
|
title: 'Gobernanza de modelos | ISSSTELEON',
|
||||||
|
loadComponent: () => import('./governance/components/governance-page/governance-page').then((m) => m.GovernancePage),
|
||||||
|
data: { workspace: true, breadcrumb: 'Gobernanza de modelos' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'bitacora',
|
||||||
|
title: 'Bitácora de cargas | ISSSTELEON',
|
||||||
|
loadComponent: () => import('./reportes/reportes-page').then((m) => m.ReportsPage),
|
||||||
|
data: { workspace: true, breadcrumb: 'Bitácora de cargas' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'kpis',
|
||||||
|
title: 'Indicadores | ISSSTELEON',
|
||||||
|
loadComponent: () => import('./features/indicadores/kpis-page').then(m => m.KpisPage),
|
||||||
|
// The page reads CaCu's measures: an account of another domain goes to its own.
|
||||||
|
canActivate: [dominioGuard],
|
||||||
|
data: { workspace: true, breadcrumb: 'Indicadores', dominio: 'cacu' },
|
||||||
|
},
|
||||||
|
{ path: 'indicadores', pathMatch: 'full', redirectTo: 'indicadores/tea' },
|
||||||
|
...DOMINIOS.map(dominio => ({
|
||||||
|
path: `indicadores/${dominio}`,
|
||||||
|
title: 'Indicadores | ISSSTELEON',
|
||||||
|
data: { workspace: true, breadcrumb: 'Indicadores', dominio },
|
||||||
|
canActivate: [dominioGuard],
|
||||||
|
loadComponent: loadIndicadores,
|
||||||
|
})),
|
||||||
|
{ path: '**', redirectTo: '' },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: 'bitacora',
|
|
||||||
title: 'Bitácora de cargas | ISSSTELEON',
|
|
||||||
loadComponent: () => import('./reportes/reportes-page').then((m) => m.ReportsPage),
|
|
||||||
data: { workspace: true, breadcrumb: 'Bitácora de cargas' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'kpis',
|
|
||||||
title: 'Indicadores | ISSSTELEON',
|
|
||||||
loadComponent: () => import('./features/indicadores/kpis-page').then(m => m.KpisPage),
|
|
||||||
data: { workspace: true, breadcrumb: 'Indicadores' },
|
|
||||||
},
|
|
||||||
{ path: 'indicadores', pathMatch: 'full', redirectTo: 'indicadores/tea' },
|
|
||||||
...DOMINIOS.map(dominio => ({
|
|
||||||
path: `indicadores/${dominio}`,
|
|
||||||
title: 'Indicadores | ISSSTELEON',
|
|
||||||
data: { workspace: true, breadcrumb: 'Indicadores', dominio },
|
|
||||||
loadComponent: loadIndicadores,
|
|
||||||
})),
|
|
||||||
{ path: '**', redirectTo: '' },
|
|
||||||
];
|
];
|
||||||
|
|||||||
+86
-13
@@ -41,14 +41,6 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-header__section {
|
|
||||||
text-decoration: none;
|
|
||||||
color: var(--color-text);
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 500;
|
|
||||||
letter-spacing: 0.01em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-main {
|
.app-main {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -89,11 +81,6 @@
|
|||||||
width: clamp(132px, 42vw, 170px);
|
width: clamp(132px, 42vw, 170px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-header__section {
|
|
||||||
font-size: 13px;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-footer__content {
|
.site-footer__content {
|
||||||
min-height: 76px;
|
min-height: 76px;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
@@ -103,3 +90,89 @@
|
|||||||
width: 155px;
|
width: 155px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.platform-title {
|
||||||
|
color: var(--color-text);
|
||||||
|
font-family: var(--issste-font-heading);
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.15;
|
||||||
|
margin-inline-start: var(--issste-space-4);
|
||||||
|
margin-inline-end: auto;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.domain-selector--espera {
|
||||||
|
align-items: center; border-radius: var(--issste-radius); box-sizing: border-box; display: inline-flex; flex: 0 0 auto;
|
||||||
|
max-width: 100%; background-color: var(--issste-accent); color: var(--issste-text); font-weight: 700; line-height: 1.2;
|
||||||
|
min-height: 40px; padding: 0 16px; white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Session exit: the same action look as the home buttons, in header size. */
|
||||||
|
.site-header__salir {
|
||||||
|
align-items: center;
|
||||||
|
background: transparent;
|
||||||
|
border: 1px solid var(--color-action);
|
||||||
|
border-radius: 8px;
|
||||||
|
color: var(--color-text);
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-flex;
|
||||||
|
flex: none;
|
||||||
|
font: inherit;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
gap: 6px;
|
||||||
|
margin-inline-start: var(--space-4);
|
||||||
|
min-height: 34px;
|
||||||
|
padding: 0 var(--space-3);
|
||||||
|
transition:
|
||||||
|
background-color 0.2s ease,
|
||||||
|
border-color 0.2s ease,
|
||||||
|
color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-header__salir:hover {
|
||||||
|
background: var(--color-action-hover);
|
||||||
|
border-color: var(--color-action);
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-header__salir:focus-visible {
|
||||||
|
outline: 2px solid var(--color-action);
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-header__salir mat-icon {
|
||||||
|
color: var(--color-action);
|
||||||
|
font-size: 18px;
|
||||||
|
height: 18px;
|
||||||
|
width: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Full domain names need their own track. On a wide header they sit beside the title;
|
||||||
|
// below 900px the name takes a row of its own so the logo and the exit stay together.
|
||||||
|
.app-shell--indicadores .site-header__content {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto minmax(0, 1fr) auto auto;
|
||||||
|
grid-template-areas: "brand title domain salir";
|
||||||
|
align-items: center;
|
||||||
|
column-gap: 16px;
|
||||||
|
row-gap: 8px;
|
||||||
|
padding-block: 8px;
|
||||||
|
}
|
||||||
|
.app-shell--indicadores .brand { grid-area: brand; }
|
||||||
|
.app-shell--indicadores .platform-title { grid-area: title; margin: 0; overflow-wrap: normal; }
|
||||||
|
.app-shell--indicadores .domain-selector,
|
||||||
|
.app-shell--indicadores .domain-selector--espera { grid-area: domain; justify-self: end; }
|
||||||
|
.app-shell--indicadores .site-header__salir { grid-area: salir; margin-inline-start: 0; }
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.app-shell--indicadores .site-header__content {
|
||||||
|
grid-template-columns: auto minmax(0, 1fr);
|
||||||
|
grid-template-areas:
|
||||||
|
"brand salir"
|
||||||
|
"domain domain"
|
||||||
|
"title title";
|
||||||
|
}
|
||||||
|
.app-shell--indicadores .domain-selector,
|
||||||
|
.app-shell--indicadores .domain-selector--espera { justify-self: start; white-space: normal; }
|
||||||
|
.app-shell--indicadores .platform-title { font-size: 1.125rem; }
|
||||||
|
}
|
||||||
|
|||||||
+105
-25
@@ -1,46 +1,126 @@
|
|||||||
|
import { signal } from '@angular/core';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { provideRouter, Router } from '@angular/router';
|
|
||||||
import { provideHttpClient } from '@angular/common/http';
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||||
|
import { provideRouter, Router } from '@angular/router';
|
||||||
|
import { of } from 'rxjs';
|
||||||
import { App } from './app';
|
import { App } from './app';
|
||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
|
import { AuthService, Usuario } from './auth/auth.service';
|
||||||
|
|
||||||
|
const TODOS: Usuario = { usuario: 'admin', nombre: 'Administrador', dominios: ['cacu', 'cama', 'tea'] };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Doble de la sesión: `App` lee la señal y los guards preguntan si hay sesión y
|
||||||
|
* qué dominios alcanza. Las pruebas de este archivo cubren el marco, no el
|
||||||
|
* inicio de sesión en sí (`auth/auth.service.spec.ts`).
|
||||||
|
*/
|
||||||
|
function authFalso(sesion: Usuario | null) {
|
||||||
|
return {
|
||||||
|
usuario: signal(sesion),
|
||||||
|
autenticado: signal(sesion !== null),
|
||||||
|
sesion: () => of(sesion),
|
||||||
|
puedeVer: (dominio: string) => sesion?.dominios.includes(dominio) ?? false,
|
||||||
|
logout: () => of(undefined),
|
||||||
|
limpiar: () => undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function montar(sesion: Usuario | null): Promise<Router> {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [App],
|
||||||
|
providers: [
|
||||||
|
provideRouter(routes),
|
||||||
|
provideHttpClient(),
|
||||||
|
provideHttpClientTesting(),
|
||||||
|
{ provide: AuthService, useValue: authFalso(sesion) },
|
||||||
|
],
|
||||||
|
}).compileComponents();
|
||||||
|
return TestBed.inject(Router);
|
||||||
|
}
|
||||||
|
|
||||||
describe('App', () => {
|
describe('App', () => {
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
imports: [App],
|
|
||||||
providers: [provideRouter(routes), provideHttpClient(), provideHttpClientTesting()],
|
|
||||||
}).compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
async function render(url: string) {
|
async function render(url: string) {
|
||||||
const fixture = TestBed.createComponent(App);
|
const fixture = TestBed.createComponent(App);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await TestBed.inject(Router).navigateByUrl(url);
|
await TestBed.inject(Router).navigateByUrl(url).catch(() => false);
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
return fixture.nativeElement as HTMLElement;
|
return fixture.nativeElement as HTMLElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
it('renders the ISSSTELEON shell and home page with its footer', async () => {
|
describe('con sesión de administrador', () => {
|
||||||
const page = await render('/');
|
beforeEach(() => montar(TODOS));
|
||||||
expect(page.querySelector('.brand img')?.getAttribute('alt')).toBe('ISSSTELEON');
|
|
||||||
expect(page.querySelector('h1')?.textContent).toContain('Analiza tu información');
|
it('renders the ISSSTELEON shell and home page with its footer', async () => {
|
||||||
expect(page.querySelector('.home__action')?.getAttribute('href')).toBe('/conectar');
|
const page = await render('/');
|
||||||
expect(page.querySelector('.site-footer')).not.toBeNull();
|
expect(page.querySelector('.brand img')?.getAttribute('alt')).toBe('ISSSTELEON');
|
||||||
|
expect(page.querySelector('h1')?.textContent).toContain('Analiza tu información');
|
||||||
|
expect(page.querySelector('.home__action')?.getAttribute('href')).toBe('/conectar');
|
||||||
|
expect(page.querySelector('.site-footer')).not.toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('home shows only the brand name as eyebrow and names the risk models action', async () => {
|
||||||
|
// Fails if the eyebrow regains the section text or the action goes back to «Indicadores».
|
||||||
|
const page = await render('/');
|
||||||
|
expect(page.querySelector('.home__eyebrow')?.textContent?.trim()).toBe('ISSSTELEON');
|
||||||
|
const acciones = Array.from(page.querySelectorAll('.home__action')).map(a => a.textContent?.replace(/\s+/g, ' ').trim());
|
||||||
|
expect(acciones.some(t => t?.endsWith('Modelos predictivos de riesgo'))).toBe(true);
|
||||||
|
expect(acciones.some(t => t?.endsWith('Indicadores'))).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('/conectar opens the full-height workspace (breadcrumb, no footer)', async () => {
|
||||||
|
const page = await render('/conectar');
|
||||||
|
expect(page.querySelector('app-connect-page')).not.toBeNull();
|
||||||
|
expect(page.querySelector('.site-header__crumb')?.textContent).toContain('Conectar datos');
|
||||||
|
expect(page.querySelector('.site-footer')).toBeNull();
|
||||||
|
}, 15000);
|
||||||
|
|
||||||
|
it('/gobernanza opens the governance workspace (breadcrumb, no footer)', async () => {
|
||||||
|
const page = await render('/gobernanza');
|
||||||
|
expect(page.querySelector('app-governance-page')).not.toBeNull();
|
||||||
|
expect(page.querySelector('.site-header__crumb')?.textContent).toContain('Gobernanza de modelos');
|
||||||
|
expect(page.querySelector('.site-footer')).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('el encabezado nombra al usuario de la sesión y ofrece cerrarla', async () => {
|
||||||
|
// Fails if the shell forgets the session: the user would have no way out.
|
||||||
|
const page = await render('/');
|
||||||
|
expect(page.querySelector('.site-header__salir')?.textContent).toContain('Administrador');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('/conectar opens the full-height workspace (breadcrumb, no footer)', async () => {
|
describe('con una cuenta de un solo dominio', () => {
|
||||||
const page = await render('/conectar');
|
beforeEach(() => montar({ usuario: 'cacu', nombre: 'Equipo CaCu', dominios: ['cacu'] }));
|
||||||
expect(page.querySelector('app-connect-page')).not.toBeNull();
|
|
||||||
expect(page.querySelector('.site-header__crumb')?.textContent).toContain('Conectar datos');
|
it('no deja abrir el dominio ajeno: la manda al suyo', async () => {
|
||||||
expect(page.querySelector('.site-footer')).toBeNull();
|
// Fails if the domain scope exists only on the server: the interface would show an empty page.
|
||||||
|
await render('/indicadores/cama');
|
||||||
|
expect(TestBed.inject(Router).url).toBe('/indicadores/cacu');
|
||||||
|
}, 15000);
|
||||||
|
|
||||||
|
it('el encabezado no ofrece los otros dominios', async () => {
|
||||||
|
const page = await render('/indicadores/cacu');
|
||||||
|
expect(page.querySelector('app-domain-selector')).toBeNull();
|
||||||
|
expect(page.querySelector('.domain-selector--espera')?.textContent).toContain('Cáncer cervicouterino');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('/gobernanza opens the governance workspace (breadcrumb, no footer)', async () => {
|
describe('sin sesión', () => {
|
||||||
const page = await render('/gobernanza');
|
beforeEach(() => montar(null));
|
||||||
expect(page.querySelector('app-governance-page')).not.toBeNull();
|
|
||||||
expect(page.querySelector('.site-header__crumb')?.textContent).toContain('Gobernanza de modelos');
|
it('cualquier ruta manda al inicio de sesión y no muestra el marco', async () => {
|
||||||
expect(page.querySelector('.site-footer')).toBeNull();
|
const page = await render('/conectar');
|
||||||
|
expect(TestBed.inject(Router).url).toContain('/login');
|
||||||
|
expect(page.querySelector('.login')).not.toBeNull();
|
||||||
|
expect(page.querySelector('.site-header')).toBeNull();
|
||||||
|
expect(page.querySelector('.site-footer')).toBeNull();
|
||||||
|
expect(page.querySelector('app-connect-page')).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('el destino pedido viaja en returnUrl para volver después de entrar', async () => {
|
||||||
|
await render('/gobernanza');
|
||||||
|
expect(TestBed.inject(Router).url).toContain('returnUrl=%2Fgobernanza');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+34
-1
@@ -1,10 +1,14 @@
|
|||||||
import { Component, computed, inject } from '@angular/core';
|
import { Component, computed, inject } from '@angular/core';
|
||||||
import { toSignal } from '@angular/core/rxjs-interop';
|
import { toSignal } from '@angular/core/rxjs-interop';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { ActivatedRoute, NavigationEnd, Router, RouterLink, RouterOutlet } from '@angular/router';
|
import { ActivatedRoute, NavigationEnd, Router, RouterLink, RouterOutlet } from '@angular/router';
|
||||||
import { filter, map } from 'rxjs';
|
import { filter, map } from 'rxjs';
|
||||||
|
import { AuthService } from './auth/auth.service';
|
||||||
|
import { DomainSelector } from './domain-selector';
|
||||||
|
import { Dominio, DOMINIOS } from './features/indicadores/indicadores.models';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
imports: [RouterLink, RouterOutlet],
|
imports: [MatIconModule, RouterLink, RouterOutlet, DomainSelector],
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
styleUrl: './app.scss',
|
styleUrl: './app.scss',
|
||||||
templateUrl: './app.html',
|
templateUrl: './app.html',
|
||||||
@@ -12,6 +16,7 @@ import { filter, map } from 'rxjs';
|
|||||||
export class App {
|
export class App {
|
||||||
private readonly router = inject(Router);
|
private readonly router = inject(Router);
|
||||||
private readonly route = inject(ActivatedRoute);
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly auth = inject(AuthService);
|
||||||
|
|
||||||
private readonly leafRouteData = toSignal(
|
private readonly leafRouteData = toSignal(
|
||||||
this.router.events.pipe(
|
this.router.events.pipe(
|
||||||
@@ -28,4 +33,32 @@ export class App {
|
|||||||
/** Full-height workspace routes (`data.workspace`) drop the marketing footer. */
|
/** Full-height workspace routes (`data.workspace`) drop the marketing footer. */
|
||||||
readonly workspace = computed(() => !!this.leafRouteData()['workspace']);
|
readonly workspace = computed(() => !!this.leafRouteData()['workspace']);
|
||||||
readonly breadcrumb = computed(() => this.leafRouteData()['breadcrumb'] as string | undefined);
|
readonly breadcrumb = computed(() => this.leafRouteData()['breadcrumb'] as string | undefined);
|
||||||
|
/** The login screen (`data.sinCromo`) owns the whole window: no header, no footer. */
|
||||||
|
readonly sinCromo = computed(() => !!this.leafRouteData()['sinCromo']);
|
||||||
|
|
||||||
|
protected readonly usuario = this.auth.usuario;
|
||||||
|
protected readonly title = 'Plataforma de Indicadores';
|
||||||
|
protected readonly domainLabels: Record<Dominio, string> = {
|
||||||
|
tea: 'Trastorno del espectro autista', cacu: 'Cáncer cervicouterino', cama: 'Cáncer de mama',
|
||||||
|
};
|
||||||
|
private readonly url = toSignal(this.router.events.pipe(
|
||||||
|
filter((event) => event instanceof NavigationEnd), map(event => event.urlAfterRedirects)), { initialValue: this.router.url });
|
||||||
|
/** On an indicators page the header names its domain and switches to the others. */
|
||||||
|
protected readonly activeDomain = computed(() =>
|
||||||
|
DOMINIOS.find(domain => new RegExp(`^/indicadores/${domain}(?:[/?#]|$)`).test(this.url())));
|
||||||
|
/** Only the domains the account may see: the header never offers a forbidden one. */
|
||||||
|
private readonly permitidos = computed<readonly Dominio[]>(() => {
|
||||||
|
const sesion = this.auth.usuario();
|
||||||
|
return sesion ? DOMINIOS.filter(dominio => sesion.dominios.includes(dominio)) : DOMINIOS;
|
||||||
|
});
|
||||||
|
protected readonly otherDomains = computed(() =>
|
||||||
|
this.permitidos().filter(domain => domain !== this.activeDomain()));
|
||||||
|
|
||||||
|
protected salir(): void {
|
||||||
|
// Whether the server session was already gone, the browser ends up at the login screen.
|
||||||
|
this.auth.logout().subscribe({
|
||||||
|
next: () => void this.router.navigate(['/login']),
|
||||||
|
error: () => void this.router.navigate(['/login']),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { inject } from '@angular/core';
|
||||||
|
import { CanActivateFn, Router } from '@angular/router';
|
||||||
|
import { map } from 'rxjs';
|
||||||
|
import { AuthService } from './auth.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sin sesión no hay ruta protegida: se manda al inicio de sesión y se recuerda
|
||||||
|
* `returnUrl` para volver a donde iba el usuario.
|
||||||
|
*/
|
||||||
|
export const authGuard: CanActivateFn = (_ruta, estado) => {
|
||||||
|
const auth = inject(AuthService);
|
||||||
|
const router = inject(Router);
|
||||||
|
return auth
|
||||||
|
.sesion()
|
||||||
|
.pipe(
|
||||||
|
map(
|
||||||
|
(usuario) =>
|
||||||
|
usuario !== null ||
|
||||||
|
router.createUrlTree(['/login'], { queryParams: { returnUrl: estado.url } }),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
// La sesión vive en el navegador (la WebApi no autentica): estas pruebas fijan
|
||||||
|
// el contrato del servicio —quién entra, qué dominios ve y qué queda guardado—
|
||||||
|
// porque de él dependen el guard de rutas y el recorte de los selectores.
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { AuthService } from './auth.service';
|
||||||
|
|
||||||
|
describe('AuthService', () => {
|
||||||
|
let auth: AuthService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
sessionStorage.clear();
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
auth = TestBed.inject(AuthService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('entra con la contraseña correcta y deja al usuario en la señal', () => {
|
||||||
|
auth.login('cama', 'cama2026').subscribe();
|
||||||
|
|
||||||
|
expect(auth.usuario()).toEqual({ usuario: 'cama', nombre: 'Equipo CaMa', dominios: ['cama'] });
|
||||||
|
expect(auth.autenticado()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rechaza una contraseña incorrecta sin abrir sesión', () => {
|
||||||
|
let error: Error | undefined;
|
||||||
|
auth.login('cama', 'otra').subscribe({ error: (e: Error) => (error = e) });
|
||||||
|
|
||||||
|
expect(error?.message).toContain('incorrectos');
|
||||||
|
expect(auth.autenticado()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('dice qué dominios puede ver la cuenta', () => {
|
||||||
|
auth.login('cama', 'cama2026').subscribe();
|
||||||
|
|
||||||
|
expect(auth.puedeVer('cama')).toBe(true);
|
||||||
|
expect(auth.puedeVer('cacu')).toBe(false);
|
||||||
|
expect(auth.puedeVer('tea')).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('el administrador ve los tres dominios', () => {
|
||||||
|
auth.login('admin', 'admin2026').subscribe();
|
||||||
|
expect(['cacu', 'cama', 'tea'].every((dominio) => auth.puedeVer(dominio))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('cerrar sesión borra al usuario y lo guardado', () => {
|
||||||
|
auth.login('tea', 'tea2026').subscribe();
|
||||||
|
auth.logout().subscribe();
|
||||||
|
|
||||||
|
expect(auth.autenticado()).toBe(false);
|
||||||
|
expect(sessionStorage.getItem('isssteleon.sesion')).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('la sesión sobrevive a una recarga de la pestaña', () => {
|
||||||
|
// Fails if the login is kept only in memory: a refresh would log the team out mid-task.
|
||||||
|
auth.login('cacu', 'cacu2026').subscribe();
|
||||||
|
|
||||||
|
TestBed.resetTestingModule();
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
expect(TestBed.inject(AuthService).usuario()?.usuario).toBe('cacu');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
import { Injectable, computed, signal } from '@angular/core';
|
||||||
|
import { Observable, of, throwError } from 'rxjs';
|
||||||
|
|
||||||
|
/** El usuario de la sesión, con los dominios que la interfaz le deja ver. */
|
||||||
|
export interface Usuario {
|
||||||
|
readonly usuario: string;
|
||||||
|
readonly nombre: string;
|
||||||
|
readonly dominios: readonly string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cuentas de la interfaz. La WebApi no tiene autenticación: el inicio de sesión
|
||||||
|
* y el recorte por dominio viven aquí, en el navegador, para ordenar el trabajo
|
||||||
|
* de cada equipo. No son seguridad: cualquiera puede leer esta lista en el
|
||||||
|
* paquete de la aplicación y la API responde a quien la llame.
|
||||||
|
*/
|
||||||
|
const CUENTAS: readonly (Usuario & { contrasena: string })[] = [
|
||||||
|
{ usuario: 'admin', contrasena: 'admin2026', nombre: 'Administrador', dominios: ['cacu', 'cama', 'tea'] },
|
||||||
|
{ usuario: 'cacu', contrasena: 'cacu2026', nombre: 'Equipo CaCu', dominios: ['cacu'] },
|
||||||
|
{ usuario: 'cama', contrasena: 'cama2026', nombre: 'Equipo CaMa', dominios: ['cama'] },
|
||||||
|
{ usuario: 'tea', contrasena: 'tea2026', nombre: 'Equipo TEA', dominios: ['tea'] },
|
||||||
|
];
|
||||||
|
|
||||||
|
/** La sesión se guarda por pestaña: cerrar el navegador pide entrar de nuevo. */
|
||||||
|
const CLAVE = 'isssteleon.sesion';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sesión local de la aplicación. Es la única fuente de verdad del usuario: el
|
||||||
|
* guard pregunta aquí, los paneles filtran dominios con `puedeVer` y salir solo
|
||||||
|
* borra el registro del navegador.
|
||||||
|
*/
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class AuthService {
|
||||||
|
private readonly usuarioActual = signal<Usuario | null>(this.leer());
|
||||||
|
readonly usuario = this.usuarioActual.asReadonly();
|
||||||
|
readonly autenticado = computed(() => this.usuarioActual() !== null);
|
||||||
|
|
||||||
|
/** Si la cuenta puede ver ese dominio. Sin sesión no se opina (los guards deciden). */
|
||||||
|
puedeVer(dominio: string): boolean {
|
||||||
|
const sesion = this.usuarioActual();
|
||||||
|
return sesion ? sesion.dominios.includes(dominio) : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** La sesión guardada en esta pestaña; se resuelve al instante, sin servidor. */
|
||||||
|
sesion(): Observable<Usuario | null> {
|
||||||
|
return of(this.usuarioActual());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Valida contra la lista local; un error marca las credenciales como incorrectas. */
|
||||||
|
login(usuario: string, contrasena: string): Observable<Usuario> {
|
||||||
|
const cuenta = CUENTAS.find((c) => c.usuario === usuario.trim() && c.contrasena === contrasena);
|
||||||
|
if (!cuenta) return throwError(() => new Error('usuario o contraseña incorrectos'));
|
||||||
|
const sesion: Usuario = { usuario: cuenta.usuario, nombre: cuenta.nombre, dominios: [...cuenta.dominios] };
|
||||||
|
this.establecer(sesion);
|
||||||
|
return of(sesion);
|
||||||
|
}
|
||||||
|
|
||||||
|
logout(): Observable<void> {
|
||||||
|
this.limpiar();
|
||||||
|
return of(undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
limpiar(): void {
|
||||||
|
this.usuarioActual.set(null);
|
||||||
|
try {
|
||||||
|
sessionStorage.removeItem(CLAVE);
|
||||||
|
} catch {
|
||||||
|
// Almacenamiento deshabilitado: la sesión dura lo que la pestaña en memoria.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private establecer(sesion: Usuario): void {
|
||||||
|
this.usuarioActual.set(sesion);
|
||||||
|
try {
|
||||||
|
sessionStorage.setItem(CLAVE, JSON.stringify(sesion));
|
||||||
|
} catch {
|
||||||
|
// Idem: sin almacenamiento, la sesión no sobrevive a una recarga.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private leer(): Usuario | null {
|
||||||
|
try {
|
||||||
|
const crudo = sessionStorage.getItem(CLAVE);
|
||||||
|
if (!crudo) return null;
|
||||||
|
const sesion = JSON.parse(crudo) as Usuario;
|
||||||
|
return typeof sesion?.usuario === 'string' && Array.isArray(sesion.dominios) ? sesion : null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { Usuario } from './auth.service';
|
||||||
|
|
||||||
|
/** Same key AuthService persists the visual session under. */
|
||||||
|
const CLAVE_SESION = 'isssteleon.sesion';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seeds the browser-only visual session before the router and AuthService are created,
|
||||||
|
* so routes behind authGuard render instead of redirecting to /login. Pair every call
|
||||||
|
* with `limpiarSesionVisual()` in afterEach so the session never leaks between tests.
|
||||||
|
*/
|
||||||
|
export function iniciarSesionVisual(sesion: Usuario = { usuario: 'admin', nombre: 'Administrador', dominios: ['cacu', 'cama', 'tea'] }): void {
|
||||||
|
sessionStorage.setItem(CLAVE_SESION, JSON.stringify(sesion));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function limpiarSesionVisual(): void {
|
||||||
|
sessionStorage.removeItem(CLAVE_SESION);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { inject } from '@angular/core';
|
||||||
|
import { CanActivateFn, Router } from '@angular/router';
|
||||||
|
import { map } from 'rxjs';
|
||||||
|
import { AuthService } from './auth.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cada cuenta ve solo sus dominios: una ruta con `data.dominio` ajeno manda a la
|
||||||
|
* cuenta a su primer dominio. Sin sesión no decide nada (`authGuard` ya la
|
||||||
|
* mandó al inicio de sesión).
|
||||||
|
*/
|
||||||
|
export const dominioGuard: CanActivateFn = (ruta) => {
|
||||||
|
const auth = inject(AuthService);
|
||||||
|
const router = inject(Router);
|
||||||
|
const pedido = ruta.data?.['dominio'] as string | undefined;
|
||||||
|
return auth.sesion().pipe(
|
||||||
|
map((usuario) => {
|
||||||
|
if (!usuario || !pedido || usuario.dominios.includes(pedido)) return true;
|
||||||
|
const propio = usuario.dominios[0];
|
||||||
|
return propio ? router.createUrlTree(['/indicadores', propio]) : router.createUrlTree(['/']);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { AuthService } from './auth.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helpers for the screens that list domains (cargar información, gobernanza):
|
||||||
|
* an account only ever sees its own, and «Todos» only belongs to one that
|
||||||
|
* reaches every domain — the administrator.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** De la lista dada, las entradas cuyo dominio alcanza la cuenta. */
|
||||||
|
export function dominiosPermitidos<T extends { id: string }>(auth: AuthService, dominios: readonly T[]): T[] {
|
||||||
|
return dominios.filter((dominio) => auth.puedeVer(dominio.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Si la cuenta alcanza todos: solo entonces tiene sentido ofrecer «Todos». */
|
||||||
|
export function alcanzaTodos(auth: AuthService, dominios: readonly { id: string }[]): boolean {
|
||||||
|
return dominios.every((dominio) => auth.puedeVer(dominio.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* El dominio con el que abre una pantalla: el único que alcanza la cuenta, o
|
||||||
|
* `null` («Todos») cuando alcanza varios. Sin sesión resuelta devuelve `null`,
|
||||||
|
* que es el comportamiento de siempre.
|
||||||
|
*/
|
||||||
|
export function dominioInicial<T extends string>(auth: AuthService, dominios: readonly { id: T }[]): T | null {
|
||||||
|
const propios = dominiosPermitidos(auth, dominios);
|
||||||
|
return propios.length === 1 ? propios[0].id : null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<section class="login" aria-labelledby="login-titulo">
|
||||||
|
<div class="login__caja">
|
||||||
|
<img class="login__logo" src="assets/branding/isssteleon-logo.png" alt="ISSSTELEON" />
|
||||||
|
|
||||||
|
<h1 class="login__titulo" id="login-titulo">Inicio de sesión</h1>
|
||||||
|
|
||||||
|
<form class="login__formulario" (ngSubmit)="ingresar()" novalidate>
|
||||||
|
<mat-form-field appearance="outline" class="login__campo" subscriptSizing="dynamic">
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
name="usuario"
|
||||||
|
[(ngModel)]="usuario"
|
||||||
|
placeholder="Usuario"
|
||||||
|
aria-label="Usuario"
|
||||||
|
autocomplete="username"
|
||||||
|
autocapitalize="none"
|
||||||
|
spellcheck="false"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="login__campo" subscriptSizing="dynamic">
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
name="contrasena"
|
||||||
|
[(ngModel)]="contrasena"
|
||||||
|
[type]="verContrasena() ? 'text' : 'password'"
|
||||||
|
placeholder="Contraseña"
|
||||||
|
aria-label="Contraseña"
|
||||||
|
autocomplete="current-password"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
mat-icon-button
|
||||||
|
matSuffix
|
||||||
|
type="button"
|
||||||
|
class="login__ojo"
|
||||||
|
(click)="mostrarContrasena()"
|
||||||
|
[attr.aria-label]="verContrasena() ? 'Ocultar contraseña' : 'Mostrar contraseña'"
|
||||||
|
[attr.aria-pressed]="verContrasena()"
|
||||||
|
>
|
||||||
|
<mat-icon>{{ verContrasena() ? 'visibility_off' : 'visibility' }}</mat-icon>
|
||||||
|
</button>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
@if (error(); as mensaje) {
|
||||||
|
<p class="login__error" role="alert">{{ mensaje }}</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="login__ingresar"
|
||||||
|
[disabled]="!usuario.trim() || !contrasena || enviando()"
|
||||||
|
>
|
||||||
|
{{ enviando() ? 'Ingresando…' : 'Ingresar' }}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p class="login__legal">©{{ anio }} Todos los derechos reservados.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
:host {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
/* The button borrows the home actions' palette: white with a thin gray border
|
||||||
|
until the form is complete, then `--color-action` (see styles.scss). */
|
||||||
|
--login-fondo: #f8f9fa;
|
||||||
|
--login-borde: #e9ecef;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login {
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
justify-content: center;
|
||||||
|
/* The whole block sits a little below the middle: the logo above it gives the screen its weight. */
|
||||||
|
padding: var(--space-9) var(--space-5) var(--space-8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__caja {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--space-4);
|
||||||
|
max-width: 340px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The brand opens the screen and is the biggest thing on it: it is what fills the empty space. */
|
||||||
|
.login__logo {
|
||||||
|
align-self: center;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 0;
|
||||||
|
width: 260px;
|
||||||
|
animation: login-logo-entrada 600ms ease-out both;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes login-logo-entrada {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.login__logo {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__titulo {
|
||||||
|
align-items: center;
|
||||||
|
color: var(--color-text);
|
||||||
|
display: flex;
|
||||||
|
font-family: var(--font-heading);
|
||||||
|
font-size: 1.375rem;
|
||||||
|
font-weight: 600;
|
||||||
|
gap: var(--space-4);
|
||||||
|
margin: 0 0 var(--space-2);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The two rules that flank the title, as in the reference screen. */
|
||||||
|
.login__titulo::before,
|
||||||
|
.login__titulo::after {
|
||||||
|
background: var(--color-border);
|
||||||
|
content: '';
|
||||||
|
flex: 1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__formulario {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--space-3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__campo {
|
||||||
|
width: 100%;
|
||||||
|
--mat-form-field-container-height: 44px;
|
||||||
|
--mat-form-field-container-vertical-padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__ojo {
|
||||||
|
color: var(--color-text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Edge paints its own reveal control over the password field; the eye in the field is ours. */
|
||||||
|
.login__campo input::-ms-reveal,
|
||||||
|
.login__campo input::-ms-clear {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__error {
|
||||||
|
color: var(--mat-sys-error);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
margin: calc(-1 * var(--space-1)) 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The button shares the fields' width: one column, one border, no icon and no underline.
|
||||||
|
Its border turns teal when the form is complete, and it fades in instead of switching. */
|
||||||
|
.login__ingresar {
|
||||||
|
align-items: center;
|
||||||
|
background: var(--login-fondo);
|
||||||
|
border: 1px solid var(--login-borde);
|
||||||
|
border-radius: 10px;
|
||||||
|
color: var(--color-text-secondary);
|
||||||
|
cursor: default;
|
||||||
|
display: flex;
|
||||||
|
font: inherit;
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
font-weight: 500;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: var(--space-2);
|
||||||
|
min-height: 46px;
|
||||||
|
padding: 0 var(--space-5);
|
||||||
|
text-decoration: none;
|
||||||
|
transition:
|
||||||
|
background-color 260ms ease,
|
||||||
|
border-color 260ms ease,
|
||||||
|
color 260ms ease;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__ingresar:not(:disabled) {
|
||||||
|
border-color: var(--color-action);
|
||||||
|
color: var(--color-text);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__ingresar:hover:not(:disabled) {
|
||||||
|
background: var(--color-action-hover);
|
||||||
|
border-color: var(--color-action);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__ingresar:focus-visible {
|
||||||
|
outline: 2px solid var(--color-action);
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__ingresar:disabled {
|
||||||
|
background: var(--login-fondo);
|
||||||
|
border-color: var(--login-borde);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__legal {
|
||||||
|
color: var(--color-text-secondary);
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
margin: var(--space-4) 0 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.login {
|
||||||
|
padding: var(--space-7) var(--space-4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__caja {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login__logo {
|
||||||
|
width: 208px;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import { Component, OnInit, inject, signal } from '@angular/core';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { AuthService } from './auth.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicio de sesión: valida contra las cuentas locales de `AuthService` y, si el
|
||||||
|
* usuario ya tiene sesión, salta al destino. `returnUrl` lo pone el guard cuando
|
||||||
|
* una ruta protegida lo trajo aquí.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'app-login-page',
|
||||||
|
imports: [FormsModule, MatButtonModule, MatFormFieldModule, MatIconModule, MatInputModule],
|
||||||
|
styleUrl: './login-page.scss',
|
||||||
|
templateUrl: './login-page.html',
|
||||||
|
})
|
||||||
|
export class LoginPage implements OnInit {
|
||||||
|
private readonly auth = inject(AuthService);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly ruta = inject(ActivatedRoute);
|
||||||
|
|
||||||
|
protected usuario = '';
|
||||||
|
protected contrasena = '';
|
||||||
|
protected readonly verContrasena = signal(false);
|
||||||
|
protected readonly enviando = signal(false);
|
||||||
|
protected readonly error = signal<string | null>(null);
|
||||||
|
protected readonly anio = new Date().getFullYear();
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
// Quien ya inició sesión y abre /login vuelve derecho a la aplicación.
|
||||||
|
this.auth.sesion().subscribe((usuario) => {
|
||||||
|
if (usuario) void this.router.navigateByUrl(this.destino());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ingresar(): void {
|
||||||
|
if (!this.usuario.trim() || !this.contrasena || this.enviando()) return;
|
||||||
|
this.enviando.set(true);
|
||||||
|
this.error.set(null);
|
||||||
|
this.auth.login(this.usuario.trim(), this.contrasena).subscribe({
|
||||||
|
next: () => void this.router.navigateByUrl(this.destino()),
|
||||||
|
error: () => {
|
||||||
|
this.enviando.set(false);
|
||||||
|
this.error.set('Usuario o contraseña incorrectos.');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected mostrarContrasena(): void {
|
||||||
|
this.verContrasena.update((visible) => !visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
private destino(): string {
|
||||||
|
const pedido = this.ruta.snapshot.queryParamMap.get('returnUrl');
|
||||||
|
return pedido?.startsWith('/') && !pedido.startsWith('/login') ? pedido : '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
aria-label="Base de datos destino"
|
aria-label="Base de datos destino"
|
||||||
[matTooltip]="store.domainLocked() ? 'Una carga va a una sola base; quita los flujos para cambiarla' : 'Base de datos destino'"
|
[matTooltip]="store.domainLocked() ? 'Una carga va a una sola base; quita los flujos para cambiarla' : 'Base de datos destino'"
|
||||||
>
|
>
|
||||||
@for (domain of domains; track domain.id) {
|
@for (domain of domains(); track domain.id) {
|
||||||
<mat-button-toggle [value]="domain.id" [attr.aria-label]="domain.description">{{ domain.label }}</mat-button-toggle>
|
<mat-button-toggle [value]="domain.id" [attr.aria-label]="domain.description">{{ domain.label }}</mat-button-toggle>
|
||||||
}
|
}
|
||||||
</mat-button-toggle-group>
|
</mat-button-toggle-group>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||||
import { DecimalPipe } from '@angular/common';
|
import { DecimalPipe } from '@angular/common';
|
||||||
import { Component, Injector, inject, signal } from '@angular/core';
|
import { Component, Injector, computed, inject, signal } from '@angular/core';
|
||||||
import { MatBadgeModule } from '@angular/material/badge';
|
import { MatBadgeModule } from '@angular/material/badge';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||||
@@ -12,6 +12,8 @@ import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
|||||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
import { Domain, TargetMeta } from '../../api/api.types';
|
import { Domain, TargetMeta } from '../../api/api.types';
|
||||||
|
import { AuthService } from '../../../auth/auth.service';
|
||||||
|
import { dominiosPermitidos } from '../../../auth/dominios';
|
||||||
import { DataConnection, SourceTable } from '../../domain/data-source';
|
import { DataConnection, SourceTable } from '../../domain/data-source';
|
||||||
import { PdfConnection } from '../../domain/pdf-source';
|
import { PdfConnection } from '../../domain/pdf-source';
|
||||||
import { SqlConnection } from '../../domain/sql-source';
|
import { SqlConnection } from '../../domain/sql-source';
|
||||||
@@ -59,11 +61,13 @@ import { SqlQueryDialog, SqlQueryResult } from '../sql-query-dialog/sql-query-di
|
|||||||
})
|
})
|
||||||
export class ConnectPage {
|
export class ConnectPage {
|
||||||
readonly store = inject(ConnectWorkspaceStore);
|
readonly store = inject(ConnectWorkspaceStore);
|
||||||
|
private readonly auth = inject(AuthService);
|
||||||
private readonly dialog = inject(MatDialog);
|
private readonly dialog = inject(MatDialog);
|
||||||
private readonly snackBar = inject(MatSnackBar);
|
private readonly snackBar = inject(MatSnackBar);
|
||||||
private readonly injector = inject(Injector);
|
private readonly injector = inject(Injector);
|
||||||
|
|
||||||
readonly domains = DOMAINS;
|
/** Only the account's own databases: the picker never offers a domain the server will reject. */
|
||||||
|
readonly domains = computed(() => dominiosPermitidos(this.auth, DOMAINS));
|
||||||
readonly paneOpen = signal(true);
|
readonly paneOpen = signal(true);
|
||||||
readonly validatingAll = signal(false);
|
readonly validatingAll = signal(false);
|
||||||
|
|
||||||
|
|||||||
@@ -100,8 +100,8 @@
|
|||||||
type="button"
|
type="button"
|
||||||
class="saved-connection__forget"
|
class="saved-connection__forget"
|
||||||
(click)="forgetSaved(saved, $event)"
|
(click)="forgetSaved(saved, $event)"
|
||||||
aria-label="Olvidar esta conexión guardada"
|
aria-label="Eliminar esta conexión guardada"
|
||||||
matTooltip="Olvidar"
|
matTooltip="Eliminar"
|
||||||
>
|
>
|
||||||
<mat-icon aria-hidden="true">close</mat-icon>
|
<mat-icon aria-hidden="true">close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</form>
|
</form>
|
||||||
<mat-checkbox [checked]="remember()" (change)="remember.set($event.checked)">
|
<mat-checkbox [checked]="remember()" (change)="remember.set($event.checked)">
|
||||||
Recordar servidor, usuario y base de datos (nunca la contraseña)
|
Guardar servidor, usuario y base de datos para conexiones futuras (la contraseña no se guarda)
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { Observable, firstValueFrom, of } from 'rxjs';
|
import { Observable, firstValueFrom, of } from 'rxjs';
|
||||||
|
import { AuthService } from '../../auth/auth.service';
|
||||||
import { BatchResult, ConflictStrategy, ImportSourcePayload, TargetMeta } from '../api/api.types';
|
import { BatchResult, ConflictStrategy, ImportSourcePayload, TargetMeta } from '../api/api.types';
|
||||||
import { ImportsApi } from '../api/imports.api';
|
import { ImportsApi } from '../api/imports.api';
|
||||||
import { SourceGateway } from '../api/source-gateway';
|
import { SourceGateway } from '../api/source-gateway';
|
||||||
@@ -32,6 +33,8 @@ describe('ConnectWorkspaceStore', () => {
|
|||||||
{ provide: TargetsApi, useValue: { list: () => of([PACIENTE, NOTA, tama]) } },
|
{ provide: TargetsApi, useValue: { list: () => of([PACIENTE, NOTA, tama]) } },
|
||||||
{ provide: ImportsApi, useValue: imports },
|
{ provide: ImportsApi, useValue: imports },
|
||||||
{ provide: SourceGateway, useValue: {} },
|
{ provide: SourceGateway, useValue: {} },
|
||||||
|
// Sin sesión resuelta el alcance es todo; el caso restringido se arma en su propia prueba.
|
||||||
|
{ provide: AuthService, useValue: { puedeVer: () => true } },
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
store = TestBed.inject(ConnectWorkspaceStore);
|
store = TestBed.inject(ConnectWorkspaceStore);
|
||||||
@@ -52,6 +55,25 @@ describe('ConnectWorkspaceStore', () => {
|
|||||||
expect(store.domain()).toBe('cacu');
|
expect(store.domain()).toBe('cacu');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('opens on the account\'s own domain and refuses the others', () => {
|
||||||
|
// Fails if the destination database ignores the session: a CaMa team could load into CaCu's database.
|
||||||
|
TestBed.resetTestingModule();
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [
|
||||||
|
ConnectWorkspaceStore,
|
||||||
|
{ provide: TargetsApi, useValue: { list: () => of([PACIENTE, NOTA, tama]) } },
|
||||||
|
{ provide: ImportsApi, useValue: imports },
|
||||||
|
{ provide: SourceGateway, useValue: {} },
|
||||||
|
{ provide: AuthService, useValue: { puedeVer: (dominio: string) => dominio === 'cama' } },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
const restringido = TestBed.inject(ConnectWorkspaceStore);
|
||||||
|
|
||||||
|
expect(restringido.domain()).toBe('cama');
|
||||||
|
restringido.setDomain('cacu');
|
||||||
|
expect(restringido.domain()).toBe('cama');
|
||||||
|
});
|
||||||
|
|
||||||
it('removing a connection removes the flows built on its tables', () => {
|
it('removing a connection removes the flows built on its tables', () => {
|
||||||
const { connection } = flowFrom('a.csv', PACIENTE);
|
const { connection } = flowFrom('a.csv', PACIENTE);
|
||||||
flowFrom('b.csv', PACIENTE);
|
flowFrom('b.csv', PACIENTE);
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { Injectable, computed, inject, signal } from '@angular/core';
|
|||||||
import { toSignal } from '@angular/core/rxjs-interop';
|
import { toSignal } from '@angular/core/rxjs-interop';
|
||||||
import { Observable, catchError, from, of, switchMap, tap } from 'rxjs';
|
import { Observable, catchError, from, of, switchMap, tap } from 'rxjs';
|
||||||
import { BatchResult, ConflictStrategy, ConnectorInfo, Domain, TargetMeta, apiErrorMessage } from '../api/api.types';
|
import { BatchResult, ConflictStrategy, ConnectorInfo, Domain, TargetMeta, apiErrorMessage } from '../api/api.types';
|
||||||
|
import { AuthService } from '../../auth/auth.service';
|
||||||
|
import { dominiosPermitidos } from '../../auth/dominios';
|
||||||
import { ConnectorsApi } from '../api/connectors.api';
|
import { ConnectorsApi } from '../api/connectors.api';
|
||||||
import { ImportsApi } from '../api/imports.api';
|
import { ImportsApi } from '../api/imports.api';
|
||||||
import { SourceGateway } from '../api/source-gateway';
|
import { SourceGateway } from '../api/source-gateway';
|
||||||
@@ -11,9 +13,9 @@ import { DataConnection, SourceTable } from '../domain/data-source';
|
|||||||
import { ImportFlow } from '../domain/import-flow';
|
import { ImportFlow } from '../domain/import-flow';
|
||||||
|
|
||||||
export const DOMAINS: { id: Domain; label: string; description: string }[] = [
|
export const DOMAINS: { id: Domain; label: string; description: string }[] = [
|
||||||
{ id: 'cacu', label: 'CaCu', description: 'Cáncer cervicouterino' },
|
{ id: 'cacu', label: 'Cáncer cervicouterino', description: 'Cáncer cervicouterino' },
|
||||||
{ id: 'cama', label: 'CaMa', description: 'Cáncer de mama' },
|
{ id: 'cama', label: 'Cáncer de mama', description: 'Cáncer de mama' },
|
||||||
{ id: 'tea', label: 'TEA', description: 'Trastorno del espectro autista' },
|
{ id: 'tea', label: 'Trastorno del espectro autista', description: 'Trastorno del espectro autista' },
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,6 +31,7 @@ export const DOMAINS: { id: Domain; label: string; description: string }[] = [
|
|||||||
export class ConnectWorkspaceStore {
|
export class ConnectWorkspaceStore {
|
||||||
private readonly gateway = inject(SourceGateway);
|
private readonly gateway = inject(SourceGateway);
|
||||||
private readonly importsApi = inject(ImportsApi);
|
private readonly importsApi = inject(ImportsApi);
|
||||||
|
private readonly auth = inject(AuthService);
|
||||||
|
|
||||||
private readonly targetsError = signal<string | null>(null);
|
private readonly targetsError = signal<string | null>(null);
|
||||||
readonly allTargets = toSignal(
|
readonly allTargets = toSignal(
|
||||||
@@ -50,7 +53,8 @@ export class ConnectWorkspaceStore {
|
|||||||
});
|
});
|
||||||
readonly acceptedExtensions = computed(() => acceptedExtensions(this.connectors()));
|
readonly acceptedExtensions = computed(() => acceptedExtensions(this.connectors()));
|
||||||
|
|
||||||
private readonly _domain = signal<Domain>('cacu');
|
/** The destination database: the account's own when it only reaches one. */
|
||||||
|
private readonly _domain = signal<Domain>(this.dominioInicial());
|
||||||
private readonly _connections = signal<DataConnection[]>([]);
|
private readonly _connections = signal<DataConnection[]>([]);
|
||||||
private readonly _flows = signal<ImportFlow[]>([]);
|
private readonly _flows = signal<ImportFlow[]>([]);
|
||||||
private readonly _selectedFlowId = signal<string | null>(null);
|
private readonly _selectedFlowId = signal<string | null>(null);
|
||||||
@@ -128,7 +132,12 @@ export class ConnectWorkspaceStore {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setDomain(domain: Domain): void {
|
setDomain(domain: Domain): void {
|
||||||
if (!this.domainLocked()) this._domain.set(domain);
|
if (!this.domainLocked() && this.auth.puedeVer(domain)) this._domain.set(domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The first domain the account may see; every account has at least one (`WebApi` gives none other). */
|
||||||
|
private dominioInicial(): Domain {
|
||||||
|
return dominiosPermitidos(this.auth, DOMAINS)[0]?.id ?? 'cacu';
|
||||||
}
|
}
|
||||||
|
|
||||||
setOnConflict(strategy: ConflictStrategy): void {
|
setOnConflict(strategy: ConflictStrategy): void {
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
:host { display: contents; }
|
||||||
|
.domain-selector {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
min-height: 40px;
|
||||||
|
background-color: var(--issste-accent);
|
||||||
|
color: var(--issste-text);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.2;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.domain-selector { white-space: normal; text-align: start; padding-block: 8px; }
|
||||||
|
}
|
||||||
|
.domain-selector:hover { background-color: var(--issste-accent); filter: brightness(.94); }
|
||||||
|
.domain-selector:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 2px; }
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { Component, input } from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
|
import { Dominio } from './features/indicadores/indicadores.models';
|
||||||
|
|
||||||
|
/** The header's domain menu. Loaded deferred: Material's menu and overlay are not needed by the institutional routes. */
|
||||||
|
@Component({
|
||||||
|
selector: 'app-domain-selector',
|
||||||
|
imports: [RouterLink, MatButtonModule, MatMenuModule],
|
||||||
|
template: `
|
||||||
|
<button class="domain-selector" mat-button [matMenuTriggerFor]="domainMenu"
|
||||||
|
[attr.aria-label]="'Dominio actual: ' + labels()[actual()] + '. Cambiar dominio'">
|
||||||
|
{{ labels()[actual()] }} <span aria-hidden="true">▾</span>
|
||||||
|
</button>
|
||||||
|
<mat-menu #domainMenu="matMenu" aria-label="Cambiar dominio de indicadores">
|
||||||
|
@for (option of otros(); track option) {
|
||||||
|
<a mat-menu-item [routerLink]="['/indicadores', option]">{{ labels()[option] }}</a>
|
||||||
|
}
|
||||||
|
</mat-menu>
|
||||||
|
`,
|
||||||
|
styleUrl: './domain-selector.scss',
|
||||||
|
})
|
||||||
|
export class DomainSelector {
|
||||||
|
readonly actual = input.required<Dominio>();
|
||||||
|
readonly otros = input.required<readonly Dominio[]>();
|
||||||
|
readonly labels = input.required<Record<Dominio, string>>();
|
||||||
|
}
|
||||||
@@ -1,19 +1,30 @@
|
|||||||
export interface SeguimientoQuery { corte?: string; meses: 1 | 3 | 6 | 12; estatus?: string; page: number; page_size: number; }
|
export type ProbabilidadClave = 'lieag' | 'cancer' | 'supervivencia';
|
||||||
|
export type OrdenSeguimiento = 'reciente' | ProbabilidadClave;
|
||||||
|
export interface SeguimientoQuery { corte?: string; meses: 1 | 3 | 6 | 12; estatus?: string; orden?: OrdenSeguimiento; horizonte?: number; grupo_edad?: string; mchat?: string; css?: string; estado_caso?: string; alteracion?: string; page: number; page_size: number; }
|
||||||
export interface SeguimientoStatus { codigo: string; etiqueta: string; }
|
export interface SeguimientoStatus { codigo: string; etiqueta: string; }
|
||||||
|
// A row names its patient with `pac_id` (a decimal string) or the legacy `id_seudonimo`.
|
||||||
export interface SeguimientoPaciente {
|
export interface SeguimientoPaciente {
|
||||||
id_seudonimo: string;
|
pac_id?: string;
|
||||||
|
id_seudonimo?: string;
|
||||||
grupo_edad: string;
|
grupo_edad: string;
|
||||||
estatus: SeguimientoStatus;
|
estatus: SeguimientoStatus;
|
||||||
ultima_citologia: { fecha: string; bethesda: string | null; calidad: string | null } | null;
|
ultima_citologia: { fecha: string; bethesda: string | null; calidad: string | null } | null;
|
||||||
ultimo_vph: { fecha: string; resultado: string; genotipo_16_18: boolean | null } | null;
|
ultimo_vph: { fecha: string; resultado: string; genotipo_16_18: boolean | null } | null;
|
||||||
dias_toma_diagnostico: number | null;
|
dias_toma_diagnostico: number | null;
|
||||||
|
/** CaCu: her latest biopsy reported by the cut-off, with its grade. */
|
||||||
|
ultima_biopsia?: { fecha: string; grado: string | null } | null;
|
||||||
|
/** CaCu: her current probability of LIEAG+, of cancer and (a case's) of surviving at each horizon, from the confirmed batches. */
|
||||||
|
probabilidades?: Partial<Record<ProbabilidadClave, ProbabilidadHorizonte[]>> | null;
|
||||||
prioridad: SeguimientoStatus | null;
|
prioridad: SeguimientoStatus | null;
|
||||||
}
|
}
|
||||||
|
export interface ProbabilidadHorizonte { horizonte_anios: number; probabilidad: number; ic_bajo: number | null; ic_alto: number | null; }
|
||||||
export interface SeguimientoResponse {
|
export interface SeguimientoResponse {
|
||||||
simulado: boolean;
|
simulado: boolean;
|
||||||
corte: string;
|
corte: string;
|
||||||
ventana: { meses: 1 | 3 | 6 | 12; desde: string; hasta: string };
|
ventana: { meses: 1 | 3 | 6 | 12; desde: string; hasta: string };
|
||||||
filtros: { estatus: string | null };
|
filtros: { estatus: string | null; orden?: OrdenSeguimiento; horizonte?: number };
|
||||||
|
/** The horizons the models give, in years, for ordering and showing the probabilities. */
|
||||||
|
horizontes_disponibles?: number[];
|
||||||
estatus_disponibles: SeguimientoStatus[];
|
estatus_disponibles: SeguimientoStatus[];
|
||||||
reglas: { clave: string; valor: unknown; estado: 'provisional' | 'confirmado' }[];
|
reglas: { clave: string; valor: unknown; estado: 'provisional' | 'confirmado' }[];
|
||||||
paginacion: { page: number; page_size: number; total_items: number; total_pages: number };
|
paginacion: { page: number; page_size: number; total_items: number; total_pages: number };
|
||||||
@@ -27,3 +38,15 @@ export function isoDate(value: unknown): value is string {
|
|||||||
export function latestStudy(item: SeguimientoPaciente): string | null {
|
export function latestStudy(item: SeguimientoPaciente): string | null {
|
||||||
return [item.ultima_citologia?.fecha, item.ultimo_vph?.fecha].filter(isoDate).sort().at(-1) ?? null;
|
return [item.ultima_citologia?.fecha, item.ultimo_vph?.fecha].filter(isoDate).sort().at(-1) ?? null;
|
||||||
}
|
}
|
||||||
|
/** Her probability of `clave` at `horizonte`, or `undefined` when no model gives it. */
|
||||||
|
export function probabilidadAl(item: SeguimientoPaciente, clave: ProbabilidadClave, horizonte: number): ProbabilidadHorizonte | undefined {
|
||||||
|
return item.probabilidades?.[clave]?.find(h => h.horizonte_anios === horizonte);
|
||||||
|
}
|
||||||
|
/** CaCu: the probability columns a follow-up status shows, the ones its scenario's models give (a case: survival).
|
||||||
|
* Every patient or an unknown status shows none: each scenario has its own models. */
|
||||||
|
export const COLUMNAS_DE_PROBABILIDAD: Readonly<Record<string, readonly ProbabilidadClave[]>> = {
|
||||||
|
CASO: ['supervivencia'], PRE_COLPOSCOPIA: ['lieag', 'cancer'], POST_COLPOSCOPIA: ['lieag'], POST_TRATAMIENTO: ['lieag'],
|
||||||
|
};
|
||||||
|
export const ETIQUETA_PROBABILIDAD: Readonly<Record<ProbabilidadClave, string>> = {
|
||||||
|
lieag: 'Probabilidad a LIEAG+', cancer: 'Probabilidad a cáncer', supervivencia: 'Probabilidad de supervivencia',
|
||||||
|
};
|
||||||
|
|||||||
@@ -2,11 +2,21 @@ import { inject, Injectable } from '@angular/core';
|
|||||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { map } from 'rxjs';
|
import { map } from 'rxjs';
|
||||||
import { isoDate, SeguimientoQuery, SeguimientoResponse } from './cacu-seguimiento.models';
|
import { isoDate, SeguimientoQuery, SeguimientoResponse } from './cacu-seguimiento.models';
|
||||||
|
import { identidadDe, identidadesDe } from './paciente-identidad';
|
||||||
|
import { PAGE_SIZE_MAX } from './seguimiento-tabla.service';
|
||||||
const record = (v: unknown): v is Record<string, unknown> => !!v && typeof v === 'object' && !Array.isArray(v);
|
const record = (v: unknown): v is Record<string, unknown> => !!v && typeof v === 'object' && !Array.isArray(v);
|
||||||
const status = (v: unknown) => record(v) && typeof v['codigo'] === 'string' && typeof v['etiqueta'] === 'string';
|
const status = (v: unknown) => record(v) && typeof v['codigo'] === 'string' && typeof v['etiqueta'] === 'string';
|
||||||
const integer = (v: unknown, min = 0) => typeof v === 'number' && Number.isSafeInteger(v) && v >= min;
|
const integer = (v: unknown, min = 0) => typeof v === 'number' && Number.isSafeInteger(v) && v >= min;
|
||||||
|
const ORDENES = ['reciente', 'lieag', 'cancer', 'supervivencia'];
|
||||||
|
const anios = (v: unknown) => typeof v === 'number' && Number.isFinite(v) && v >= 0;
|
||||||
|
const prob = (v: unknown) => typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 1;
|
||||||
|
// CaCu's biopsy and probabilities are optional: an API that doesn't give them still validates.
|
||||||
|
const biopsia = (b: unknown) => b === undefined || b === null || record(b) && isoDate(b['fecha']) && (b['grado'] === null || typeof b['grado'] === 'string');
|
||||||
|
const probabilidades = (p: unknown) => p === undefined || p === null || record(p) && Object.entries(p).every(([k, hs]) =>
|
||||||
|
['lieag', 'cancer', 'supervivencia'].includes(k) && Array.isArray(hs) && hs.every(h => record(h) && anios(h['horizonte_anios']) && prob(h['probabilidad'])
|
||||||
|
&& (h['ic_bajo'] === null || prob(h['ic_bajo'])) && (h['ic_alto'] === null || prob(h['ic_alto']))));
|
||||||
export function validSeguimientoQuery(q: SeguimientoQuery) {
|
export function validSeguimientoQuery(q: SeguimientoQuery) {
|
||||||
return (!q.corte || isoDate(q.corte)) && [1,3,6,12].includes(q.meses) && integer(q.page, 1) && integer(q.page_size, 1) && q.page_size <= 200;
|
return (!q.corte || isoDate(q.corte)) && [1,3,6,12].includes(q.meses) && integer(q.page, 1) && integer(q.page_size, 1) && q.page_size <= PAGE_SIZE_MAX;
|
||||||
}
|
}
|
||||||
export function seguimientoResponse(v: unknown): SeguimientoResponse {
|
export function seguimientoResponse(v: unknown): SeguimientoResponse {
|
||||||
// The current authorization covers demonstration records only. Validate this
|
// The current authorization covers demonstration records only. Validate this
|
||||||
@@ -15,16 +25,19 @@ export function seguimientoResponse(v: unknown): SeguimientoResponse {
|
|||||||
const p = v['paginacion'], window = v['ventana'], filters = v['filtros'];
|
const p = v['paginacion'], window = v['ventana'], filters = v['filtros'];
|
||||||
if (!isoDate(v['corte']) || !record(window) || ![1,3,6,12].includes(window['meses'] as number) || !isoDate(window['desde']) || !isoDate(window['hasta'])
|
if (!isoDate(v['corte']) || !record(window) || ![1,3,6,12].includes(window['meses'] as number) || !isoDate(window['desde']) || !isoDate(window['hasta'])
|
||||||
|| !record(filters) || (filters['estatus'] !== null && typeof filters['estatus'] !== 'string')
|
|| !record(filters) || (filters['estatus'] !== null && typeof filters['estatus'] !== 'string')
|
||||||
|
|| (filters['orden'] !== undefined && !ORDENES.includes(filters['orden'] as string))
|
||||||
|
|| (v['horizontes_disponibles'] !== undefined && !(Array.isArray(v['horizontes_disponibles']) && v['horizontes_disponibles'].every(anios)))
|
||||||
|| !Array.isArray(v['estatus_disponibles']) || !v['estatus_disponibles'].every(status)
|
|| !Array.isArray(v['estatus_disponibles']) || !v['estatus_disponibles'].every(status)
|
||||||
|| !Array.isArray(v['reglas']) || !v['reglas'].every(r => record(r) && typeof r['clave'] === 'string' && Object.hasOwn(r, 'valor') && ['provisional','confirmado'].includes(r['estado'] as string))
|
|| !Array.isArray(v['reglas']) || !v['reglas'].every(r => record(r) && typeof r['clave'] === 'string' && Object.hasOwn(r, 'valor') && ['provisional','confirmado'].includes(r['estado'] as string))
|
||||||
|| !record(p) || !integer(p['page'], 1) || !integer(p['page_size'], 1) || (p['page_size'] as number) > 200 || !integer(p['total_items']) || !integer(p['total_pages'])
|
|| !record(p) || !integer(p['page'], 1) || !integer(p['page_size'], 1) || (p['page_size'] as number) > PAGE_SIZE_MAX || !integer(p['total_items']) || !integer(p['total_pages'])
|
||||||
|| !Array.isArray(v['items']) || v['items'].length > (p['page_size'] as number) || !v['items'].every(item => {
|
|| !Array.isArray(v['items']) || v['items'].length > (p['page_size'] as number) || !v['items'].every(item => {
|
||||||
if (!record(item) || typeof item['id_seudonimo'] !== 'string' || typeof item['grupo_edad'] !== 'string' || !status(item['estatus'])) return false;
|
if (!record(item) || !identidadDe(item) || typeof item['grupo_edad'] !== 'string' || !status(item['estatus'])) return false;
|
||||||
const c = item['ultima_citologia'], h = item['ultimo_vph'];
|
const c = item['ultima_citologia'], h = item['ultimo_vph'];
|
||||||
return (c === null || record(c) && isoDate(c['fecha']) && (c['bethesda'] === null || typeof c['bethesda'] === 'string') && (c['calidad'] === null || typeof c['calidad'] === 'string'))
|
return (c === null || record(c) && isoDate(c['fecha']) && (c['bethesda'] === null || typeof c['bethesda'] === 'string') && (c['calidad'] === null || typeof c['calidad'] === 'string'))
|
||||||
&& (h === null || record(h) && isoDate(h['fecha']) && typeof h['resultado'] === 'string' && (h['genotipo_16_18'] === null || typeof h['genotipo_16_18'] === 'boolean'))
|
&& (h === null || record(h) && isoDate(h['fecha']) && typeof h['resultado'] === 'string' && (h['genotipo_16_18'] === null || typeof h['genotipo_16_18'] === 'boolean'))
|
||||||
&& (item['dias_toma_diagnostico'] === null || integer(item['dias_toma_diagnostico'])) && (item['prioridad'] === null || status(item['prioridad']));
|
&& (item['dias_toma_diagnostico'] === null || integer(item['dias_toma_diagnostico'])) && (item['prioridad'] === null || status(item['prioridad']))
|
||||||
})) throw new Error('Respuesta de seguimiento inválida');
|
&& biopsia(item['ultima_biopsia']) && probabilidades(item['probabilidades']);
|
||||||
|
}) || !identidadesDe(v['items'])) throw new Error('Respuesta de seguimiento inválida');
|
||||||
return v as unknown as SeguimientoResponse;
|
return v as unknown as SeguimientoResponse;
|
||||||
}
|
}
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
@@ -35,6 +48,8 @@ export class CacuSeguimientoService {
|
|||||||
let params = new HttpParams().set('meses', query.meses).set('page', query.page).set('page_size', query.page_size);
|
let params = new HttpParams().set('meses', query.meses).set('page', query.page).set('page_size', query.page_size);
|
||||||
if (query.corte) params = params.set('corte', query.corte);
|
if (query.corte) params = params.set('corte', query.corte);
|
||||||
if (query.estatus) params = params.set('estatus', query.estatus);
|
if (query.estatus) params = params.set('estatus', query.estatus);
|
||||||
|
if (query.orden && query.orden !== 'reciente') params = params.set('orden', query.orden);
|
||||||
|
if (query.horizonte !== undefined) params = params.set('horizonte', query.horizonte);
|
||||||
return this.http.get<unknown>('/cacu/seguimiento', { params }).pipe(map(seguimientoResponse));
|
return this.http.get<unknown>('/cacu/seguimiento', { params }).pipe(map(seguimientoResponse));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,10 @@ describe('Seguimiento CaCu con contrato de demostración', () => {
|
|||||||
afterEach(()=>{ fixture.destroy(); http.verify(); });
|
afterEach(()=>{ fixture.destroy(); http.verify(); });
|
||||||
function open() { fixture.componentRef.setInput('active',true); fixture.detectChanges(); return http.expectOne(r=>r.url==='/cacu/seguimiento'); }
|
function open() { fixture.componentRef.setInput('active',true); fixture.detectChanges(); return http.expectOne(r=>r.url==='/cacu/seguimiento'); }
|
||||||
function respond() { open().flush(fixtureData); http.expectOne('/cacu/indicadores/cacu_eu7/metadatos').flush({categorias:{NORMAL:{etiqueta:'Normal'}}}); fixture.detectChanges(); }
|
function respond() { open().flush(fixtureData); http.expectOne('/cacu/indicadores/cacu_eu7/metadatos').flush({categorias:{NORMAL:{etiqueta:'Normal'}}}); fixture.detectChanges(); }
|
||||||
it('prioridad deshabilitada con una sola opción y sin parámetros nuevos al consultar o paginar', () => {
|
it('sin selector de prioridad ni filtros de TEA, y sin parámetros nuevos al consultar o paginar', () => {
|
||||||
respond();
|
respond();
|
||||||
const select = fixture.nativeElement.querySelector('select[name="prioridad"]') as HTMLSelectElement;
|
expect(fixture.nativeElement.querySelector('select[name="prioridad"]')).toBeNull();
|
||||||
expect(select.disabled).toBe(true); expect(select.labels?.[0].textContent).toContain('Ordenar por prioridad');
|
expect(fixture.nativeElement.querySelector('select[name="mchat"]')).toBeNull();
|
||||||
expect(Array.from(select.options).map(o => o.text)).toEqual(['No disponible']);
|
|
||||||
const order = fixture.componentInstance.data!.items.map(i => i.id_seudonimo);
|
const order = fixture.componentInstance.data!.items.map(i => i.id_seudonimo);
|
||||||
expect(Array.from(fixture.nativeElement.querySelectorAll('tbody tr td:first-child')).map(e => (e as HTMLElement).textContent)).toEqual(order);
|
expect(Array.from(fixture.nativeElement.querySelectorAll('tbody tr td:first-child')).map(e => (e as HTMLElement).textContent)).toEqual(order);
|
||||||
fixture.componentInstance.apply();
|
fixture.componentInstance.apply();
|
||||||
@@ -37,12 +36,13 @@ describe('Seguimiento CaCu con contrato de demostración', () => {
|
|||||||
const root:HTMLElement=fixture.nativeElement;
|
const root:HTMLElement=fixture.nativeElement;
|
||||||
expect(root.textContent).not.toContain('Datos simulados — uso de demostración');
|
expect(root.textContent).not.toContain('Datos simulados — uso de demostración');
|
||||||
expect(root.textContent).not.toContain('Las reglas de selección son provisionales');
|
expect(root.textContent).not.toContain('Las reglas de selección son provisionales');
|
||||||
|
expect(root.querySelector('h2')?.textContent).toBe('Modelos de riesgo asociados a cáncer cervicouterino');
|
||||||
expect(root.textContent).toContain('Ventana consultada:');
|
expect(root.textContent).toContain('Ventana consultada:');
|
||||||
expect(root.textContent).toContain('INSATISFACTORIO'); expect(root.textContent).toContain('Normal'); expect(root.textContent).toContain('No detectado');
|
expect(root.textContent).toContain('INSATISFACTORIO'); expect(root.textContent).toContain('Normal'); expect(root.textContent).toContain('No detectado');
|
||||||
expect(root.textContent).toContain('Insatisfactoria');
|
expect(root.textContent).toContain('Insatisfactoria');
|
||||||
expect(fixture.componentInstance.cytologyLabel({ bethesda: null, calidad: 'SATISFACTORIO' })).toBe('Sin resultado al corte');
|
expect(fixture.componentInstance.cytologyLabel({ bethesda: null, calidad: 'SATISFACTORIO' })).toBe('Sin resultado al corte');
|
||||||
expect(fixture.componentInstance.cytologyLabel({ bethesda: null, calidad: null })).toBe('Sin resultado al corte');
|
expect(fixture.componentInstance.cytologyLabel({ bethesda: null, calidad: null })).toBe('Sin resultado al corte');
|
||||||
expect(root.querySelectorAll('tbody tr')).toHaveLength(10); expect(root.querySelectorAll('thead th')).toHaveLength(8);
|
expect(root.querySelectorAll('tbody tr')).toHaveLength(10); expect(root.querySelectorAll('thead th')).toHaveLength(9);
|
||||||
expect(root.querySelector('form input[name="corte"]')).not.toBeNull();
|
expect(root.querySelector('form input[name="corte"]')).not.toBeNull();
|
||||||
expect(root.querySelector('form select[name="meses"]')).not.toBeNull();
|
expect(root.querySelector('form select[name="meses"]')).not.toBeNull();
|
||||||
expect(root.querySelector('nav[aria-label="Paginación de seguimiento"]')).not.toBeNull();
|
expect(root.querySelector('nav[aria-label="Paginación de seguimiento"]')).not.toBeNull();
|
||||||
@@ -92,16 +92,55 @@ describe('Seguimiento CaCu con contrato de demostración', () => {
|
|||||||
expect(()=>seguimientoResponse({...fixtureData,items:[{...fixtureData.items[2],ultima_citologia:{...fixtureData.items[2].ultima_citologia,calidad:42}}]})).toThrow();
|
expect(()=>seguimientoResponse({...fixtureData,items:[{...fixtureData.items[2],ultima_citologia:{...fixtureData.items[2].ultima_citologia,calidad:42}}]})).toThrow();
|
||||||
open().flush({...fixtureData,simulado:false}); fixture.detectChanges(); expect(fixture.nativeElement.querySelector('tbody')).toBeNull();
|
open().flush({...fixtureData,simulado:false}); fixture.detectChanges(); expect(fixture.nativeElement.querySelector('tbody')).toBeNull();
|
||||||
});
|
});
|
||||||
it.each(['tea','cama'])('%s conserva su estado pendiente sin consultas de pacientes', dominio => {
|
|
||||||
fixture.componentRef.setInput('dominio',dominio); fixture.componentRef.setInput('active',true); fixture.detectChanges(); http.expectNone(()=>true);
|
|
||||||
expect(fixture.nativeElement.textContent).toContain('El seguimiento aún no está disponible');
|
|
||||||
expect(fixture.nativeElement.textContent).not.toContain('Columnas propuestas para revisión.');
|
|
||||||
expect(fixture.nativeElement.querySelector('table')).not.toBeNull();
|
|
||||||
expect(fixture.nativeElement.querySelector('caption')).toBeNull();
|
|
||||||
});
|
|
||||||
it('valida parámetros antes del transporte sin confundir fechas del filtro general', () => {
|
it('valida parámetros antes del transporte sin confundir fechas del filtro general', () => {
|
||||||
const service=TestBed.inject(CacuSeguimientoService);
|
const service=TestBed.inject(CacuSeguimientoService);
|
||||||
for(const q of [{corte:'2026-02-30'},{page:0},{page_size:201},{meses:2}]) expect(()=>service.consultar({meses:3,page:1,page_size:50,...q} as never)).toThrow();
|
for(const q of [{corte:'2026-02-30'},{page:0},{page_size:201},{meses:2}]) expect(()=>service.consultar({meses:3,page:1,page_size:50,...q} as never)).toThrow();
|
||||||
http.expectNone(()=>true);
|
http.expectNone(()=>true);
|
||||||
});
|
});
|
||||||
|
// Fails if the list stops showing each patient's biopsy and probabilities at the horizon chosen, or the order and the
|
||||||
|
// horizon stop reaching the API (the list is paginated, so ordering happens there).
|
||||||
|
it('con Pre colposcopia muestra la biopsia y las probabilidades de LIEAG+ y cáncer al horizonte elegido, y pide el orden al servidor', () => {
|
||||||
|
const items = fixtureData.items.map((item: any, i: number) => i === 0 ? {
|
||||||
|
...item, ultima_biopsia: { fecha: '2025-10-01', grado: 'LIEAG' },
|
||||||
|
probabilidades: { lieag: [{ horizonte_anios: 1, probabilidad: 0.08, ic_bajo: 0.05, ic_alto: 0.12 },
|
||||||
|
{ horizonte_anios: 5, probabilidad: 0.34, ic_bajo: 0.26, ic_alto: 0.44 }],
|
||||||
|
cancer: [{ horizonte_anios: 5, probabilidad: 0.015, ic_bajo: null, ic_alto: null }] },
|
||||||
|
} : item);
|
||||||
|
const data = { ...fixtureData, items, horizontes_disponibles: [1, 5], filtros: { ...fixtureData.filtros, estatus: 'PRE_COLPOSCOPIA', orden: 'reciente', horizonte: 5 } };
|
||||||
|
open().flush(data); http.expectOne('/cacu/indicadores/cacu_eu7/metadatos').flush({ categorias: {} }); fixture.detectChanges();
|
||||||
|
const root: HTMLElement = fixture.nativeElement;
|
||||||
|
const fila = root.querySelector('tbody tr')!;
|
||||||
|
expect(fila.textContent).toContain('LIEAG'); expect(fila.textContent).toContain('34 % (26 – 44 %)'); expect(fila.textContent).toContain('1.5 %');
|
||||||
|
expect(root.querySelector('thead')!.textContent).toContain('Probabilidad a LIEAG+ a 5 años (%)');
|
||||||
|
expect([...root.querySelectorAll('select[name="horizonte"] option')].map(o => o.textContent!.trim())).toEqual(['1 año', '5 años']);
|
||||||
|
|
||||||
|
fixture.componentInstance.draft.orden = 'lieag'; fixture.componentInstance.draft.horizonte = 1;
|
||||||
|
fixture.componentInstance.apply();
|
||||||
|
const req = http.expectOne(r => r.url === '/cacu/seguimiento');
|
||||||
|
expect(req.request.params.get('orden')).toBe('lieag'); expect(req.request.params.get('horizonte')).toBe('1');
|
||||||
|
req.flush({ ...data, filtros: { ...data.filtros, orden: 'lieag', horizonte: 1 } }); fixture.detectChanges();
|
||||||
|
expect(root.querySelector('tbody tr')!.textContent).toContain('8 % (5 – 12 %)');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the columns stop following the status filtered: each scenario has its own models.
|
||||||
|
it('las columnas de probabilidad siguen al estatus: un caso muestra supervivencia y todas las pacientes, ninguna', () => {
|
||||||
|
const items = fixtureData.items.map((item: any, i: number) => i === 0 ? {
|
||||||
|
...item, estatus: { codigo: 'CASO', etiqueta: 'Caso (cáncer)' },
|
||||||
|
probabilidades: { supervivencia: [{ horizonte_anios: 5, probabilidad: 0.7, ic_bajo: 0.55, ic_alto: 0.8 }] } } : item);
|
||||||
|
const caso = { ...fixtureData, items, horizontes_disponibles: [5], filtros: { ...fixtureData.filtros, estatus: 'CASO', orden: 'reciente', horizonte: 5 } };
|
||||||
|
open().flush(caso); http.expectOne('/cacu/indicadores/cacu_eu7/metadatos').flush({ categorias: {} }); fixture.detectChanges();
|
||||||
|
const root: HTMLElement = fixture.nativeElement, encabezados = () => [...root.querySelectorAll('thead th')].map(t => t.textContent!.trim());
|
||||||
|
expect(encabezados()).toContain('Probabilidad de supervivencia a 5 años (%)');
|
||||||
|
expect(encabezados().some(t => t.includes('LIEAG+'))).toBe(false);
|
||||||
|
expect(root.querySelector('tbody tr')!.textContent).toContain('70 % (55 – 80 %)');
|
||||||
|
expect(fixture.componentInstance.ordenes().map(o => o.codigo)).toEqual(['reciente', 'supervivencia']);
|
||||||
|
|
||||||
|
fixture.componentInstance.draft.estatus = undefined; fixture.componentInstance.draft.orden = 'supervivencia';
|
||||||
|
fixture.componentInstance.apply();
|
||||||
|
const req = http.expectOne(r => r.url === '/cacu/seguimiento');
|
||||||
|
expect(req.request.params.has('orden')).toBe(false);
|
||||||
|
req.flush({ ...caso, filtros: { ...caso.filtros, estatus: null } }); fixture.detectChanges();
|
||||||
|
expect(encabezados().some(t => t.startsWith('Probabilidad'))).toBe(false);
|
||||||
|
expect(root.querySelector('select[name="orden"]')).toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Display only codes confirmed by the cohort and CaMa catalog; preserve unknown values as received.
|
||||||
|
const EDADES: Readonly<Record<string, string>> = {
|
||||||
|
MENOR_40: 'Menores de 40 años', '<40': 'Menores de 40 años', '40-49': '40 a 49 años', '50-59': '50 a 59 años', '60-69': '60 a 69 años', '70+': '70 años o más', SIN_DATO: 'Sin dato',
|
||||||
|
};
|
||||||
|
const BIRADS = /^BIRADS_(4[ABC]?|5|6)$/;
|
||||||
|
const HISTOLOGIA: Readonly<Record<string, string>> = {
|
||||||
|
BENIGNO: 'Benigno', CARCINOMA_IN_SITU: 'Carcinoma in situ',
|
||||||
|
CARCINOMA_INVASOR: 'Carcinoma invasor', DESCONOCIDO: 'Desconocido',
|
||||||
|
};
|
||||||
|
const ESCENARIOS: Readonly<Record<string, string>> = { POST_TRATAMIENTO: 'Post-tratamiento', EN_OBSERVACION: 'En observación' };
|
||||||
|
|
||||||
|
/** «BIRADS_4A» as it is written in the clinic: «BI-RADS 4A». Any other text is returned as it came. */
|
||||||
|
export const etiquetaBirads = (codigo: string) => BIRADS.test(codigo) ? 'BI-RADS ' + codigo.slice(7) : codigo;
|
||||||
|
/** «50-59» as «50 a 59 años». Any other text is returned as it came. */
|
||||||
|
export const etiquetaEdad = (codigo: string) => EDADES[codigo] ?? codigo;
|
||||||
|
export const etiquetaHistologia = (codigo: string) => HISTOLOGIA[codigo] ?? codigo;
|
||||||
|
/** The patient's clinical scenario at the cut-off: «Post-tratamiento» or «En observación». */
|
||||||
|
export const etiquetaEscenario = (codigo: string) => ESCENARIOS[codigo] ?? codigo;
|
||||||
|
|
||||||
|
const POR_CLAVE: Readonly<Record<string, (codigo: string) => string>> = {
|
||||||
|
birads: etiquetaBirads, grupo_edad: etiquetaEdad, biopsia: etiquetaHistologia, escenario_clinico: etiquetaEscenario,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** The label of a value of a filter of the cohort's list, or the value itself when its meaning is not confirmed. */
|
||||||
|
export const etiquetaDeFiltro = (clave: string, codigo: string) => (POR_CLAVE[clave] ?? ((c: string) => c))(codigo);
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// A cell that starts with one of these is read as a formula by spreadsheet programs once the text is pasted or converted.
|
||||||
|
const FORMULA_START = /^[=+\-@\t\r]/;
|
||||||
|
|
||||||
|
/** Text that is safe to write into a spreadsheet cell: a leading formula character is neutralised with an apostrophe. */
|
||||||
|
export function neutralizeFormula(text: string): string {
|
||||||
|
return FORMULA_START.test(text) ? `'${text}` : text;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
const pad = (n: number) => String(n).padStart(2, '0');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of a downloaded file. It carries the report kind, the cut-off date and the moment it was made, and never a
|
||||||
|
* patient identifier, because file names end up in download lists, backups and mail attachments.
|
||||||
|
*/
|
||||||
|
export function exportFilename(kind: 'seguimiento-cancer-de-mama' | 'seguimiento-cancer-de-mama-seleccion' | 'ficha-cancer-de-mama', corte: string, extension: 'xlsx' | 'pdf', now = new Date()): string {
|
||||||
|
const stamp = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}`;
|
||||||
|
return `${kind}_corte-${corte.replace(/[^0-9-]/g, '')}_${stamp}.${extension}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Hands a generated file to the browser's download. */
|
||||||
|
export function downloadBlob(blob: Blob, filename: string): void {
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = url;
|
||||||
|
link.download = filename;
|
||||||
|
link.rel = 'noopener';
|
||||||
|
document.body.append(link);
|
||||||
|
link.click();
|
||||||
|
link.remove();
|
||||||
|
setTimeout(() => URL.revokeObjectURL(url), 0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
// Covers that nothing a user can read in the exports (PDF of the list, spreadsheet, PDF of one record) or in the
|
||||||
|
// individual record alludes to tests, simulation or a development environment, and that none carries a note line. Fixture: fixtures/cama_seguimiento.json.
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
|
import { strFromU8, unzipSync } from 'fflate';
|
||||||
|
import fixtureData from '../fixtures/cama_seguimiento.json';
|
||||||
|
import { seguimientoTablaResponse } from '../seguimiento-tabla.service';
|
||||||
|
import { CamaPatientCard } from '../paciente-detalle/cama/cama-patient-card';
|
||||||
|
import { camaPatientDocument } from '../paciente-detalle/cama/cama-patient-pdf';
|
||||||
|
import { toCamaPatientSummary } from '../paciente-detalle/cama/cama-patient.models';
|
||||||
|
import { exportFilename } from './download-file';
|
||||||
|
import { TrackingExportBar } from './tracking-export-bar';
|
||||||
|
import { trackingDocument } from './tracking-pdf';
|
||||||
|
import { buildTrackingXlsx } from './tracking-xlsx';
|
||||||
|
import { TrackingSnapshot } from './tracking-export.models';
|
||||||
|
|
||||||
|
const NOTE_TEXT = 'Documento de consulta; verificar información con el expediente fuente';
|
||||||
|
const FORBIDDEN = /simulad|sint[eé]tic|entorno|\bdev\b|prueba|demostraci|ficticio|ejemplo|valor cl[ií]nico|test/i;
|
||||||
|
const r = seguimientoTablaResponse(structuredClone(fixtureData));
|
||||||
|
const snapshot: TrackingSnapshot = { corte: r.corte, ventana: r.ventana, filtros: r.filtros, filtros_disponibles: r.filtros_disponibles, columnas: r.columnas, items: r.items };
|
||||||
|
const NOW = new Date(Date.UTC(2026, 10, 12, 21, 30));
|
||||||
|
function texts(node: unknown, out: string[] = []): string[] {
|
||||||
|
if (typeof node === 'string') out.push(node);
|
||||||
|
else if (Array.isArray(node)) node.forEach(n => texts(n, out));
|
||||||
|
else if (node && typeof node === 'object') Object.values(node).forEach(n => texts(n, out));
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
// Every text a PDF definition can print: header, footer, content and document properties.
|
||||||
|
const pdfTexts = (d: Record<string, any>) => [...texts(d['header']()), ...texts(d['footer'](1, 2)), ...texts(d['content']), ...texts(d['info'])];
|
||||||
|
|
||||||
|
describe('Documentos y ficha: sin leyendas alusivas a pruebas', () => {
|
||||||
|
// Fails if any text of the list PDF (frame, parameters, table, notes, properties) mentions tests or simulation.
|
||||||
|
it('the list PDF has no such wording and no note', () => {
|
||||||
|
const all = pdfTexts(trackingDocument(snapshot, NOW, 'data:image/png;base64,AAAA') as Record<string, any>);
|
||||||
|
expect(all.filter(t => FORBIDDEN.test(t))).toEqual([]);
|
||||||
|
expect(all).not.toContain(NOTE_TEXT);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if any cell, sheet name or parameter of the spreadsheet mentions tests or simulation.
|
||||||
|
it('the spreadsheet has no such wording and no note', async () => {
|
||||||
|
const files = unzipSync(new Uint8Array(await (await buildTrackingXlsx(snapshot, NOW)).arrayBuffer()));
|
||||||
|
const strings = strFromU8(files['xl/sharedStrings.xml']), workbook = strFromU8(files['xl/workbook.xml']);
|
||||||
|
expect(FORBIDDEN.test(strings.replace(/<[^>]+>/g, ' '))).toBe(false);
|
||||||
|
expect(FORBIDDEN.test(workbook.replace(/xmlns[^ >]*/g, ''))).toBe(false);
|
||||||
|
expect(strings).not.toContain(NOTE_TEXT);
|
||||||
|
expect(strings).not.toContain('Tipo de datos');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the record's PDF mentions tests, simulation or the synthetic nature of the identifier.
|
||||||
|
it('the record PDF has no such wording and no note', () => {
|
||||||
|
const summary = toCamaPatientSummary(snapshot.items[0], snapshot.corte)!;
|
||||||
|
const all = pdfTexts(camaPatientDocument(summary, NOW, 'data:image/png;base64,AAAA') as Record<string, any>);
|
||||||
|
expect(all.filter(t => FORBIDDEN.test(t))).toEqual([]);
|
||||||
|
expect(all).not.toContain(NOTE_TEXT);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the record on screen or the export buttons mention tests or simulation.
|
||||||
|
it('the record and the export buttons show no such wording', () => {
|
||||||
|
TestBed.configureTestingModule({ providers: [provideHttpClient()] });
|
||||||
|
const card = TestBed.createComponent(CamaPatientCard);
|
||||||
|
card.componentRef.setInput('summary', toCamaPatientSummary(snapshot.items[0], snapshot.corte)!);
|
||||||
|
card.detectChanges();
|
||||||
|
expect(FORBIDDEN.test(card.nativeElement.textContent)).toBe(false);
|
||||||
|
expect(card.nativeElement.textContent).not.toContain(NOTE_TEXT);
|
||||||
|
const bar = TestBed.createComponent(TrackingExportBar);
|
||||||
|
bar.componentRef.setInput('dominio', 'cama'); bar.componentRef.setInput('respuesta', r);
|
||||||
|
bar.detectChanges();
|
||||||
|
expect(FORBIDDEN.test(bar.nativeElement.textContent)).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Documentos y ficha: nombre funcional del dominio', () => {
|
||||||
|
// Fails if "CaMa" (an internal name) or a wrong title reaches the titles, properties or text of a document.
|
||||||
|
it('both PDFs use the functional name, with accents, and never "CaMa"', () => {
|
||||||
|
const list = pdfTexts(trackingDocument(snapshot, NOW, 'data:image/png;base64,AAAA') as Record<string, any>);
|
||||||
|
const record = pdfTexts(camaPatientDocument(toCamaPatientSummary(snapshot.items[0], snapshot.corte)!, NOW, 'data:image/png;base64,AAAA') as Record<string, any>);
|
||||||
|
expect(list).toContain('Cáncer de mama');
|
||||||
|
expect(record).toContain('Ficha de paciente — Cáncer de mama');
|
||||||
|
expect(list.filter(t => /cama/i.test(t))).toEqual([]);
|
||||||
|
expect(record.filter(t => /cama/i.test(t))).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the spreadsheet names the report or its sheets with the internal name.
|
||||||
|
it('the spreadsheet names the report "Cáncer de mama" and never "CaMa"', async () => {
|
||||||
|
const files = unzipSync(new Uint8Array(await (await buildTrackingXlsx(snapshot, NOW)).arrayBuffer()));
|
||||||
|
const strings = strFromU8(files['xl/sharedStrings.xml']).replace(/<[^>]+>/g, '|');
|
||||||
|
expect(strings).toContain('|Cáncer de mama|');
|
||||||
|
expect(/cama/i.test(strings + strFromU8(files['xl/workbook.xml']).replace(/xmlns[^ >]*/g, ''))).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if a downloaded file name exposes the internal name or a patient.
|
||||||
|
it('file names use the functional name', () => {
|
||||||
|
expect(exportFilename('seguimiento-cancer-de-mama', snapshot.corte, 'xlsx', NOW)).not.toMatch(/cama|M-\d/i);
|
||||||
|
expect(exportFilename('ficha-cancer-de-mama', snapshot.corte, 'pdf', NOW)).not.toMatch(/cama|M-\d/i);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
export type PdfDefinition = Record<string, unknown>;
|
||||||
|
|
||||||
|
let fontsReady = false;
|
||||||
|
|
||||||
|
/** Renders a pdfmake document definition. pdfmake and its Roboto fonts download only when the first PDF is made. */
|
||||||
|
export async function renderPdf(definition: PdfDefinition): Promise<Blob> {
|
||||||
|
const [{ default: pdfMake }, { default: roboto }] = await Promise.all([
|
||||||
|
import('pdfmake/build/pdfmake'),
|
||||||
|
import('pdfmake/build/fonts/Roboto'),
|
||||||
|
]);
|
||||||
|
if (!fontsReady) {
|
||||||
|
pdfMake.addFontContainer(roboto);
|
||||||
|
// A document only carries inline data; it must never make pdfmake fetch an address.
|
||||||
|
pdfMake.setUrlAccessPolicy(() => false);
|
||||||
|
fontsReady = true;
|
||||||
|
}
|
||||||
|
return pdfMake.createPdf(definition).getBlob();
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
import { PdfDefinition } from './pdf-engine';
|
||||||
|
|
||||||
|
export const PDF_CONFIDENTIAL = 'Confidencial · uso interno';
|
||||||
|
export const LOGO_URL = 'assets/branding/isssteleon-logo.png';
|
||||||
|
// The logo is 1125 x 358 pixels.
|
||||||
|
const LOGO_WIDTH = 110;
|
||||||
|
|
||||||
|
export const COLORS = { ink: '#081839', accent: '#a8c243', muted: '#7a7a7a', rule: '#e3e7df', band: '#f0f3e8' } as const;
|
||||||
|
|
||||||
|
export interface PdfTemplateOptions {
|
||||||
|
/** Title in the page header and in the document properties. */
|
||||||
|
title: string;
|
||||||
|
/** Data URL of the institutional logo; without it the header shows the name as text. */
|
||||||
|
logo?: string;
|
||||||
|
now: Date;
|
||||||
|
/** Page size: reports are landscape letter, individual records portrait. */
|
||||||
|
orientation: 'landscape' | 'portrait';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The logo as a data URL, or `undefined` when it cannot be read (the header then falls back to text). */
|
||||||
|
export async function loadLogo(url = LOGO_URL): Promise<string | undefined> {
|
||||||
|
try {
|
||||||
|
const response = await fetch(url);
|
||||||
|
if (!response.ok) return undefined;
|
||||||
|
const blob = await response.blob();
|
||||||
|
return await new Promise<string>((resolve, reject) => {
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = () => resolve(String(reader.result));
|
||||||
|
reader.onerror = () => reject(reader.error);
|
||||||
|
reader.readAsDataURL(blob);
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatGenerated(now: Date): string {
|
||||||
|
return new Intl.DateTimeFormat('es-MX', { dateStyle: 'medium', timeStyle: 'short', timeZone: 'America/Mexico_City' }).format(now);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The institutional frame shared by every PDF: header with the logo, and the title on every
|
||||||
|
* page, footer with the generation time, the confidentiality line and "Página X de Y", and generic document properties
|
||||||
|
* (no author, no user). `content` is what goes between them.
|
||||||
|
*/
|
||||||
|
export function institutionalDocument(options: PdfTemplateOptions, content: unknown[]): PdfDefinition {
|
||||||
|
const margin = 36;
|
||||||
|
// Letter is 792 x 612 points; the header rule spans the page between its margins.
|
||||||
|
const usableWidth = (options.orientation === 'landscape' ? 792 : 612) - 2 * margin;
|
||||||
|
return {
|
||||||
|
pageSize: 'LETTER',
|
||||||
|
pageOrientation: options.orientation,
|
||||||
|
pageMargins: [margin, 84, margin, 52],
|
||||||
|
// Named, so the logo is embedded once and not again on every page.
|
||||||
|
images: options.logo ? { logo: options.logo } : {},
|
||||||
|
info: { title: options.title, author: 'ISSSTELEON', creator: 'ISSSTELEON', producer: 'ISSSTELEON' },
|
||||||
|
defaultStyle: { font: 'Roboto', fontSize: 9, color: COLORS.ink },
|
||||||
|
styles: {
|
||||||
|
h1: { fontSize: 15, bold: true, margin: [0, 0, 0, 6] },
|
||||||
|
h2: { fontSize: 11, bold: true, margin: [0, 10, 0, 4] },
|
||||||
|
muted: { color: COLORS.muted },
|
||||||
|
th: { bold: true, fillColor: COLORS.accent, color: COLORS.ink },
|
||||||
|
small: { fontSize: 8, color: COLORS.muted },
|
||||||
|
},
|
||||||
|
header: () => ({
|
||||||
|
margin: [margin, 20, margin, 0],
|
||||||
|
stack: [
|
||||||
|
{
|
||||||
|
columns: [
|
||||||
|
options.logo ? { image: 'logo', width: LOGO_WIDTH } : { text: 'ISSSTELEON', bold: true, fontSize: 14 },
|
||||||
|
{ text: options.title, alignment: 'center', width: '*', bold: true, fontSize: 12, margin: [0, 8, 0, 0] },
|
||||||
|
{ text: '', width: LOGO_WIDTH },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ canvas: [{ type: 'line', x1: 0, y1: 8, x2: usableWidth, y2: 8, lineWidth: 1, lineColor: COLORS.accent }] },
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
footer: (currentPage: number, pageCount: number) => ({
|
||||||
|
margin: [margin, 14, margin, 0],
|
||||||
|
columns: [
|
||||||
|
{ text: `Generado: ${formatGenerated(options.now)} (hora de la Ciudad de México)`, style: 'small' },
|
||||||
|
{ text: PDF_CONFIDENTIAL, style: 'small', alignment: 'center' },
|
||||||
|
{ text: `Página ${currentPage} de ${pageCount}`, style: 'small', alignment: 'right' },
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
content,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// pdfmake ships no type declarations; only the calls the export layer makes are declared.
|
||||||
|
declare module 'pdfmake/build/pdfmake' {
|
||||||
|
interface PdfDocumentHandle { getBlob(): Promise<Blob>; getBuffer(): Promise<Uint8Array>; }
|
||||||
|
const pdfMake: { createPdf(definition: unknown): PdfDocumentHandle; addFontContainer(container: unknown): void; setUrlAccessPolicy(policy: (url: string) => boolean): void };
|
||||||
|
export default pdfMake;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'pdfmake/build/fonts/Roboto' {
|
||||||
|
const fontContainer: unknown;
|
||||||
|
export default fontContainer;
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
// Covers the export buttons of the follow-up table: when they are enabled, what they ask the service for, the file
|
||||||
|
// they hand to the browser, cancelling and the messages of each failure. Fixture: fixtures/cama_seguimiento.json.
|
||||||
|
// The service is a stub that pages the fixture; the download is observed through the anchor the browser would click.
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { Observable, of, Subject } from 'rxjs';
|
||||||
|
import fixtureData from '../fixtures/cama_seguimiento.json';
|
||||||
|
import { SeguimientoTablaQuery, SeguimientoTablaResponse, SeguimientoTablaService, seguimientoTablaResponse } from '../seguimiento-tabla.service';
|
||||||
|
import { TrackingExportBar } from './tracking-export-bar';
|
||||||
|
|
||||||
|
const base = () => structuredClone(fixtureData) as unknown as Record<string, any>;
|
||||||
|
const respuesta = (extra: Record<string, any> = {}) => seguimientoTablaResponse({ ...base(), ...extra });
|
||||||
|
|
||||||
|
describe('Exportación: botones', () => {
|
||||||
|
let requests: SeguimientoTablaQuery[], downloads: { name: string; blob: Blob }[], answers: (q: SeguimientoTablaQuery) => Observable<SeguimientoTablaResponse>;
|
||||||
|
let fixture: ReturnType<typeof TestBed.createComponent<TrackingExportBar>>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
requests = []; downloads = [];
|
||||||
|
// Like the API, the stub reports the filters it was asked to apply.
|
||||||
|
answers = q => of(respuesta({ filtros: { ...base()['filtros'], ...q.filtros }, paginacion: { page: q.page, page_size: q.page_size, total_items: 27, total_pages: 1 } }));
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [{ provide: SeguimientoTablaService, useValue: { consultar: (_d: string, q: SeguimientoTablaQuery) => { requests.push(q); return answers(q); } } }],
|
||||||
|
});
|
||||||
|
let pending: Blob | undefined;
|
||||||
|
vi.spyOn(URL, 'createObjectURL').mockImplementation(blob => { pending = blob as Blob; return 'blob:test'; });
|
||||||
|
vi.spyOn(URL, 'revokeObjectURL').mockImplementation(() => undefined);
|
||||||
|
vi.spyOn(HTMLAnchorElement.prototype, 'click').mockImplementation(function (this: HTMLAnchorElement) { downloads.push({ name: this.download, blob: pending! }); });
|
||||||
|
});
|
||||||
|
afterEach(() => { fixture?.destroy(); vi.restoreAllMocks(); });
|
||||||
|
|
||||||
|
function montar(response = respuesta(), habilitado = true) {
|
||||||
|
fixture = TestBed.createComponent(TrackingExportBar);
|
||||||
|
fixture.componentRef.setInput('dominio', 'cama');
|
||||||
|
fixture.componentRef.setInput('respuesta', response);
|
||||||
|
fixture.componentRef.setInput('habilitado', habilitado);
|
||||||
|
fixture.detectChanges();
|
||||||
|
return fixture.nativeElement as HTMLElement;
|
||||||
|
}
|
||||||
|
const boton = (root: HTMLElement, texto: string) => [...root.querySelectorAll('button')].find(b => b.textContent!.includes(texto)) as HTMLButtonElement | undefined;
|
||||||
|
const esperar = async () => { for (let i = 0; i < 20; i++) { await fixture.whenStable(); await new Promise(r => setTimeout(r, 10)); fixture.detectChanges(); } };
|
||||||
|
|
||||||
|
// Fails if the buttons stop being a bare group (the title row of the table holds them) or bring back their own block.
|
||||||
|
it('has no block of its own: only the buttons, and messages after them', () => {
|
||||||
|
const root = montar();
|
||||||
|
expect(root.querySelector('h3, section')).toBeNull();
|
||||||
|
expect(root.firstElementChild!.classList.contains('actions')).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the button stops being available for a query that fits the limit.
|
||||||
|
it('enables the spreadsheet export for a query within the limit', () => {
|
||||||
|
expect(boton(montar(), 'Excel')!.disabled).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the export is allowed above the limit or the reason is not shown: the user would get a silent subset.
|
||||||
|
it('disables the export above the limit and says why', () => {
|
||||||
|
const root = montar(respuesta({ paginacion: { page: 1, page_size: 50, total_items: 5001, total_pages: 101 } }));
|
||||||
|
expect(boton(root, 'Excel')!.disabled).toBe(true);
|
||||||
|
expect(root.textContent).toContain('admite hasta 5,000 registros');
|
||||||
|
expect(root.textContent).toContain('Acota los filtros');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the PDF is allowed above its own, lower limit, or if hitting it also blocks the spreadsheet.
|
||||||
|
it('limits the PDF to 1,000 rows while the spreadsheet still accepts the query', () => {
|
||||||
|
const root = montar(respuesta({ paginacion: { page: 1, page_size: 50, total_items: 1001, total_pages: 21 } }));
|
||||||
|
expect(boton(root, 'PDF')!.disabled).toBe(true);
|
||||||
|
expect(boton(root, 'Excel')!.disabled).toBe(false);
|
||||||
|
expect(root.textContent).toContain('PDF admite hasta 1,000 registros');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if an empty result offers a file with no rows.
|
||||||
|
it('disables the export when there are no rows', () => {
|
||||||
|
expect(boton(montar(respuesta({ paginacion: { page: 1, page_size: 50, total_items: 0, total_pages: 0 }, items: [] })), 'Excel')!.disabled).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the export reads a query that is about to be replaced by the one being loaded.
|
||||||
|
it('disables the export while a page is loading', () => {
|
||||||
|
expect(boton(montar(respuesta(), false), 'Excel')!.disabled).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the file is built from the form instead of the shown answer, or the name carries a patient id.
|
||||||
|
it('exports the shown query in full and downloads a file named without any patient', async () => {
|
||||||
|
const root = montar(respuesta({ filtros: { ...base()['filtros'], estatus: 'BENIGNO' } }));
|
||||||
|
boton(root, 'Excel')!.click();
|
||||||
|
await esperar();
|
||||||
|
expect(requests[0]).toMatchObject({ corte: '2026-10-20', meses: 3, page: 1, page_size: 200, filtros: { estatus: 'BENIGNO' } });
|
||||||
|
expect(downloads).toHaveLength(1);
|
||||||
|
expect(downloads[0].name).toMatch(/^seguimiento-cancer-de-mama_corte-2026-10-20_\d{8}-\d{4}\.xlsx$/);
|
||||||
|
expect(downloads[0].name).not.toMatch(/M-\d/);
|
||||||
|
expect(downloads[0].blob.size).toBeGreaterThan(1000);
|
||||||
|
expect(root.textContent).toContain('Se generó el archivo con 27 registros');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the success message of one query stays on screen after another query is shown.
|
||||||
|
it('drops the result message when another query is shown, but keeps it while paging', async () => {
|
||||||
|
const root = montar();
|
||||||
|
boton(root, 'Excel')!.click();
|
||||||
|
await esperar();
|
||||||
|
expect(root.textContent).toContain('Se generó el archivo');
|
||||||
|
// Another page of the same query: the message stays.
|
||||||
|
fixture.componentRef.setInput('respuesta', respuesta({ items: [], paginacion: { page: 2, page_size: 10, total_items: 27, total_pages: 3 } }));
|
||||||
|
fixture.detectChanges(); await fixture.whenStable(); fixture.detectChanges();
|
||||||
|
expect(root.textContent).toContain('Se generó el archivo');
|
||||||
|
// Another filter: the message goes.
|
||||||
|
fixture.componentRef.setInput('respuesta', respuesta({ filtros: { ...base()['filtros'], prioridad: 'ALTA' }, paginacion: { page: 1, page_size: 50, total_items: 9, total_pages: 1 } }));
|
||||||
|
fixture.detectChanges(); await fixture.whenStable(); fixture.detectChanges();
|
||||||
|
expect(root.textContent).not.toContain('Se generó el archivo');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if cancelling leaves the export running or still downloads a file afterwards.
|
||||||
|
it('stops and downloads nothing when cancelled', async () => {
|
||||||
|
const never = new Subject<SeguimientoTablaResponse>();
|
||||||
|
answers = () => never;
|
||||||
|
const root = montar();
|
||||||
|
boton(root, 'Excel')!.click();
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(root.textContent).toContain('Preparando exportación');
|
||||||
|
boton(root, 'Cancelar')!.click();
|
||||||
|
fixture.detectChanges();
|
||||||
|
never.next(respuesta());
|
||||||
|
await esperar();
|
||||||
|
expect(downloads).toEqual([]);
|
||||||
|
expect(boton(root, 'Cancelar')).toBeUndefined();
|
||||||
|
expect(boton(root, 'Excel')!.disabled).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if a failed read is shown as success or leaves the buttons locked.
|
||||||
|
it('shows an error and unlocks the buttons when the service fails', async () => {
|
||||||
|
answers = () => { throw new Error('boom'); };
|
||||||
|
const root = montar();
|
||||||
|
boton(root, 'Excel')!.click();
|
||||||
|
await esperar();
|
||||||
|
expect(root.querySelector('[role="alert"]')!.textContent).toContain('No se pudo generar el archivo');
|
||||||
|
expect(downloads).toEqual([]);
|
||||||
|
expect(boton(root, 'Excel')!.disabled).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
import { Component, computed, DestroyRef, effect, inject, input, signal, untracked } from '@angular/core';
|
||||||
|
import { DecimalPipe } from '@angular/common';
|
||||||
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
import { Dominio } from '../indicadores.models';
|
||||||
|
import { SeguimientoTablaResponse, SeguimientoTablaService } from '../seguimiento-tabla.service';
|
||||||
|
import { downloadBlob, exportFilename } from './download-file';
|
||||||
|
import { EXPORT_LIMITS, ExportFormat, ExportInconsistent, ExportLimitExceeded, TrackingSnapshot } from './tracking-export.models';
|
||||||
|
import { fetchAllTracking, queryOf } from './tracking-export-source';
|
||||||
|
|
||||||
|
type State = 'idle' | 'working' | 'error';
|
||||||
|
|
||||||
|
const FORMAT_LABEL: Record<ExportFormat, string> = { xlsx: 'Excel (.xlsx)', pdf: 'PDF' };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export buttons of a follow-up list. They export the answer on screen (its cut-off, window and filters) and every
|
||||||
|
* row it matches, not the visible page; a query above a format's limit is refused with a message, never truncated.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'app-seguimiento-exportar',
|
||||||
|
imports: [DecimalPipe],
|
||||||
|
template: `
|
||||||
|
<div class="actions" role="group" aria-label="Exportar resultados"
|
||||||
|
[attr.title]="'Se exportan los ' + (total() | number) + ' registros de la consulta mostrada, no solo la página visible.'">
|
||||||
|
@for (formato of formatos; track formato) {
|
||||||
|
<button type="button" [disabled]="!available(formato)" (click)="exportar(formato)">Exportar {{ label[formato] }}</button>
|
||||||
|
}
|
||||||
|
@if (estado() === 'working') { <button type="button" (click)="cancelar()">Cancelar</button> }
|
||||||
|
</div>
|
||||||
|
@for (formato of formatos; track formato) {
|
||||||
|
@if (total() > limits[formato]) {
|
||||||
|
<p class="message hint">{{ label[formato] }} admite hasta {{ limits[formato] | number }} registros; la consulta tiene {{ total() | number }}. Acota los filtros para exportar.</p>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@if (estado() === 'working') { <p class="message" role="status">{{ progressText() }}</p> }
|
||||||
|
@if (estado() === 'error') { <p class="message" role="alert">{{ mensaje() }}</p> }
|
||||||
|
@if (listo()) { <p class="message" role="status">{{ listo() }}</p> }
|
||||||
|
`,
|
||||||
|
// The host takes no box of its own: the buttons sit in the title row that holds it, and each message
|
||||||
|
// takes a full line below that row.
|
||||||
|
styles: `
|
||||||
|
:host { display: contents; }
|
||||||
|
.message { flex: 0 0 100%; margin: 0; }
|
||||||
|
.hint { color: var(--issste-text-secondary); }
|
||||||
|
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .75rem; margin-inline-start: auto; }
|
||||||
|
button { color: inherit; background: var(--issste-surface); border: 1px solid var(--issste-border); border-radius: 4px;
|
||||||
|
padding: .6rem 1rem; min-height: 44px; box-sizing: border-box; font: inherit; cursor: pointer; }
|
||||||
|
button:disabled { opacity: .5; cursor: default; }
|
||||||
|
button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
|
||||||
|
`,
|
||||||
|
})
|
||||||
|
export class TrackingExportBar {
|
||||||
|
readonly dominio = input.required<Dominio>();
|
||||||
|
/** The answer on screen: its metadata says which query to export. */
|
||||||
|
readonly respuesta = input.required<SeguimientoTablaResponse>();
|
||||||
|
/** False while a page is being loaded, so the export never reads a query that is about to change. */
|
||||||
|
readonly habilitado = input(true);
|
||||||
|
/** How the analysis named the selection this answer belongs to; it travels into the files. */
|
||||||
|
readonly seleccion = input<string | undefined>(undefined);
|
||||||
|
|
||||||
|
private readonly service = inject(SeguimientoTablaService);
|
||||||
|
private subscription?: Subscription;
|
||||||
|
readonly formatos: readonly ExportFormat[] = ['xlsx', 'pdf'];
|
||||||
|
readonly label = FORMAT_LABEL;
|
||||||
|
readonly limits = EXPORT_LIMITS;
|
||||||
|
readonly estado = signal<State>('idle');
|
||||||
|
readonly mensaje = signal('');
|
||||||
|
readonly listo = signal('');
|
||||||
|
readonly progress = signal({ fetched: 0, total: 0 });
|
||||||
|
readonly total = computed(() => this.respuesta().paginacion.total_items);
|
||||||
|
readonly progressText = computed(() => {
|
||||||
|
const { fetched, total } = this.progress();
|
||||||
|
return total ? `Leyendo registros: ${fetched} de ${total}…` : 'Preparando exportación…';
|
||||||
|
});
|
||||||
|
|
||||||
|
// Identifies the query on screen: paging through its pages keeps it, changing a filter or the cut-off replaces it.
|
||||||
|
private readonly queryKey = computed(() => {
|
||||||
|
const r = this.respuesta();
|
||||||
|
return JSON.stringify([r.corte, r.ventana.meses, r.filtros, r.paginacion.total_items, this.seleccion() ?? null]);
|
||||||
|
});
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
inject(DestroyRef).onDestroy(() => this.subscription?.unsubscribe());
|
||||||
|
// A result message belongs to the query it was made for: it goes away when another query is shown. An export still
|
||||||
|
// being read belongs to a query that is no longer on screen: it is cancelled, never downloaded as the current one.
|
||||||
|
effect(() => {
|
||||||
|
this.queryKey();
|
||||||
|
untracked(() => {
|
||||||
|
if (this.estado() === 'working') {
|
||||||
|
this.subscription?.unsubscribe();
|
||||||
|
this.estado.set('error'); this.listo.set(''); this.mensaje.set('La consulta cambió; se canceló la exportación. Vuelve a exportar.');
|
||||||
|
} else { this.listo.set(''); this.mensaje.set(''); if (this.estado() === 'error') this.estado.set('idle'); }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
available(formato: ExportFormat): boolean {
|
||||||
|
return this.habilitado() && this.estado() !== 'working' && this.total() > 0 && this.total() <= EXPORT_LIMITS[formato];
|
||||||
|
}
|
||||||
|
|
||||||
|
exportar(formato: ExportFormat) {
|
||||||
|
if (!this.available(formato)) return;
|
||||||
|
this.estado.set('working'); this.mensaje.set(''); this.listo.set(''); this.progress.set({ fetched: 0, total: 0 });
|
||||||
|
this.subscription?.unsubscribe();
|
||||||
|
const clave = this.queryKey(), seleccion = this.seleccion();
|
||||||
|
this.subscription = fetchAllTracking(this.service, this.dominio(), queryOf(this.respuesta()), EXPORT_LIMITS[formato]).subscribe({
|
||||||
|
next: event => {
|
||||||
|
if (event.kind === 'progress') this.progress.set({ fetched: event.fetched, total: event.total });
|
||||||
|
else void this.generar(formato, seleccion ? { ...event.snapshot, seleccion } : event.snapshot, clave);
|
||||||
|
},
|
||||||
|
error: error => this.fallar(error),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelar() {
|
||||||
|
this.subscription?.unsubscribe();
|
||||||
|
this.estado.set('idle');
|
||||||
|
}
|
||||||
|
|
||||||
|
private async generar(formato: ExportFormat, snapshot: TrackingSnapshot, clave: string) {
|
||||||
|
try {
|
||||||
|
// Each generator (and its library) downloads only when its button is used.
|
||||||
|
const blob = formato === 'xlsx'
|
||||||
|
? await (await import('./tracking-xlsx')).buildTrackingXlsx(snapshot)
|
||||||
|
: await (await import('./tracking-pdf')).buildTrackingPdf(snapshot);
|
||||||
|
// The query on screen changed while the file was being made: it is not the one that was asked for.
|
||||||
|
if (clave !== this.queryKey()) return;
|
||||||
|
downloadBlob(blob, exportFilename(snapshot.seleccion ? 'seguimiento-cancer-de-mama-seleccion' : 'seguimiento-cancer-de-mama', snapshot.corte, formato));
|
||||||
|
this.estado.set('idle');
|
||||||
|
this.listo.set(`Se generó el archivo con ${snapshot.items.length} registros.`);
|
||||||
|
} catch {
|
||||||
|
this.fallar(new Error('generation'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fallar(error: unknown) {
|
||||||
|
this.estado.set('error');
|
||||||
|
const estatus = error instanceof HttpErrorResponse ? error.status : 0;
|
||||||
|
this.mensaje.set(error instanceof ExportLimitExceeded || estatus === 413 ? 'La consulta excede el límite de este formato. Acota los filtros.'
|
||||||
|
: estatus === 403 ? 'No hay acceso para exportar esta lista, o la selección tiene muy pocos pacientes para publicarse.'
|
||||||
|
: estatus === 409 ? 'La cohorte cambió mientras se leía. Vuelve al análisis, consúltalo de nuevo y exporta otra vez.'
|
||||||
|
: error instanceof ExportInconsistent ? 'La lista cambió mientras se leía. Vuelve a consultar e intenta de nuevo.'
|
||||||
|
: 'No se pudo generar el archivo. Intenta nuevamente.');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
// Covers the files of a list opened from the analysis: they state the selection, the cut-off and «Toda la cohorte», and
|
||||||
|
// hold exactly the patients the table holds, over several pages; and an export never outlives the query it was made for.
|
||||||
|
// Fixture: fixtures/cama_seguimiento.json, whose rows are repeated to make a list of several pages.
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { Observable, of, Subject } from 'rxjs';
|
||||||
|
import { strFromU8, unzipSync } from 'fflate';
|
||||||
|
import fixtureData from '../fixtures/cama_seguimiento.json';
|
||||||
|
import { SeguimientoTablaQuery, SeguimientoTablaResponse, SeguimientoTablaService, seguimientoTablaResponse } from '../seguimiento-tabla.service';
|
||||||
|
import { TrackingExportBar } from './tracking-export-bar';
|
||||||
|
import { CONTEXTO } from '../indicadores-analisis.testing';
|
||||||
|
import { fetchAllTracking, queryOf } from './tracking-export-source';
|
||||||
|
import { TrackingSnapshot } from './tracking-export.models';
|
||||||
|
import { trackingDocument } from './tracking-pdf';
|
||||||
|
import { buildTrackingXlsx } from './tracking-xlsx';
|
||||||
|
|
||||||
|
const ETIQUETA = 'Cáncer confirmado: Categoría BI-RADS, BI-RADS 5';
|
||||||
|
const base = () => structuredClone(fixtureData) as unknown as Record<string, any>;
|
||||||
|
// A cohort of `n` patients, M-0001 onwards, served in the pages that were asked for, with the filters it applied.
|
||||||
|
function cohorte(n: number) {
|
||||||
|
const plantilla = (base()['items'] as Record<string, unknown>[])[0];
|
||||||
|
const todos = Array.from({ length: n }, (_, i) => ({ ...plantilla, id_seudonimo: `M-${String(i + 1).padStart(4, '0')}` }));
|
||||||
|
return (q: SeguimientoTablaQuery): SeguimientoTablaResponse => seguimientoTablaResponse({
|
||||||
|
...base(), ventana: { meses: q.meses, desde: '2025-01-01', hasta: '2026-10-20' }, corte: q.corte ?? '2026-10-20',
|
||||||
|
filtros: { ...base()['filtros'], ...q.filtros }, ...(q.contexto ?? {}),
|
||||||
|
paginacion: { page: q.page, page_size: q.page_size, total_items: n, total_pages: Math.ceil(n / q.page_size) },
|
||||||
|
items: todos.slice((q.page - 1) * q.page_size, q.page * q.page_size),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const consulta = (extra: Partial<SeguimientoTablaQuery> = {}): SeguimientoTablaQuery =>
|
||||||
|
({ corte: '2026-10-20', meses: 0, page: 1, page_size: 50, filtros: { birads: 'BIRADS_5' }, contexto: CONTEXTO, ...extra });
|
||||||
|
const textos = (nodo: unknown, salida: string[] = []): string[] => {
|
||||||
|
if (typeof nodo === 'string') salida.push(nodo); else if (Array.isArray(nodo)) nodo.forEach(n => textos(n, salida)); else if (nodo && typeof nodo === 'object') Object.values(nodo).forEach(n => textos(n, salida));
|
||||||
|
return salida;
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('Archivos de una selección del análisis', () => {
|
||||||
|
const servicio = { consultar: (_d: string, q: SeguimientoTablaQuery) => of(cohorte(450)(q)) } as unknown as SeguimientoTablaService;
|
||||||
|
|
||||||
|
it('el PDF y el XLSX dicen la selección, el corte y «Toda la cohorte», y traen los mismos pacientes que la tabla en todas sus páginas', async () => {
|
||||||
|
// Fails if a file loses the selection, calls the whole cohort «0 meses», or its patients differ from the table's pages.
|
||||||
|
const q = consulta();
|
||||||
|
// The table, page by page (50 per page), as the user would walk it.
|
||||||
|
const filasTabla: string[] = [];
|
||||||
|
for (let p = 1; p <= 9; p++) filasTabla.push(...cohorte(450)({ ...q, page: p }).items.map(i => String(i['id_seudonimo'])));
|
||||||
|
let snapshot!: TrackingSnapshot;
|
||||||
|
await new Promise<void>((ok, fallo) => fetchAllTracking(servicio, 'cama', { ...q, page_size: 200 }, 1000).subscribe({
|
||||||
|
next: e => { if (e.kind === 'done') snapshot = { ...e.snapshot, seleccion: ETIQUETA }; }, error: fallo, complete: ok }));
|
||||||
|
expect(snapshot.items.map(i => String(i['id_seudonimo']))).toEqual(filasTabla);
|
||||||
|
expect(new Set(filasTabla).size).toBe(450);
|
||||||
|
|
||||||
|
const pdf = textos(trackingDocument(snapshot, new Date(Date.UTC(2026, 10, 13, 18, 0)), 'data:image/png;base64,AAAA'));
|
||||||
|
expect(pdf).toContain('Selección del análisis'); expect(pdf).toContain(ETIQUETA);
|
||||||
|
expect(pdf).toContain('Fecha de corte'); expect(pdf).toContain('2026-10-20');
|
||||||
|
expect(pdf).toContain('Toda la cohorte, al 2026-10-20');
|
||||||
|
expect(pdf.some(t => /0 meses/.test(t))).toBe(false);
|
||||||
|
expect(pdf.filter(t => /^M-\d{4}$/.test(t))).toEqual(filasTabla);
|
||||||
|
const PROHIBIDO = /simulad|sint[eé]tic|entorno|\bdev\b|prueba|demostraci|ficticio|mock|valor cl[ií]nico/i;
|
||||||
|
expect(pdf.filter(t => PROHIBIDO.test(t))).toEqual([]);
|
||||||
|
|
||||||
|
const hojas = unzipSync(new Uint8Array(await (await buildTrackingXlsx(snapshot, new Date(Date.UTC(2026, 10, 13, 18, 0)))).arrayBuffer()));
|
||||||
|
const cadenas = strFromU8(hojas['xl/sharedStrings.xml']);
|
||||||
|
expect(cadenas).toContain(ETIQUETA); expect(cadenas).toContain('Selección del análisis'); expect(cadenas).toContain('Toda la cohorte, al 2026-10-20');
|
||||||
|
expect(cadenas).not.toMatch(/0 meses/);
|
||||||
|
expect(cadenas.replace(/<[^>]+>/g, ' ')).not.toMatch(PROHIBIDO);
|
||||||
|
expect([...cadenas.matchAll(/M-\d{4}/g)].map(m => m[0]).filter((v, i, a) => a.indexOf(v) === i)).toEqual(filasTabla);
|
||||||
|
});
|
||||||
|
it('sin una selección los archivos no llevan esa línea y conservan la ventana de meses', async () => {
|
||||||
|
// Fails if a plain list gets a selection line, or a window of months stops being written as dates and months.
|
||||||
|
const q = consulta({ meses: 3, filtros: {} });
|
||||||
|
let snapshot!: TrackingSnapshot;
|
||||||
|
await new Promise<void>((ok, fallo) => fetchAllTracking(servicio, 'cama', { ...q, page_size: 200 }, 1000).subscribe({ next: e => { if (e.kind === 'done') snapshot = e.snapshot; }, error: fallo, complete: ok }));
|
||||||
|
const pdf = textos(trackingDocument(snapshot, new Date(), 'data:image/png;base64,AAAA'));
|
||||||
|
expect(pdf).not.toContain('Selección del análisis');
|
||||||
|
expect(pdf).toContain('2025-01-01 al 2026-10-20 (3 meses)');
|
||||||
|
});
|
||||||
|
it('la consulta de una respuesta conserva la cohorte y su revisión, y todas las páginas del archivo la citan', async () => {
|
||||||
|
// Fails if the export reads a cohort's list without quoting its revision (the server refuses it) or from another one.
|
||||||
|
const respuesta = cohorte(450)(consulta());
|
||||||
|
expect(queryOf(respuesta)).toMatchObject({ corte: '2026-10-20', meses: 0, page: 1, page_size: 200, filtros: { birads: 'BIRADS_5' }, contexto: CONTEXTO });
|
||||||
|
const pedidas: SeguimientoTablaQuery[] = [];
|
||||||
|
const espia = { consultar: (_d: string, q: SeguimientoTablaQuery) => { pedidas.push(q); return of(cohorte(450)(q)); } } as unknown as SeguimientoTablaService;
|
||||||
|
await new Promise<void>((ok, fallo) => fetchAllTracking(espia, 'cama', queryOf(respuesta), 1000).subscribe({ error: fallo, complete: ok }));
|
||||||
|
expect(pedidas.map(q => q.page).sort()).toEqual([1, 2, 3]);
|
||||||
|
expect(pedidas.every(q => q.contexto?.revision === CONTEXTO.revision && q.contexto?.cohorte === CONTEXTO.cohorte && q.meses === 0)).toBe(true);
|
||||||
|
// A plain list quotes no cohort.
|
||||||
|
expect(queryOf(seguimientoTablaResponse(base())).contexto).toBeUndefined();
|
||||||
|
});
|
||||||
|
it('una página posterior de otra revisión hace fallar la lectura', async () => {
|
||||||
|
// Fails if a file mixes pages of two revisions of the cohort.
|
||||||
|
const respuestas = (q: SeguimientoTablaQuery) => of(q.page === 2 ? cohorte(450)({ ...q, contexto: { ...CONTEXTO, revision: 'f'.repeat(64) } }) : cohorte(450)(q));
|
||||||
|
const malo = { consultar: (_d: string, q: SeguimientoTablaQuery) => respuestas(q) } as unknown as SeguimientoTablaService;
|
||||||
|
const error = await new Promise<unknown>(ok => fetchAllTracking(malo, 'cama', { ...consulta(), page_size: 200 }, 1000).subscribe({ error: ok, complete: () => ok(undefined) }));
|
||||||
|
expect(error).toBeInstanceOf(Error);
|
||||||
|
});
|
||||||
|
it('una página posterior que pierde un filtro hace fallar la lectura: no se exporta un subconjunto de otra consulta', async () => {
|
||||||
|
// Fails if a file mixes the pages of the selection with a page of another population.
|
||||||
|
const respuestas = (q: SeguimientoTablaQuery) => of(q.page === 2 ? cohorte(450)({ ...q, filtros: {} }) : cohorte(450)(q));
|
||||||
|
const malo = { consultar: (_d: string, q: SeguimientoTablaQuery) => respuestas(q) } as unknown as SeguimientoTablaService;
|
||||||
|
const error = await new Promise<unknown>(ok => fetchAllTracking(malo, 'cama', { ...consulta(), page_size: 200 }, 1000).subscribe({ error: ok, complete: () => ok(undefined) }));
|
||||||
|
expect(error).toBeInstanceOf(Error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Exportación: la consulta cambia mientras se exporta', () => {
|
||||||
|
let respuestas: (q: SeguimientoTablaQuery) => Observable<SeguimientoTablaResponse>, descargas: string[];
|
||||||
|
let fixture: ReturnType<typeof TestBed.createComponent<TrackingExportBar>>;
|
||||||
|
beforeEach(() => {
|
||||||
|
descargas = [];
|
||||||
|
respuestas = q => of(cohorte(27)(q));
|
||||||
|
TestBed.configureTestingModule({ providers: [{ provide: SeguimientoTablaService, useValue: { consultar: (_d: string, q: SeguimientoTablaQuery) => respuestas(q) } }] });
|
||||||
|
vi.spyOn(URL, 'createObjectURL').mockImplementation(() => 'blob:test');
|
||||||
|
vi.spyOn(URL, 'revokeObjectURL').mockImplementation(() => undefined);
|
||||||
|
vi.spyOn(HTMLAnchorElement.prototype, 'click').mockImplementation(function (this: HTMLAnchorElement) { descargas.push(this.download); });
|
||||||
|
});
|
||||||
|
afterEach(() => { fixture?.destroy(); vi.restoreAllMocks(); });
|
||||||
|
const montar = (r: SeguimientoTablaResponse, seleccion?: string) => {
|
||||||
|
fixture = TestBed.createComponent(TrackingExportBar);
|
||||||
|
fixture.componentRef.setInput('dominio', 'cama'); fixture.componentRef.setInput('respuesta', r);
|
||||||
|
fixture.componentRef.setInput('seleccion', seleccion); fixture.detectChanges();
|
||||||
|
return fixture.nativeElement as HTMLElement;
|
||||||
|
};
|
||||||
|
const excel = (root: HTMLElement) => [...root.querySelectorAll('button')].find(b => b.textContent!.includes('Excel')) as HTMLButtonElement;
|
||||||
|
const esperar = async () => { for (let i = 0; i < 20; i++) { await fixture.whenStable(); await new Promise(r => setTimeout(r, 10)); fixture.detectChanges(); } };
|
||||||
|
|
||||||
|
it('un archivo de una selección se llama como tal y no lleva a ningún paciente en el nombre', async () => {
|
||||||
|
// Fails if the file of a selection is told apart from a plain list by nothing, or names a patient.
|
||||||
|
const root = montar(cohorte(27)(consulta()), ETIQUETA);
|
||||||
|
excel(root).click(); await esperar();
|
||||||
|
expect(descargas).toHaveLength(1);
|
||||||
|
expect(descargas[0]).toMatch(/^seguimiento-cancer-de-mama-seleccion_corte-2026-10-20_\d{8}-\d{4}\.xlsx$/);
|
||||||
|
expect(descargas[0]).not.toMatch(/M-\d|cama/i);
|
||||||
|
});
|
||||||
|
it('si la consulta en pantalla cambia mientras se lee, se cancela y no se descarga nada', async () => {
|
||||||
|
// Fails if a list read for the old selection is downloaded as the one now on screen.
|
||||||
|
const lenta = new Subject<SeguimientoTablaResponse>();
|
||||||
|
respuestas = () => lenta;
|
||||||
|
const root = montar(cohorte(27)(consulta()), ETIQUETA);
|
||||||
|
excel(root).click(); fixture.detectChanges();
|
||||||
|
expect(root.textContent).toContain('Preparando exportación');
|
||||||
|
fixture.componentRef.setInput('respuesta', cohorte(27)(consulta({ filtros: { birads: 'BIRADS_6' } })));
|
||||||
|
fixture.componentRef.setInput('seleccion', 'Cáncer confirmado: Categoría BI-RADS, BI-RADS 6'); fixture.detectChanges();
|
||||||
|
lenta.next(cohorte(27)(consulta()));
|
||||||
|
await esperar();
|
||||||
|
expect(descargas).toEqual([]);
|
||||||
|
expect(root.querySelector('[role=alert]')?.textContent).toContain('La consulta cambió; se canceló la exportación');
|
||||||
|
expect(excel(root).disabled).toBe(false);
|
||||||
|
});
|
||||||
|
it('si cambia mientras se genera el archivo, tampoco se descarga', async () => {
|
||||||
|
// Fails if a file finished after the selection changed still reaches the downloads.
|
||||||
|
const root = montar(cohorte(27)(consulta()), ETIQUETA);
|
||||||
|
excel(root).click();
|
||||||
|
fixture.componentRef.setInput('seleccion', 'Cáncer confirmado: Categoría BI-RADS, BI-RADS 6'); fixture.detectChanges();
|
||||||
|
await esperar();
|
||||||
|
expect(descargas).toEqual([]);
|
||||||
|
expect(root.querySelector('[role=alert]')?.textContent).toContain('La consulta cambió');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
// Covers the layer that reads every row of a follow-up query: the page size it asks for, the cut-off and filters it
|
||||||
|
// keeps, the limit that refuses instead of truncating, the checks that the pages form one list, and cancellation.
|
||||||
|
// Fixture: fixtures/cama_seguimiento.json (27 synthetic rows). `servidor` pages it like the API does and counts
|
||||||
|
// the requests it receives.
|
||||||
|
import { Observable, of, Subject, toArray, lastValueFrom } from 'rxjs';
|
||||||
|
import fixtureData from '../fixtures/cama_seguimiento.json';
|
||||||
|
import { SeguimientoTablaQuery, SeguimientoTablaResponse, SeguimientoTablaService, seguimientoTablaResponse } from '../seguimiento-tabla.service';
|
||||||
|
import { ExportInconsistent, ExportLimitExceeded, TrackingExportEvent } from './tracking-export.models';
|
||||||
|
import { fetchAllTracking, queryOf } from './tracking-export-source';
|
||||||
|
|
||||||
|
const base = () => structuredClone(fixtureData) as unknown as Record<string, any>;
|
||||||
|
const TOTAL = (base()['items'] as unknown[]).length;
|
||||||
|
|
||||||
|
// A server that pages the fixture. `tweak` can alter the answer of a page to simulate a list that changes, and
|
||||||
|
// `size` makes it serve smaller pages than asked for, so that 27 rows span several pages.
|
||||||
|
function servidor(tweak: (page: number, answer: Record<string, any>) => Record<string, any> = (_, a) => a, size?: number) {
|
||||||
|
const requests: SeguimientoTablaQuery[] = [];
|
||||||
|
const service = {
|
||||||
|
consultar(_dominio: string, q: SeguimientoTablaQuery): Observable<SeguimientoTablaResponse> {
|
||||||
|
requests.push(q);
|
||||||
|
const d = base(), all = d['items'] as unknown[], tam = size ?? q.page_size;
|
||||||
|
d['items'] = all.slice((q.page - 1) * tam, q.page * tam);
|
||||||
|
d['paginacion'] = { page: q.page, page_size: tam, total_items: all.length, total_pages: Math.max(1, Math.ceil(all.length / tam)) };
|
||||||
|
d['corte'] = q.corte ?? d['corte'];
|
||||||
|
d['ventana'] = { ...d['ventana'], meses: q.meses };
|
||||||
|
d['filtros'] = { ...d['filtros'], ...q.filtros };
|
||||||
|
return of(seguimientoTablaResponse(tweak(q.page, d)));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return { service: service as unknown as SeguimientoTablaService, requests };
|
||||||
|
}
|
||||||
|
const consulta: SeguimientoTablaQuery = { corte: '2026-10-20', meses: 3, page: 1, page_size: 5, filtros: { estatus: 'BENIGNO' } };
|
||||||
|
const eventos = (obs: Observable<TrackingExportEvent>) => lastValueFrom(obs.pipe(toArray()));
|
||||||
|
|
||||||
|
describe('Exportación: lectura completa del seguimiento', () => {
|
||||||
|
// Fails if the layer asks for the page size the user was looking at instead of the largest one, or loses a row.
|
||||||
|
it('reads every row in pages of 200 and returns them in the server order, whatever page the user was on', async () => {
|
||||||
|
const { service, requests } = servidor();
|
||||||
|
const out = await eventos(fetchAllTracking(service, 'cama', { ...consulta, page: 3 }, 5000));
|
||||||
|
const done = out.at(-1)!;
|
||||||
|
expect(done.kind).toBe('done');
|
||||||
|
if (done.kind !== 'done') return;
|
||||||
|
expect(done.snapshot.items).toHaveLength(TOTAL);
|
||||||
|
expect(done.snapshot.items.map(i => i['id_seudonimo'])).toEqual((base()['items'] as Record<string, any>[]).map(i => i['id_seudonimo']));
|
||||||
|
expect(requests.map(r => r.page_size)).toEqual([200]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if later pages are asked without the first answer's cut-off and filters, which would mix two lists.
|
||||||
|
it('keeps the cut-off, window and filters of the shown query in every request', async () => {
|
||||||
|
const { service, requests } = servidor(undefined, 10);
|
||||||
|
await eventos(fetchAllTracking(service, 'cama', consulta, 5000));
|
||||||
|
expect(requests).toHaveLength(3);
|
||||||
|
for (const r of requests) expect(r).toMatchObject({ corte: '2026-10-20', meses: 3, filtros: { estatus: 'BENIGNO' } });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if progress stops being reported or does not end at the announced total.
|
||||||
|
it('reports progress up to the announced total and then the finished snapshot', async () => {
|
||||||
|
const { service } = servidor();
|
||||||
|
const out = await eventos(fetchAllTracking(service, 'cama', consulta, 5000));
|
||||||
|
expect(out[0]).toEqual({ kind: 'progress', fetched: TOTAL, total: TOTAL });
|
||||||
|
expect(out.at(-1)!.kind).toBe('done');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if a query above the limit starts downloading pages, or if it returns a subset without saying so.
|
||||||
|
it('refuses a query above the limit before asking for more pages and never returns a subset', async () => {
|
||||||
|
const { service, requests } = servidor();
|
||||||
|
await expect(eventos(fetchAllTracking(service, 'cama', consulta, TOTAL - 1))).rejects.toBeInstanceOf(ExportLimitExceeded);
|
||||||
|
expect(requests).toHaveLength(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the limit becomes exclusive: a list of exactly the limit must still be exported.
|
||||||
|
it('accepts a query that is exactly at the limit', async () => {
|
||||||
|
const { service } = servidor();
|
||||||
|
const out = await eventos(fetchAllTracking(service, 'cama', consulta, TOTAL));
|
||||||
|
expect(out.at(-1)!.kind).toBe('done');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if an answer that did not apply the asked filter is accepted: the file would list other patients.
|
||||||
|
it('fails when the server does not report the filters that were asked for', async () => {
|
||||||
|
const { service } = servidor((_page, a) => ({ ...a, filtros: { ...a['filtros'], estatus: null } }));
|
||||||
|
await expect(eventos(fetchAllTracking(service, 'cama', consulta, 5000))).rejects.toBeInstanceOf(ExportInconsistent);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if a total that changes between pages is accepted: the file would mix two states of the list.
|
||||||
|
it('fails when the total changes between pages', async () => {
|
||||||
|
const { service } = servidor((page, a) => page === 1 ? a : { ...a, paginacion: { ...a['paginacion'], total_items: TOTAL + 1 } }, 10);
|
||||||
|
await expect(eventos(fetchAllTracking(service, 'cama', consulta, 5000))).rejects.toBeInstanceOf(ExportInconsistent);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if a repeated row (the same id on two pages) is accepted as if it were two patients.
|
||||||
|
it('fails when a row repeats across pages', async () => {
|
||||||
|
const { service } = servidor((page, a) => page === 1 ? a : { ...a, items: [(base()['items'] as unknown[])[0]] }, 10);
|
||||||
|
await expect(eventos(fetchAllTracking(service, 'cama', consulta, 5000))).rejects.toBeInstanceOf(ExportInconsistent);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if cancelling (unsubscribing) leaves requests pending or still emits events afterwards.
|
||||||
|
it('stops asking when the subscriber cancels', () => {
|
||||||
|
const first = new Subject<SeguimientoTablaResponse>();
|
||||||
|
const requests: SeguimientoTablaQuery[] = [];
|
||||||
|
const service = { consultar: (_d: string, q: SeguimientoTablaQuery) => { requests.push(q); return first; } } as unknown as SeguimientoTablaService;
|
||||||
|
const seen: TrackingExportEvent[] = [];
|
||||||
|
const subscription = fetchAllTracking(service, 'cama', consulta, 5000).subscribe(e => seen.push(e));
|
||||||
|
subscription.unsubscribe();
|
||||||
|
first.next(seguimientoTablaResponse(base()));
|
||||||
|
expect(requests).toHaveLength(1);
|
||||||
|
expect(seen).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if an invalid query reaches the network instead of failing inside the stream.
|
||||||
|
it('turns an invalid query into an error of the stream', async () => {
|
||||||
|
const real = { consultar: (_d: string, _q: SeguimientoTablaQuery) => { throw new Error('invalid'); } } as unknown as SeguimientoTablaService;
|
||||||
|
await expect(eventos(fetchAllTracking(real, 'cama', consulta, 5000))).rejects.toThrow('invalid');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Exportación: consulta de una respuesta', () => {
|
||||||
|
// Fails if the export is built from the form being edited instead of what the shown answer says it applied.
|
||||||
|
it('rebuilds the query from the answer: cut-off, window months and only the filters that were applied', () => {
|
||||||
|
const answer = seguimientoTablaResponse({ ...base(), filtros: { estatus: 'BENIGNO', birads: null, grupo_edad: null, prioridad: null } });
|
||||||
|
expect(queryOf(answer)).toEqual({ corte: answer.corte, meses: answer.ventana.meses, page: 1, page_size: 200, filtros: { estatus: 'BENIGNO' } });
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import { concatWith, defer, from, map, mergeMap, Observable, of, startWith, switchMap, tap } from 'rxjs';
|
||||||
|
import { Dominio } from '../indicadores.models';
|
||||||
|
import { identidadesDe } from '../paciente-identidad';
|
||||||
|
import { consultaAplicada, contextoDe, PAGE_SIZE_MAX, SeguimientoTablaQuery, SeguimientoTablaResponse, SeguimientoTablaService } from '../seguimiento-tabla.service';
|
||||||
|
import { ExportInconsistent, ExportLimitExceeded, TrackingExportEvent, TrackingRow } from './tracking-export.models';
|
||||||
|
|
||||||
|
const CONCURRENCY = 3;
|
||||||
|
|
||||||
|
/** The query that produced a shown answer: its cut-off, window and the filters the server applied. */
|
||||||
|
export function queryOf(response: SeguimientoTablaResponse): SeguimientoTablaQuery {
|
||||||
|
return {
|
||||||
|
corte: response.corte,
|
||||||
|
meses: response.ventana.meses,
|
||||||
|
page: 1,
|
||||||
|
page_size: PAGE_SIZE_MAX,
|
||||||
|
filtros: Object.fromEntries(Object.entries(response.filtros).filter(([, v]) => v !== null).map(([k, v]) => [k, v as string])),
|
||||||
|
// A cohort's list is exported as that cohort, at the revision it was read at: another revision is refused by the server.
|
||||||
|
contexto: contextoDe(response),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// The server must report having applied the window and the filters that were asked for; otherwise the file would
|
||||||
|
// hold rows of another query under the title of this one.
|
||||||
|
const sameQuery = consultaAplicada;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads every row a follow-up query matches, page by page, with the cut-off fixed by the first answer.
|
||||||
|
* Unsubscribing cancels the pending requests. It fails instead of returning a partial or unstable list.
|
||||||
|
*/
|
||||||
|
export function fetchAllTracking(service: SeguimientoTablaService, dominio: Dominio, query: SeguimientoTablaQuery, limit: number): Observable<TrackingExportEvent> {
|
||||||
|
const ask = (q: SeguimientoTablaQuery) => defer(() => service.consultar(dominio, q));
|
||||||
|
return ask({ ...query, page: 1, page_size: PAGE_SIZE_MAX }).pipe(
|
||||||
|
switchMap(first => {
|
||||||
|
const { total_items: total, total_pages: pages } = first.paginacion;
|
||||||
|
if (!sameQuery(query, first)) throw new ExportInconsistent('The answer does not apply the query that was asked');
|
||||||
|
if (total > limit) throw new ExportLimitExceeded(total, limit);
|
||||||
|
// The rest of the pages are asked for exactly what the first one was, with the cut-off it answered.
|
||||||
|
const pinned = { ...query, corte: first.corte, page_size: PAGE_SIZE_MAX };
|
||||||
|
const collected = new Map<number, TrackingRow[]>([[1, first.items]]);
|
||||||
|
const count = () => [...collected.values()].reduce((sum, rows) => sum + rows.length, 0);
|
||||||
|
const rest = from(Array.from({ length: Math.max(0, pages - 1) }, (_, i) => i + 2)).pipe(
|
||||||
|
mergeMap(page => ask({ ...pinned, page }).pipe(map(answer => ({ page, answer }))), CONCURRENCY),
|
||||||
|
tap(({ page, answer }) => {
|
||||||
|
if (answer.paginacion.page !== page || answer.paginacion.total_items !== total || answer.paginacion.total_pages !== pages
|
||||||
|
|| answer.corte !== first.corte || !sameQuery(pinned, answer)) throw new ExportInconsistent('The list changed while it was being read');
|
||||||
|
collected.set(page, answer.items);
|
||||||
|
}),
|
||||||
|
map((): TrackingExportEvent => ({ kind: 'progress', fetched: count(), total })),
|
||||||
|
);
|
||||||
|
return rest.pipe(
|
||||||
|
startWith<TrackingExportEvent>({ kind: 'progress', fetched: first.items.length, total }),
|
||||||
|
concatWith(defer(() => {
|
||||||
|
const items = [...collected.entries()].sort(([a], [b]) => a - b).flatMap(([, rows]) => rows);
|
||||||
|
// Every row has the identity the table shows, and no patient (or episode) appears on two pages.
|
||||||
|
if (items.length !== total || !identidadesDe(items)) throw new ExportInconsistent('The pages do not add up to the announced total');
|
||||||
|
return of<TrackingExportEvent>({
|
||||||
|
kind: 'done',
|
||||||
|
snapshot: { corte: first.corte, ventana: first.ventana, filtros: first.filtros, filtros_disponibles: first.filtros_disponibles, columnas: first.columnas, items },
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// Covers how a follow-up snapshot becomes table cells (shared by the spreadsheet and the PDF), the formula
|
||||||
|
// neutraliser and the file name policy. Fixture: fixtures/cama_seguimiento.json.
|
||||||
|
import fixtureData from '../fixtures/cama_seguimiento.json';
|
||||||
|
import { seguimientoTablaResponse } from '../seguimiento-tabla.service';
|
||||||
|
import { neutralizeFormula } from './cell-sanitizer';
|
||||||
|
import { exportFilename } from './download-file';
|
||||||
|
import { displayText, exportColumns, flatTable, UNAVAILABLE } from './tracking-export-table';
|
||||||
|
import { TrackingSnapshot } from './tracking-export.models';
|
||||||
|
|
||||||
|
function snapshot(): TrackingSnapshot {
|
||||||
|
const r = seguimientoTablaResponse(structuredClone(fixtureData));
|
||||||
|
return { corte: r.corte, ventana: r.ventana, filtros: r.filtros, filtros_disponibles: r.filtros_disponibles, columnas: r.columnas, items: r.items };
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Exportación: tabla plana', () => {
|
||||||
|
// Fails if a detail column is dropped or reordered: the spreadsheet would lose the date next to its value.
|
||||||
|
it('places each detail after its value, labelled with its column', () => {
|
||||||
|
const { columns } = flatTable(snapshot());
|
||||||
|
expect(columns.map(c => c.key)).toEqual(['id_seudonimo', 'grupo_edad', 'estatus', 'birads', 'mastografia_fecha', 'biopsia', 'biopsia_fecha', 'dias_mastografia_diagnostico', 'prioridad']);
|
||||||
|
expect(columns.find(c => c.key === 'mastografia_fecha')!.label).toBe('Última mastografía: Fecha');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if a number is exported as text (it could not be summed or sorted) or a text column as a number.
|
||||||
|
it('marks as numeric only the columns whose present values are all numbers', () => {
|
||||||
|
const { columns } = flatTable(snapshot());
|
||||||
|
expect(columns.filter(c => c.numeric).map(c => c.key)).toEqual(['dias_mastografia_diagnostico']);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if a missing value is invented (0, '') instead of kept as null, which would pass as clinical data.
|
||||||
|
it('keeps a missing value as null and the rows in the snapshot order', () => {
|
||||||
|
const s = snapshot();
|
||||||
|
const { columns, rows } = flatTable(s);
|
||||||
|
const at = columns.findIndex(c => c.key === 'biopsia');
|
||||||
|
expect(rows).toHaveLength(s.items.length);
|
||||||
|
expect(rows.map(r => r[0])).toEqual(s.items.map(i => i['id_seudonimo']));
|
||||||
|
expect(rows.some(r => r[at] === null)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the document and the screen stop agreeing on how a missing value reads.
|
||||||
|
it('reads a missing value as the table does', () => {
|
||||||
|
expect(displayText(null)).toBe(UNAVAILABLE);
|
||||||
|
expect(displayText(undefined)).toBe(UNAVAILABLE);
|
||||||
|
expect(displayText(12)).toBe('12');
|
||||||
|
expect(exportColumns(snapshot()).find(c => c.key === 'birads')!.details).toEqual([{ key: 'mastografia_fecha', label: 'Fecha' }]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Exportación: texto de celdas y nombres de archivo', () => {
|
||||||
|
// Fails if a value that starts like a formula is written as is: opening the file could run it.
|
||||||
|
it.each(['=1+1', '+SUM(A1)', '-2+3', '@cmd', '\tx', '\rx'])('neutralises %j', text => {
|
||||||
|
expect(neutralizeFormula(text)).toBe(`'${text}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if ordinary labels are altered by the neutraliser.
|
||||||
|
it('leaves ordinary text untouched', () => {
|
||||||
|
for (const text of ['Pendiente de biopsia', 'BI-RADS 4A', '2026-10-20', '']) expect(neutralizeFormula(text)).toBe(text);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if a file name carries a patient identifier or characters that are unsafe in a path.
|
||||||
|
it('names files after the report and the cut-off, never a patient', () => {
|
||||||
|
const name = exportFilename('seguimiento-cancer-de-mama', '2026-10-20', 'xlsx', new Date(2026, 10, 12, 15, 30));
|
||||||
|
expect(name).toBe('seguimiento-cancer-de-mama_corte-2026-10-20_20261112-1530.xlsx');
|
||||||
|
expect(exportFilename('ficha-cancer-de-mama', '../2026-10-20', 'pdf', new Date(2026, 0, 2, 3, 4))).toBe('ficha-cancer-de-mama_corte-2026-10-20_20260102-0304.pdf');
|
||||||
|
expect(name).not.toMatch(/M-\d+/);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { SeguimientoValor } from '../seguimiento-tabla.service';
|
||||||
|
import { TrackingSnapshot } from './tracking-export.models';
|
||||||
|
|
||||||
|
export const UNAVAILABLE = 'No disponible';
|
||||||
|
|
||||||
|
/** A column as the follow-up table shows it: the value and, under it, its labelled details. */
|
||||||
|
export interface ExportColumn { key: string; label: string; details: { key: string; label: string }[]; }
|
||||||
|
|
||||||
|
/** One flat column of a spreadsheet; a detail becomes a column of its own so it can be filtered and sorted. */
|
||||||
|
export interface FlatColumn { key: string; label: string; numeric: boolean; }
|
||||||
|
|
||||||
|
export interface FlatTable { columns: FlatColumn[]; rows: SeguimientoValor[][]; }
|
||||||
|
|
||||||
|
/** The columns the answer announced, in its order. */
|
||||||
|
export function exportColumns(snapshot: TrackingSnapshot): ExportColumn[] {
|
||||||
|
return snapshot.columnas.map(c => ({ key: c.clave, label: c.etiqueta, details: (c.detalles ?? []).map(d => ({ key: d.clave, label: d.etiqueta })) }));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Text of a value as the table shows it, `null` included. */
|
||||||
|
export function displayText(value: SeguimientoValor | undefined): string {
|
||||||
|
return value === null || value === undefined ? UNAVAILABLE : String(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Every detail after its value, with a column numeric only when each present value is a number. */
|
||||||
|
export function flatTable(snapshot: TrackingSnapshot): FlatTable {
|
||||||
|
const columns: FlatColumn[] = [];
|
||||||
|
for (const column of exportColumns(snapshot)) {
|
||||||
|
columns.push({ key: column.key, label: column.label, numeric: false });
|
||||||
|
for (const detail of column.details) columns.push({ key: detail.key, label: `${column.label}: ${detail.label}`, numeric: false });
|
||||||
|
}
|
||||||
|
for (const column of columns) {
|
||||||
|
const present = snapshot.items.map(item => item[column.key]).filter(v => v !== null && v !== undefined);
|
||||||
|
column.numeric = present.length > 0 && present.every(v => typeof v === 'number');
|
||||||
|
}
|
||||||
|
return { columns, rows: snapshot.items.map(item => columns.map(column => item[column.key] ?? null)) };
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { etiquetaVentana, SeguimientoTablaResponse, SeguimientoValor } from '../seguimiento-tabla.service';
|
||||||
|
|
||||||
|
/** Largest number of rows each format accepts. A query above the limit is refused, never truncated. */
|
||||||
|
export const EXPORT_LIMITS = { xlsx: 5000, pdf: 1000 } as const;
|
||||||
|
export type ExportFormat = keyof typeof EXPORT_LIMITS;
|
||||||
|
|
||||||
|
export type TrackingRow = Record<string, SeguimientoValor>;
|
||||||
|
|
||||||
|
/** Everything one export needs: the first answer (columns, filters, window) and all the rows it announced. */
|
||||||
|
export interface TrackingSnapshot {
|
||||||
|
/** How the analysis named the selection this list opens, when it does; the files carry it so they say where they come from. */
|
||||||
|
seleccion?: string;
|
||||||
|
corte: string;
|
||||||
|
ventana: SeguimientoTablaResponse['ventana'];
|
||||||
|
filtros: SeguimientoTablaResponse['filtros'];
|
||||||
|
filtros_disponibles: SeguimientoTablaResponse['filtros_disponibles'];
|
||||||
|
columnas: SeguimientoTablaResponse['columnas'];
|
||||||
|
items: TrackingRow[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The window as the files state it: the whole cohort up to the cut-off, or the dates and months of the window. */
|
||||||
|
export function ventanaConsultada(snapshot: Pick<TrackingSnapshot, 'ventana'>): string {
|
||||||
|
const { meses, desde, hasta } = snapshot.ventana;
|
||||||
|
return meses === 0 ? `Toda la cohorte, al ${hasta}` : `${desde} al ${hasta} (${etiquetaVentana(meses)})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TrackingExportEvent =
|
||||||
|
| { kind: 'progress'; fetched: number; total: number }
|
||||||
|
| { kind: 'done'; snapshot: TrackingSnapshot };
|
||||||
|
|
||||||
|
export class ExportLimitExceeded extends Error {
|
||||||
|
constructor(readonly total: number, readonly limit: number) {
|
||||||
|
super(`The query has ${total} rows and the limit is ${limit}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The pages did not describe one stable list (the total changed, a page repeated or a row was lost). */
|
||||||
|
export class ExportInconsistent extends Error {}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
// Covers the follow-up PDF: the institutional frame (logo, title, footer), the parameters it
|
||||||
|
// prints, the table that repeats its header across pages, and that the document really renders to a PDF file.
|
||||||
|
// Fixture: fixtures/cama_seguimiento.json. The logo is a 1x1 PNG data URL; the real logo is read in the browser.
|
||||||
|
import fixtureData from '../fixtures/cama_seguimiento.json';
|
||||||
|
import { seguimientoTablaResponse } from '../seguimiento-tabla.service';
|
||||||
|
import { COLORS, PDF_CONFIDENTIAL } from './pdf-template';
|
||||||
|
import { buildTrackingPdf, trackingDocument } from './tracking-pdf';
|
||||||
|
import { TrackingSnapshot } from './tracking-export.models';
|
||||||
|
|
||||||
|
const PIXEL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==';
|
||||||
|
const NOW = new Date(Date.UTC(2026, 10, 12, 21, 30));
|
||||||
|
|
||||||
|
function snapshot(mutate: (s: TrackingSnapshot) => void = () => undefined): TrackingSnapshot {
|
||||||
|
const r = seguimientoTablaResponse(structuredClone(fixtureData));
|
||||||
|
const s: TrackingSnapshot = { corte: r.corte, ventana: r.ventana, filtros: { ...r.filtros, prioridad: 'ALTA' }, filtros_disponibles: r.filtros_disponibles, columnas: r.columnas, items: r.items };
|
||||||
|
mutate(s);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
// Every string of a nested document definition, to look for text without depending on its structure.
|
||||||
|
function texts(node: unknown, out: string[] = []): string[] {
|
||||||
|
if (typeof node === 'string') out.push(node);
|
||||||
|
else if (Array.isArray(node)) node.forEach(n => texts(n, out));
|
||||||
|
else if (node && typeof node === 'object') Object.values(node).forEach(n => texts(n, out));
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Exportación: PDF de seguimiento', () => {
|
||||||
|
const definition = (s = snapshot()) => trackingDocument(s, NOW, PIXEL) as Record<string, any>;
|
||||||
|
|
||||||
|
// Fails if the report stops being landscape letter, which the nine columns need.
|
||||||
|
it('is a landscape letter document with generic properties', () => {
|
||||||
|
const d = definition();
|
||||||
|
expect(d['pageSize']).toBe('LETTER');
|
||||||
|
expect(d['pageOrientation']).toBe('landscape');
|
||||||
|
expect(d['info']).toMatchObject({ author: 'ISSSTELEON', creator: 'ISSSTELEON', producer: 'ISSSTELEON', title: 'Cáncer de mama' });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the logo or the title are missing from the header: every page must carry them.
|
||||||
|
it('puts the logo and the title in the header of every page', () => {
|
||||||
|
const d = definition();
|
||||||
|
const header = d['header']();
|
||||||
|
const found = texts(header);
|
||||||
|
// The logo is named in the header and defined once, so it is embedded once however many pages there are.
|
||||||
|
expect(JSON.stringify(header)).toContain('"image":"logo"');
|
||||||
|
expect(d['images']).toEqual({ logo: PIXEL });
|
||||||
|
expect(found).toContain('Cáncer de mama');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the header breaks when the logo cannot be read: the report must still be produced.
|
||||||
|
it('falls back to the name as text when there is no logo', () => {
|
||||||
|
const d = trackingDocument(snapshot(), NOW) as Record<string, any>;
|
||||||
|
expect(JSON.stringify(d['header']())).not.toContain('"image"');
|
||||||
|
expect(texts(d['header']())).toContain('ISSSTELEON');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the footer loses the page count, the confidentiality line or the generation time.
|
||||||
|
it('has a footer with the generation time, the confidentiality line and "Página X de Y"', () => {
|
||||||
|
const found = texts(definition()['footer'](2, 7));
|
||||||
|
expect(found).toContain('Página 2 de 7');
|
||||||
|
expect(found).toContain(PDF_CONFIDENTIAL);
|
||||||
|
expect(found.some(t => t.startsWith('Generado: 12 nov 2026, 3:30 p.m.'))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the parameters stop saying what query the report answers.
|
||||||
|
it('prints the cut-off, the window, every filter with its option and the number of rows', () => {
|
||||||
|
const s = snapshot();
|
||||||
|
const found = texts(definition(s)['content']);
|
||||||
|
for (const t of ['Fecha de corte', s.corte, `${s.ventana.desde} al ${s.ventana.hasta} (3 meses)`, 'Prioridad', 'Alta', 'Todos', 'Registros', String(s.items.length)]) expect(found).toContain(t);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the table stops repeating its header across pages or lets a row split between two pages.
|
||||||
|
it('repeats the header row and keeps each row on one page', () => {
|
||||||
|
const table = definition()['content'].find((n: any) => n.table?.headerRows)!.table;
|
||||||
|
expect(table.headerRows).toBe(1);
|
||||||
|
expect(table.dontBreakRows).toBe(true);
|
||||||
|
expect(table.body).toHaveLength(snapshot().items.length + 1);
|
||||||
|
expect(table.body[0].map((cell: { text: string }) => cell.text)).toEqual(['Identificador seudónimo', 'Grupo de edad', 'Estatus de seguimiento', 'Última mastografía', 'Resultado histopatológico', 'Días de mastografía a diagnóstico', 'Prioridad']);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if details stop appearing under their value, or a missing value is drawn as something other than "No disponible".
|
||||||
|
it('shows each detail under its value and a missing value as "No disponible"', () => {
|
||||||
|
const s = snapshot();
|
||||||
|
const found = texts(definition(s)['content']);
|
||||||
|
expect(found).toContain(`Fecha: ${s.items.find(i => i['mastografia_fecha'])!['mastografia_fecha']}`);
|
||||||
|
expect(found).toContain('No disponible');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the rows lose their alternating band, which keeps long rows readable across a page.
|
||||||
|
it('bands every other row and leaves the header row to its own style', () => {
|
||||||
|
const { layout } = definition()['content'].find((n: any) => n.table?.headerRows);
|
||||||
|
expect([layout.fillColor(0), layout.fillColor(1), layout.fillColor(2)]).toEqual([undefined, undefined, COLORS.band]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if an empty query produces a table with only a header, which reads as a broken report.
|
||||||
|
it('says so when there are no rows', () => {
|
||||||
|
expect(texts(definition(snapshot(x => { x.items = []; }))['content'])).toContain('No hay registros para los filtros aplicados.');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if pdfmake, its fonts or the document definition no longer produce a real, multipage PDF. The logo is left
|
||||||
|
// out because the test browser (jsdom) has no `Worker`, which pdfmake needs to decode a PNG; the image path is
|
||||||
|
// checked in a real browser.
|
||||||
|
it('renders a multipage PDF file for a long list', async () => {
|
||||||
|
const many = snapshot(x => { x.items = Array.from({ length: 120 }, (_, i) => ({ ...x.items[i % x.items.length], id_seudonimo: `M-${String(i).padStart(4, '0')}` })); });
|
||||||
|
const blob = await buildTrackingPdf(many, NOW);
|
||||||
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
||||||
|
const text = new TextDecoder('latin1').decode(bytes);
|
||||||
|
expect(blob.type === 'application/pdf' || blob.type === '').toBe(true);
|
||||||
|
expect(text.startsWith('%PDF-')).toBe(true);
|
||||||
|
expect(text.trimEnd().endsWith('%%EOF')).toBe(true);
|
||||||
|
expect((text.match(/\/Type \/Page\b/g) ?? []).length).toBeGreaterThan(3);
|
||||||
|
}, 30000);
|
||||||
|
});
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import { renderPdf, PdfDefinition } from './pdf-engine';
|
||||||
|
import { COLORS, institutionalDocument, loadLogo } from './pdf-template';
|
||||||
|
import { displayText, exportColumns } from './tracking-export-table';
|
||||||
|
import { TrackingSnapshot, ventanaConsultada } from './tracking-export.models';
|
||||||
|
|
||||||
|
export const TRACKING_TITLE = 'Cáncer de mama';
|
||||||
|
|
||||||
|
const rule = { hLineWidth: () => 0.5, vLineWidth: () => 0, hLineColor: () => COLORS.rule, paddingTop: () => 4, paddingBottom: () => 4 };
|
||||||
|
const zebra = { ...rule, fillColor: (row: number) => (row === 0 ? undefined : row % 2 === 0 ? COLORS.band : undefined) };
|
||||||
|
|
||||||
|
/** What the query was: cut-off, window, each announced filter with its chosen option, and how many rows follow. */
|
||||||
|
function parameters(snapshot: TrackingSnapshot) {
|
||||||
|
const rows: unknown[][] = [
|
||||||
|
...(snapshot.seleccion ? [['Selección del análisis', snapshot.seleccion]] : []),
|
||||||
|
['Fecha de corte', snapshot.corte],
|
||||||
|
['Ventana consultada', ventanaConsultada(snapshot)],
|
||||||
|
...snapshot.filtros_disponibles.map(f => [f.etiqueta, f.opciones.find(o => o.codigo === snapshot.filtros[f.clave])?.etiqueta ?? 'Todos']),
|
||||||
|
['Registros', String(snapshot.items.length)],
|
||||||
|
];
|
||||||
|
return { table: { widths: [130, '*'], body: rows.map(([k, v]) => [{ text: k, bold: true }, v]) }, layout: rule };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The follow-up table: the columns the answer announced, each value with its labelled details under it. */
|
||||||
|
function dataTable(snapshot: TrackingSnapshot) {
|
||||||
|
const columns = exportColumns(snapshot);
|
||||||
|
const cell = (column: (typeof columns)[number], item: Record<string, string | number | null>) => {
|
||||||
|
const value = item[column.key];
|
||||||
|
const parts: unknown[] = [value === null || value === undefined ? { text: displayText(value), italics: true, color: COLORS.muted } : { text: String(value) }];
|
||||||
|
for (const detail of column.details) {
|
||||||
|
const v = item[detail.key];
|
||||||
|
if (v !== null && v !== undefined) parts.push({ text: `${detail.label}: ${v}`, style: 'small' });
|
||||||
|
}
|
||||||
|
return parts.length === 1 ? parts[0] : { stack: parts };
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
table: {
|
||||||
|
headerRows: 1,
|
||||||
|
dontBreakRows: true,
|
||||||
|
widths: columns.map((_, i) => (i === 0 ? 62 : '*')),
|
||||||
|
body: [
|
||||||
|
columns.map(c => ({ text: c.label, style: 'th' })),
|
||||||
|
...snapshot.items.map(item => columns.map(c => cell(c, item))),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
layout: zebra,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The document definition of a follow-up report. Exported so its content can be checked without rendering. */
|
||||||
|
export function trackingDocument(snapshot: TrackingSnapshot, now: Date, logo?: string): PdfDefinition {
|
||||||
|
return institutionalDocument({ title: TRACKING_TITLE, logo, now, orientation: 'landscape' }, [
|
||||||
|
{ text: 'Resultados de seguimiento', style: 'h1' },
|
||||||
|
parameters(snapshot),
|
||||||
|
{ text: 'Pacientes', style: 'h2' },
|
||||||
|
snapshot.items.length ? dataTable(snapshot) : { text: 'No hay registros para los filtros aplicados.', style: 'muted' },
|
||||||
|
{ text: '“No disponible” indica dato no registrado, no ausencia clínica.', style: 'small', margin: [0, 10, 0, 0] },
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A PDF with the follow-up rows over several pages, repeating the header row. */
|
||||||
|
export async function buildTrackingPdf(snapshot: TrackingSnapshot, now = new Date(), logo?: string): Promise<Blob> {
|
||||||
|
return renderPdf(trackingDocument(snapshot, now, logo ?? await loadLogo()));
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
// Covers the spreadsheet of a follow-up export by reading the generated file back: its sheets, native filter, frozen
|
||||||
|
// header, the simulated-data notice, numbers, empty cells, neutralised text and the absence of author metadata.
|
||||||
|
// The reader is `fflate`, the zip library `write-excel-file` itself uses. Fixture: fixtures/cama_seguimiento.json.
|
||||||
|
import { strFromU8, unzipSync } from 'fflate';
|
||||||
|
import fixtureData from '../fixtures/cama_seguimiento.json';
|
||||||
|
import { seguimientoTablaResponse } from '../seguimiento-tabla.service';
|
||||||
|
import { buildTrackingXlsx, columnLetter, DATA_SHEET, PARAMETERS_SHEET } from './tracking-xlsx';
|
||||||
|
import { TrackingSnapshot } from './tracking-export.models';
|
||||||
|
|
||||||
|
function snapshot(mutate: (s: TrackingSnapshot) => void = () => undefined): TrackingSnapshot {
|
||||||
|
const r = seguimientoTablaResponse(structuredClone(fixtureData));
|
||||||
|
const s: TrackingSnapshot = { corte: r.corte, ventana: r.ventana, filtros: { ...r.filtros, estatus: 'BENIGNO' }, filtros_disponibles: r.filtros_disponibles, columnas: r.columnas, items: r.items };
|
||||||
|
mutate(s);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
async function leer(s: TrackingSnapshot) {
|
||||||
|
const blob = await buildTrackingXlsx(s, new Date(Date.UTC(2026, 10, 12, 21, 30)));
|
||||||
|
const files = unzipSync(new Uint8Array(await blob.arrayBuffer()));
|
||||||
|
const text = (name: string) => strFromU8(files[name]);
|
||||||
|
return { files, text, sheet1: text('xl/worksheets/sheet1.xml'), sheet2: text('xl/worksheets/sheet2.xml'), workbook: text('xl/workbook.xml'), strings: text('xl/sharedStrings.xml') };
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Exportación: archivo XLSX', () => {
|
||||||
|
// Fails if the file stops being a spreadsheet of two sheets, the data first and the parameters second.
|
||||||
|
it('has the data sheet first and the parameters sheet second', async () => {
|
||||||
|
const { workbook } = await leer(snapshot());
|
||||||
|
expect(workbook.indexOf(`name="${DATA_SHEET}"`)).toBeGreaterThan(-1);
|
||||||
|
expect(workbook.indexOf(`name="${PARAMETERS_SHEET}"`)).toBeGreaterThan(workbook.indexOf(`name="${DATA_SHEET}"`));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the native filter is lost or placed outside the header row and the rows .
|
||||||
|
it('adds a native filter over the header and every row, starting at the header row', async () => {
|
||||||
|
const s = snapshot();
|
||||||
|
const { sheet1, workbook } = await leer(s);
|
||||||
|
const last = columnLetter(9);
|
||||||
|
expect(sheet1).toContain(`<autoFilter ref="A1:${last}${s.items.length + 1}"/>`);
|
||||||
|
// The schema orders the filter after the data: a wrong order makes Excel repair the file.
|
||||||
|
expect(sheet1.indexOf('</sheetData>')).toBeLessThan(sheet1.indexOf('<autoFilter'));
|
||||||
|
expect(workbook).toContain(`_xlnm._FilterDatabase`);
|
||||||
|
expect(workbook).not.toContain('<definedNames/>');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the header row stops being frozen, which hides the column names while scrolling.
|
||||||
|
it('freezes the header row', async () => {
|
||||||
|
const { sheet1 } = await leer(snapshot());
|
||||||
|
expect(sheet1).toContain('ySplit="1"');
|
||||||
|
expect(sheet1).toContain('state="frozen"');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the file regains a note or banner row: the headers must be the first row of the data sheet.
|
||||||
|
it('starts the data sheet with the column headers and has no note anywhere', async () => {
|
||||||
|
const s = snapshot();
|
||||||
|
const { strings, sheet1 } = await leer(s);
|
||||||
|
const shared = [...strings.matchAll(/<si>(.*?)<\/si>/g)].map(m => m[1].replace(/<[^>]+>/g, ''));
|
||||||
|
expect(sheet1).toMatch(new RegExp('<row r="1"><c r="A1"[^>]*t="s"><v>' + shared.indexOf('Identificador seudónimo') + '</v>'));
|
||||||
|
expect(sheet1).not.toContain('<mergeCells');
|
||||||
|
expect(shared.filter(x => /^Nota$|Documento de consulta|expediente/i.test(x))).toEqual([]);
|
||||||
|
expect(shared).not.toContain('Tipo de datos');
|
||||||
|
expect((sheet1.match(/<row /g) ?? []).length).toBe(s.items.length + 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the headers, the sheet of parameters or the filter labels lose what query the file answers.
|
||||||
|
it('records the cut-off, the window, the filters applied and the total in the parameters sheet', async () => {
|
||||||
|
const s = snapshot();
|
||||||
|
const { strings, sheet2 } = await leer(s);
|
||||||
|
for (const text of [s.corte, `${s.ventana.desde} al ${s.ventana.hasta}`, 'Estatus de seguimiento', 'Benigno, regresa a tamizaje', 'Todos', 'Cáncer de mama']) expect(strings).toContain(text);
|
||||||
|
expect(sheet2).toContain(`<v>${s.items.length}</v>`);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the generation moment is written without the time zone it refers to.
|
||||||
|
it('writes the generation time in Mexico City time', async () => {
|
||||||
|
const { strings } = await leer(snapshot());
|
||||||
|
expect(strings).toContain('hora de la Ciudad de México');
|
||||||
|
// 21:30 UTC is 15:30 in Mexico City (UTC-6 in November).
|
||||||
|
expect(strings).toContain('3:30 p.m.');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if a number is stored as text, or if a missing value becomes a value of its own.
|
||||||
|
it('stores days as numbers and leaves missing values as empty cells', async () => {
|
||||||
|
const s = snapshot();
|
||||||
|
const { sheet1, strings } = await leer(s);
|
||||||
|
const days = s.items.filter(i => typeof i['dias_mastografia_diagnostico'] === 'number');
|
||||||
|
expect(days.length).toBeGreaterThan(0);
|
||||||
|
expect(sheet1).toMatch(new RegExp(`<c r="H\\d+"[^>]*><v>${days[0]['dias_mastografia_diagnostico']}</v></c>`));
|
||||||
|
expect(strings).not.toContain('No disponible');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if text that starts like a formula reaches the file as it is.
|
||||||
|
it('neutralises a value that starts like a formula', async () => {
|
||||||
|
const s = snapshot(x => { x.items[0] = { ...x.items[0], biopsia: '=HYPERLINK("http://example.test")' }; });
|
||||||
|
const { strings } = await leer(s);
|
||||||
|
expect(strings).toContain(`'=HYPERLINK`);
|
||||||
|
expect(strings).not.toMatch(/<t[^>]*>=HYPERLINK/);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the library starts writing author or application properties, which would leak who made the file.
|
||||||
|
it('carries no document properties that identify an author', async () => {
|
||||||
|
const { files } = await leer(snapshot());
|
||||||
|
expect(Object.keys(files).filter(name => name.startsWith('docProps'))).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if the sheet gains hidden sheets, external links or macros.
|
||||||
|
it('has no hidden sheets, external links or macros', async () => {
|
||||||
|
const { files, workbook } = await leer(snapshot());
|
||||||
|
expect(workbook).not.toContain('state="hidden"');
|
||||||
|
expect(Object.keys(files).filter(name => /externalLinks|vbaProject|activeX|embeddings/i.test(name))).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if no rows turns into an invalid filter range or a failure instead of a file with headers.
|
||||||
|
it('produces a valid file when the query has no rows', async () => {
|
||||||
|
const { sheet1 } = await leer(snapshot(x => { x.items = []; }));
|
||||||
|
expect(sheet1).toContain('<autoFilter ref="A1:I1"/>');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fails if column letters beyond Z are wrong, which would put the filter on the wrong columns.
|
||||||
|
it('names columns past Z', () => {
|
||||||
|
expect([1, 26, 27, 52, 53].map(columnLetter)).toEqual(['A', 'Z', 'AA', 'AZ', 'BA']);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
import type { Feature, SheetData } from 'write-excel-file/browser';
|
||||||
|
import { neutralizeFormula } from './cell-sanitizer';
|
||||||
|
import { flatTable } from './tracking-export-table';
|
||||||
|
import { TrackingSnapshot, ventanaConsultada } from './tracking-export.models';
|
||||||
|
|
||||||
|
export const DATA_SHEET = 'Seguimiento';
|
||||||
|
export const PARAMETERS_SHEET = 'Parámetros';
|
||||||
|
|
||||||
|
const INK = '#081839';
|
||||||
|
const ACCENT = '#a8c243';
|
||||||
|
const header = (value: string) => ({ value, fontWeight: 'bold' as const, textColor: INK, backgroundColor: ACCENT, wrap: true, alignVertical: 'center' as const });
|
||||||
|
|
||||||
|
/** Spreadsheet column letters: 1 is A, 27 is AA. */
|
||||||
|
export function columnLetter(n: number): string {
|
||||||
|
let letters = '';
|
||||||
|
for (; n > 0; n = Math.floor((n - 1) / 26)) letters = String.fromCharCode(65 + ((n - 1) % 26)) + letters;
|
||||||
|
return letters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** `write-excel-file` has no filter option: this extension adds the sheet's native filter over the header row. */
|
||||||
|
function nativeFilter(range: string): Feature<Blob | ArrayBuffer> {
|
||||||
|
const [first, last] = range.split(':').map(cell => cell.replace(/([A-Z]+)(\d+)/, '$$$1$$$2'));
|
||||||
|
return {
|
||||||
|
files: {
|
||||||
|
transform: {
|
||||||
|
'xl/worksheets/sheet{id}.xml': {
|
||||||
|
transform: (content, _options, { sheetIndex }) => sheetIndex === 0 ? content.replace('</sheetData>', `</sheetData><autoFilter ref="${range}"/>`) : content,
|
||||||
|
},
|
||||||
|
'xl/workbook.xml': {
|
||||||
|
transform: content => content.replace('<definedNames/>',
|
||||||
|
`<definedNames><definedName name="_xlnm._FilterDatabase" localSheetId="0" hidden="1">'${DATA_SHEET}'!${first}:${last}</definedName></definedNames>`),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function generatedAt(now: Date): string {
|
||||||
|
return new Intl.DateTimeFormat('es-MX', { dateStyle: 'medium', timeStyle: 'short', timeZone: 'America/Mexico_City' }).format(now) + ' (hora de la Ciudad de México)';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The rows of the parameters sheet: what query this file answers and what its empty cells mean. */
|
||||||
|
export function parameterRows(snapshot: TrackingSnapshot, now: Date): SheetData {
|
||||||
|
const row = (label: string, value: string | number) => [{ value: label, fontWeight: 'bold' as const }, typeof value === 'number' ? { value, type: Number } : { value: neutralizeFormula(value), type: String }];
|
||||||
|
const filters = snapshot.filtros_disponibles.map(f => {
|
||||||
|
const code = snapshot.filtros[f.clave];
|
||||||
|
return row(f.etiqueta, f.opciones.find(o => o.codigo === code)?.etiqueta ?? 'Todos');
|
||||||
|
});
|
||||||
|
return [
|
||||||
|
[header('Parámetro'), header('Valor')],
|
||||||
|
row('Reporte', 'Cáncer de mama'),
|
||||||
|
...(snapshot.seleccion ? [row('Selección del análisis', snapshot.seleccion)] : []),
|
||||||
|
row('Fecha de corte', snapshot.corte),
|
||||||
|
row('Ventana consultada', ventanaConsultada(snapshot)),
|
||||||
|
...filters,
|
||||||
|
row('Total de registros', snapshot.items.length),
|
||||||
|
row('Generado', generatedAt(now)),
|
||||||
|
row('Celdas vacías', 'Indican dato no registrado, no ausencia clínica.'),
|
||||||
|
] as SheetData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function width(label: string, values: readonly unknown[]): number {
|
||||||
|
const longest = values.reduce<number>((max, v) => Math.max(max, v === null || v === undefined ? 0 : String(v).length), Math.min(label.length, 28));
|
||||||
|
return Math.min(40, Math.max(12, longest + 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A spreadsheet with the follow-up rows (native filter, frozen header) and a sheet with the query's parameters. */
|
||||||
|
export async function buildTrackingXlsx(snapshot: TrackingSnapshot, now = new Date()): Promise<Blob> {
|
||||||
|
const { default: writeXlsxFile } = await import('write-excel-file/browser');
|
||||||
|
const { columns, rows } = flatTable(snapshot);
|
||||||
|
const data = [
|
||||||
|
columns.map(c => header(c.label)),
|
||||||
|
...rows.map(row => row.map((value, i) => {
|
||||||
|
if (value === null) return null;
|
||||||
|
return columns[i].numeric ? { value: value as number, type: Number } : { value: neutralizeFormula(String(value)), type: String };
|
||||||
|
})),
|
||||||
|
] as SheetData;
|
||||||
|
const range = `A1:${columnLetter(columns.length)}${rows.length + 1}`;
|
||||||
|
return writeXlsxFile([
|
||||||
|
{
|
||||||
|
sheet: DATA_SHEET, data, stickyRowsCount: 1,
|
||||||
|
columns: columns.map((c, i) => ({ width: width(c.label, rows.map(r => r[i])) })),
|
||||||
|
},
|
||||||
|
{ sheet: PARAMETERS_SHEET, data: parameterRows(snapshot, now), columns: [{ width: 26 }, { width: 90 }] },
|
||||||
|
], { features: [nativeFilter(range)] }).toBlob();
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
// The parts of FHIR R4 the WebApi's `/<domain>/fhir/` endpoints serve, read loosely: every field is optional and the
|
||||||
|
// readers below decide what a missing one means.
|
||||||
|
|
||||||
|
export interface Coding { system?: string; code?: string; display?: string }
|
||||||
|
export interface Concept { coding?: Coding[]; text?: string }
|
||||||
|
export interface Quantity { value?: number; unit?: string }
|
||||||
|
export interface Extension {
|
||||||
|
url: string;
|
||||||
|
valueCode?: string; valueString?: string; valueInteger?: number; valueDecimal?: number; valueBoolean?: boolean;
|
||||||
|
valueDate?: string; valueDateTime?: string; valueCoding?: Coding; valueReference?: { reference?: string };
|
||||||
|
extension?: Extension[];
|
||||||
|
}
|
||||||
|
export interface Resource {
|
||||||
|
resourceType: string;
|
||||||
|
id?: string;
|
||||||
|
meta?: { tag?: Coding[] };
|
||||||
|
extension?: Extension[];
|
||||||
|
[field: string]: unknown;
|
||||||
|
}
|
||||||
|
export interface Bundle extends Resource {
|
||||||
|
total?: number;
|
||||||
|
link?: { relation: string; url: string }[];
|
||||||
|
entry?: { fullUrl?: string; resource: Resource; search?: { mode?: string } }[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const CODE_SYSTEM = 'https://isssteleon.org/fhir/CodeSystem/';
|
||||||
|
|
||||||
|
export function code(concept: Concept | undefined): string | undefined {
|
||||||
|
return concept?.coding?.[0]?.code;
|
||||||
|
}
|
||||||
|
export function display(concept: Concept | undefined): string | undefined {
|
||||||
|
return concept?.coding?.[0]?.display ?? concept?.text;
|
||||||
|
}
|
||||||
|
// The code of a concept from `system` (a name under the project's CodeSystem base, or a full URI such as a URN).
|
||||||
|
export function codeIn(concept: Concept | undefined, system: string): string | undefined {
|
||||||
|
const url = system.includes(':') ? system : CODE_SYSTEM + system;
|
||||||
|
return concept?.coding?.find(c => c.system === url)?.code;
|
||||||
|
}
|
||||||
|
// The extensions named `name` (the last segment of their URL).
|
||||||
|
export function extensions(owner: { extension?: Extension[] } | undefined, name: string): Extension[] {
|
||||||
|
return (owner?.extension ?? []).filter(e => e.url === name || e.url.endsWith('/' + name));
|
||||||
|
}
|
||||||
|
export function extension(owner: { extension?: Extension[] } | undefined, name: string): Extension | undefined {
|
||||||
|
return extensions(owner, name)[0];
|
||||||
|
}
|
||||||
|
export function resources(bundle: Bundle | undefined, type?: string): Resource[] {
|
||||||
|
return (bundle?.entry ?? []).map(e => e.resource).filter(r => !type || r.resourceType === type);
|
||||||
|
}
|
||||||
|
export function isSimulated(resource: Resource): boolean {
|
||||||
|
return !!resource.meta?.tag?.some(t => t.code === 'simulado');
|
||||||
|
}
|
||||||
|
// `Patient/P-1` -> `P-1`.
|
||||||
|
export function referenceId(reference: { reference?: string } | undefined): string | undefined {
|
||||||
|
return reference?.reference?.split('/').pop();
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
|||||||
|
{"cohorte": "cama_birads_v1", "escenario": "diagnostico", "revision": "e8fd850e31064f098b34540003d38b6b39b124f21d9ed40f3e52dce8ffc672d0", "corte": "2026-11-16", "ventana": {"meses": 0, "desde": "2025-01-30", "hasta": "2026-11-16"}, "filtros": {"birads": null, "grupo_edad": null, "biopsia": null}, "umbral_supresion": 5, "dimensiones": [{"clave": "birads", "etiqueta": "Categoría BI-RADS", "opciones": [{"codigo": "BIRADS_4", "etiqueta": "BI-RADS 4"}, {"codigo": "BIRADS_4A", "etiqueta": "BI-RADS 4A"}, {"codigo": "BIRADS_4B", "etiqueta": "BI-RADS 4B"}, {"codigo": "BIRADS_4C", "etiqueta": "BI-RADS 4C"}, {"codigo": "BIRADS_5", "etiqueta": "BI-RADS 5"}, {"codigo": "BIRADS_6", "etiqueta": "BI-RADS 6"}]}, {"clave": "grupo_edad", "etiqueta": "Grupo de edad", "opciones": [{"codigo": "<40", "etiqueta": "<40"}, {"codigo": "40-49", "etiqueta": "40-49"}, {"codigo": "50-59", "etiqueta": "50-59"}, {"codigo": "60-69", "etiqueta": "60-69"}, {"codigo": "70+", "etiqueta": "70+"}, {"codigo": "SIN_DATO", "etiqueta": "Sin dato"}]}, {"clave": "biopsia", "etiqueta": "Resultado de la biopsia", "opciones": [{"codigo": "BENIGNO", "etiqueta": "Benigno"}, {"codigo": "CARCINOMA_IN_SITU", "etiqueta": "Carcinoma in situ"}, {"codigo": "CARCINOMA_INVASOR", "etiqueta": "Carcinoma invasor"}, {"codigo": "SIN_DATO", "etiqueta": "Biopsia reportada sin resultado"}, {"codigo": "SIN_BIOPSIA", "etiqueta": "Sin biopsia reportada"}]}], "medidas": [{"clave": "maligno", "etiqueta": "Carcinoma in situ o invasor"}, {"clave": "invasor", "etiqueta": "Carcinoma invasor"}], "horizontes_dias": [30, 90, 180, 365], "tipos_periodo": ["mes", "semestre"], "secciones": [{"clave": "resumen", "titulo": "Indicadores de la cohorte", "estado": "disponible", "motivo": null}, {"clave": "distribucion", "titulo": "Distribución de pacientes", "estado": "disponible", "motivo": null}, {"clave": "comparacion", "titulo": "Comparación entre grupos", "estado": "disponible", "motivo": null}, {"clave": "mapa", "titulo": "Mapa entre variables", "estado": "disponible", "motivo": null}, {"clave": "tendencia", "titulo": "Tendencia en el tiempo", "estado": "disponible", "motivo": null}], "no_disponibles": [{"clave": "supervivencia", "titulo": "Supervivencia", "motivo": "No hay estado vital ni fecha de defunción en las fuentes."}, {"clave": "recaida", "titulo": "Recaída", "motivo": "No hay registro de recurrencia ni de tratamiento en las fuentes."}, {"clave": "adherencia_tratamiento", "titulo": "Adherencia al tratamiento", "motivo": "No hay tabla de tratamientos ni de visitas de seguimiento."}, {"clave": "curvas_tiempo_a_evento", "titulo": "Curvas de incidencia acumulada y de supervivencia", "motivo": "El seguimiento de quien no tuvo el evento no está registrado: no hay censura verificable ni tiempo cero común, y la muerte como riesgo competitivo no existe."}, {"clave": "riesgos_proporcionales", "titulo": "Razones de riesgo (Cox), log-rank y tiempo medio restringido", "motivo": "Dependen de las curvas anteriores."}, {"clave": "brca_estadio_tamano", "titulo": "BRCA, estadio clínico y tamaño tumoral", "motivo": "No hay registros de estas variables en las fuentes."}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"cohorte": "cama_birads_v1", "escenario": "diagnostico", "revision": "e8fd850e31064f098b34540003d38b6b39b124f21d9ed40f3e52dce8ffc672d0", "corte": "2026-11-16", "ventana": {"meses": 0, "desde": "2025-01-30", "hasta": "2026-11-16"}, "filtros": {"birads": null, "grupo_edad": null, "biopsia": null}, "umbral_supresion": 5, "por": "birads", "medida": "maligno", "denominador": "pacientes con resultado de biopsia conocido", "grupos": [{"estado": "suprimido", "casos": null, "total": null, "valor": null, "ic_bajo": null, "ic_alto": null, "codigo": "BIRADS_4", "etiqueta": "BI-RADS 4", "seleccion": {"birads": "BIRADS_4"}}, {"estado": "sin_datos", "casos": null, "total": 0, "valor": null, "ic_bajo": null, "ic_alto": null, "codigo": "BIRADS_4A", "etiqueta": "BI-RADS 4A", "seleccion": {"birads": "BIRADS_4A"}}, {"estado": "sin_datos", "casos": null, "total": 0, "valor": null, "ic_bajo": null, "ic_alto": null, "codigo": "BIRADS_4B", "etiqueta": "BI-RADS 4B", "seleccion": {"birads": "BIRADS_4B"}}, {"estado": "sin_datos", "casos": null, "total": 0, "valor": null, "ic_bajo": null, "ic_alto": null, "codigo": "BIRADS_4C", "etiqueta": "BI-RADS 4C", "seleccion": {"birads": "BIRADS_4C"}}, {"estado": "suprimido", "casos": null, "total": null, "valor": null, "ic_bajo": null, "ic_alto": null, "codigo": "BIRADS_5", "etiqueta": "BI-RADS 5", "seleccion": {"birads": "BIRADS_5"}}, {"estado": "sin_datos", "casos": null, "total": 0, "valor": null, "ic_bajo": null, "ic_alto": null, "codigo": "BIRADS_6", "etiqueta": "BI-RADS 6", "seleccion": {"birads": "BIRADS_6"}}], "prueba": {"valida": false, "motivo": "Hacen falta al menos dos grupos con datos publicados.", "nombre": "Chi cuadrada de homogeneidad"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"cohorte": "cama_birads_v1", "escenario": "diagnostico", "revision": "e8fd850e31064f098b34540003d38b6b39b124f21d9ed40f3e52dce8ffc672d0", "corte": "2026-11-16", "ventana": {"meses": 0, "desde": "2025-01-30", "hasta": "2026-11-16"}, "filtros": {"birads": null, "grupo_edad": null, "biopsia": null}, "umbral_supresion": 5, "por": "grupo_edad", "medida": "invasor", "denominador": "pacientes con resultado de biopsia conocido", "grupos": [{"estado": "sin_datos", "casos": null, "total": 0, "valor": null, "ic_bajo": null, "ic_alto": null, "codigo": "<40", "etiqueta": "<40", "seleccion": {"grupo_edad": "<40"}}, {"estado": "disponible", "casos": 5, "total": 12, "valor": 41.67, "ic_bajo": 19.33, "ic_alto": 68.05, "codigo": "40-49", "etiqueta": "40-49", "seleccion": {"grupo_edad": "40-49"}}, {"estado": "disponible", "casos": 6, "total": 13, "valor": 46.15, "ic_bajo": 23.21, "ic_alto": 70.86, "codigo": "50-59", "etiqueta": "50-59", "seleccion": {"grupo_edad": "50-59"}}, {"estado": "disponible", "casos": 8, "total": 17, "valor": 47.06, "ic_bajo": 26.17, "ic_alto": 69.04, "codigo": "60-69", "etiqueta": "60-69", "seleccion": {"grupo_edad": "60-69"}}, {"estado": "sin_datos", "casos": null, "total": 0, "valor": null, "ic_bajo": null, "ic_alto": null, "codigo": "70+", "etiqueta": "70+", "seleccion": {"grupo_edad": "70+"}}, {"estado": "sin_datos", "casos": null, "total": 0, "valor": null, "ic_bajo": null, "ic_alto": null, "codigo": "SIN_DATO", "etiqueta": "Sin dato", "seleccion": {"grupo_edad": "SIN_DATO"}}], "prueba": {"valida": true, "estadistico": 0.0889, "gl": 2, "p": 0.9565070599102384, "nombre": "Chi cuadrada de homogeneidad"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"cohorte": "cama_birads_v1", "escenario": "diagnostico", "revision": "e8fd850e31064f098b34540003d38b6b39b124f21d9ed40f3e52dce8ffc672d0", "corte": "2026-11-16", "ventana": {"meses": 0, "desde": "2025-01-30", "hasta": "2026-11-16"}, "filtros": {"birads": null, "grupo_edad": null, "biopsia": null}, "umbral_supresion": 5, "por": "biopsia", "total": 61, "items": [{"codigo": "BENIGNO", "etiqueta": "Benigno", "suprimido": false, "n": 21, "porcentaje": 34.43, "ic_bajo": 23.75, "ic_alto": 46.95, "seleccion": {"biopsia": "BENIGNO"}}, {"codigo": "CARCINOMA_IN_SITU", "etiqueta": "Carcinoma in situ", "suprimido": true, "n": null, "porcentaje": null, "ic_bajo": null, "ic_alto": null, "seleccion": {"biopsia": "CARCINOMA_IN_SITU"}}, {"codigo": "CARCINOMA_INVASOR", "etiqueta": "Carcinoma invasor", "suprimido": true, "n": null, "porcentaje": null, "ic_bajo": null, "ic_alto": null, "seleccion": {"biopsia": "CARCINOMA_INVASOR"}}, {"codigo": "SIN_DATO", "etiqueta": "Biopsia reportada sin resultado", "suprimido": false, "n": 0, "porcentaje": 0.0, "ic_bajo": 0.0, "ic_alto": 5.92, "seleccion": {"biopsia": "SIN_DATO"}}, {"codigo": "SIN_BIOPSIA", "etiqueta": "Sin biopsia reportada", "suprimido": false, "n": 19, "porcentaje": 31.15, "ic_bajo": 20.94, "ic_alto": 43.59, "seleccion": {"biopsia": "SIN_BIOPSIA"}}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"cohorte": "cama_birads_v1", "escenario": "diagnostico", "revision": "e8fd850e31064f098b34540003d38b6b39b124f21d9ed40f3e52dce8ffc672d0", "corte": "2026-11-16", "ventana": {"meses": 0, "desde": "2025-01-30", "hasta": "2026-11-16"}, "filtros": {"birads": null, "grupo_edad": null, "biopsia": null}, "umbral_supresion": 5, "por": "birads", "total": 61, "items": [{"codigo": "BIRADS_4", "etiqueta": "BI-RADS 4", "suprimido": false, "n": 33, "porcentaje": 54.1, "ic_bajo": 41.72, "ic_alto": 65.99, "seleccion": {"birads": "BIRADS_4"}}, {"codigo": "BIRADS_4A", "etiqueta": "BI-RADS 4A", "suprimido": false, "n": 0, "porcentaje": 0.0, "ic_bajo": 0.0, "ic_alto": 5.92, "seleccion": {"birads": "BIRADS_4A"}}, {"codigo": "BIRADS_4B", "etiqueta": "BI-RADS 4B", "suprimido": false, "n": 0, "porcentaje": 0.0, "ic_bajo": 0.0, "ic_alto": 5.92, "seleccion": {"birads": "BIRADS_4B"}}, {"codigo": "BIRADS_4C", "etiqueta": "BI-RADS 4C", "suprimido": false, "n": 0, "porcentaje": 0.0, "ic_bajo": 0.0, "ic_alto": 5.92, "seleccion": {"birads": "BIRADS_4C"}}, {"codigo": "BIRADS_5", "etiqueta": "BI-RADS 5", "suprimido": true, "n": null, "porcentaje": null, "ic_bajo": null, "ic_alto": null, "seleccion": {"birads": "BIRADS_5"}}, {"codigo": "BIRADS_6", "etiqueta": "BI-RADS 6", "suprimido": true, "n": null, "porcentaje": null, "ic_bajo": null, "ic_alto": null, "seleccion": {"birads": "BIRADS_6"}}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"cohorte": "cama_birads_v1", "escenario": "diagnostico", "revision": "e8fd850e31064f098b34540003d38b6b39b124f21d9ed40f3e52dce8ffc672d0", "corte": "2026-11-16", "ventana": {"meses": 0, "desde": "2025-01-30", "hasta": "2026-11-16"}, "filtros": {"birads": null, "grupo_edad": null, "biopsia": null}, "umbral_supresion": 5, "por": "grupo_edad", "total": 61, "items": [{"codigo": "<40", "etiqueta": "<40", "suprimido": false, "n": 0, "porcentaje": 0.0, "ic_bajo": 0.0, "ic_alto": 5.92, "seleccion": {"grupo_edad": "<40"}}, {"codigo": "40-49", "etiqueta": "40-49", "suprimido": false, "n": 16, "porcentaje": 26.23, "ic_bajo": 16.84, "ic_alto": 38.44, "seleccion": {"grupo_edad": "40-49"}}, {"codigo": "50-59", "etiqueta": "50-59", "suprimido": false, "n": 19, "porcentaje": 31.15, "ic_bajo": 20.94, "ic_alto": 43.59, "seleccion": {"grupo_edad": "50-59"}}, {"codigo": "60-69", "etiqueta": "60-69", "suprimido": false, "n": 26, "porcentaje": 42.62, "ic_bajo": 31.02, "ic_alto": 55.1, "seleccion": {"grupo_edad": "60-69"}}, {"codigo": "70+", "etiqueta": "70+", "suprimido": false, "n": 0, "porcentaje": 0.0, "ic_bajo": 0.0, "ic_alto": 5.92, "seleccion": {"grupo_edad": "70+"}}, {"codigo": "SIN_DATO", "etiqueta": "Sin dato", "suprimido": false, "n": 0, "porcentaje": 0.0, "ic_bajo": 0.0, "ic_alto": 5.92, "seleccion": {"grupo_edad": "SIN_DATO"}}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"simulado": true, "cohorte": "cama_birads_v1", "revision": "e8fd850e31064f098b34540003d38b6b39b124f21d9ed40f3e52dce8ffc672d0", "escenario": "diagnostico", "corte": "2026-11-16", "umbral_supresion": 5, "unidad": "paciente", "denominador": "pacientes elegibles con última mastografía reportada BI-RADS 4 a 6", "grupos": [{"codigo": "BIRADS_4", "n": 33, "suprimido": false}, {"codigo": "BIRADS_4A", "n": 0, "suprimido": false}, {"codigo": "BIRADS_4B", "n": 0, "suprimido": false}, {"codigo": "BIRADS_4C", "n": 0, "suprimido": false}, {"codigo": "BIRADS_5", "n": null, "suprimido": true}, {"codigo": "BIRADS_6", "n": null, "suprimido": true}], "horizonte_dias": 0, "indicadores": []}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"error": "la selección tiene menos de 5 pacientes: su lista no se publica.", "motivo": "supresion"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"cohorte": "cama_birads_v1", "escenario": "diagnostico", "revision": "e8fd850e31064f098b34540003d38b6b39b124f21d9ed40f3e52dce8ffc672d0", "corte": "2026-11-16", "ventana": {"meses": 0, "desde": "2025-01-30", "hasta": "2026-11-16"}, "filtros": {"birads": null, "grupo_edad": null, "biopsia": null}, "umbral_supresion": 5, "horizonte_dias": 90, "indicadores": [{"clave": "cohorte", "titulo": "Pacientes en la cohorte BI-RADS 4 a 6", "descripcion": "Pacientes cuya última mastografía reportada al corte es BI-RADS 4, 5 o 6.", "unidad": "pacientes", "estado": "disponible", "valor": 61, "ic_bajo": null, "ic_alto": null, "n": 61, "denominador": null, "q1": null, "q3": null, "motivo": null}, {"clave": "con_biopsia", "titulo": "Con biopsia reportada", "descripcion": "Pacientes de la cohorte con al menos un reporte de biopsia de esa mastografía, entre las de la cohorte.", "unidad": "%", "estado": "disponible", "valor": 68.85, "ic_bajo": 56.41, "ic_alto": 79.06, "n": 42, "denominador": 61, "q1": null, "q3": null, "motivo": null}, {"clave": "maligno_conocido", "titulo": "Resultado maligno entre las biopsias con resultado", "descripcion": "Carcinoma in situ o invasor entre las pacientes de la cohorte con resultado de biopsia conocido. No es incidencia: el denominador son pacientes ya biopsiadas.", "unidad": "%", "estado": "disponible", "valor": 50.0, "ic_bajo": 35.53, "ic_alto": 64.47, "n": 21, "denominador": 42, "q1": null, "q3": null, "motivo": null}, {"clave": "invasor_conocido", "titulo": "Carcinoma invasor entre las biopsias con resultado", "descripcion": "Carcinoma invasor entre las pacientes de la cohorte con resultado de biopsia conocido.", "unidad": "%", "estado": "disponible", "valor": 45.24, "ic_bajo": 31.22, "ic_alto": 60.05, "n": 19, "denominador": 42, "q1": null, "q3": null, "motivo": null}, {"clave": "biopsia_90d", "titulo": "Biopsia reportada en 90 días", "descripcion": "Pacientes cuya biopsia se reportó dentro de 90 días de la mastografía, entre las que ya cumplieron 90 días al corte.", "unidad": "%", "estado": "disponible", "valor": 75.56, "ic_bajo": 61.33, "ic_alto": 85.76, "n": 34, "denominador": 45, "q1": null, "q3": null, "motivo": null}, {"clave": "maligno_90d", "titulo": "Cáncer confirmado en 90 días", "descripcion": "Pacientes con un reporte de biopsia maligna dentro de 90 días de la mastografía, entre las que ya cumplieron 90 días al corte. No es incidencia acumulada: no hay seguimiento de quien no tuvo biopsia.", "unidad": "%", "estado": "disponible", "valor": 40.0, "ic_bajo": 27.02, "ic_alto": 54.55, "n": 18, "denominador": 45, "q1": null, "q3": null, "motivo": null}, {"clave": "dias_a_biopsia", "titulo": "Días de la mastografía al reporte de biopsia", "descripcion": "Mediana y cuartiles entre las pacientes con biopsia reportada.", "unidad": "días", "estado": "disponible", "valor": 27.5, "ic_bajo": null, "ic_alto": null, "n": 42, "denominador": null, "q1": 19.25, "q3": 30.75, "motivo": null}], "no_disponibles": [{"clave": "supervivencia", "titulo": "Supervivencia", "motivo": "No hay estado vital ni fecha de defunción en las fuentes."}, {"clave": "recaida", "titulo": "Recaída", "motivo": "No hay registro de recurrencia ni de tratamiento en las fuentes."}, {"clave": "adherencia_tratamiento", "titulo": "Adherencia al tratamiento", "motivo": "No hay tabla de tratamientos ni de visitas de seguimiento."}, {"clave": "curvas_tiempo_a_evento", "titulo": "Curvas de incidencia acumulada y de supervivencia", "motivo": "El seguimiento de quien no tuvo el evento no está registrado: no hay censura verificable ni tiempo cero común, y la muerte como riesgo competitivo no existe."}, {"clave": "riesgos_proporcionales", "titulo": "Razones de riesgo (Cox), log-rank y tiempo medio restringido", "motivo": "Dependen de las curvas anteriores."}, {"clave": "brca_estadio_tamano", "titulo": "BRCA, estadio clínico y tamaño tumoral", "motivo": "No hay registros de estas variables en las fuentes."}]}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"corte": "2026-11-16", "umbral_supresion": 5, "tipo_periodo": "semestre", "unidad": "reportes", "poblacion": "Reportes de mastografía con BI-RADS reportado y reportes de biopsia vinculados a una de esas mastografías, de todas las pacientes; no la cohorte de Seguimiento", "alcance_biopsias": "Solo biopsias que se pueden ligar a una mastografía con BI-RADS reportado (mastografía, orden, reporte); una biopsia sin mastografía ligada no se cuenta", "denominador": "reportes de biopsia con resultado conocido en el periodo", "periodos": [{"periodo": "2025-S1", "inicio": "2025-01-01", "fin": "2025-06-30", "incompleto": false, "reportes_mastografia": {"total": 96, "por_categoria": {"4_a_6": {"n": 31, "suprimido": false}, "otras": {"n": 65, "suprimido": false}}}, "reportes_biopsia": {"total": 24, "por_grado": {"BENIGNO": {"n": null, "suprimido": true}, "CARCINOMA_IN_SITU": {"n": null, "suprimido": true}, "CARCINOMA_INVASOR": {"n": 15, "suprimido": false}, "SIN_DATO": {"n": 0, "suprimido": false}}}, "maligno": {"estado": "disponible", "casos": 16, "total": 24, "valor": 66.67, "ic_bajo": 46.71, "ic_alto": 82.03}}, {"periodo": "2025-S2", "inicio": "2025-07-01", "fin": "2025-12-31", "incompleto": false, "reportes_mastografia": {"total": 97, "por_categoria": {"4_a_6": {"n": 37, "suprimido": false}, "otras": {"n": 60, "suprimido": false}}}, "reportes_biopsia": {"total": 25, "por_grado": {"BENIGNO": {"n": null, "suprimido": true}, "CARCINOMA_IN_SITU": {"n": null, "suprimido": true}, "CARCINOMA_INVASOR": {"n": 13, "suprimido": false}, "SIN_DATO": {"n": 0, "suprimido": false}}}, "maligno": {"estado": "disponible", "casos": 14, "total": 25, "valor": 56.0, "ic_bajo": 37.07, "ic_alto": 73.33}}, {"periodo": "2026-S1", "inicio": "2026-01-01", "fin": "2026-06-30", "incompleto": false, "reportes_mastografia": {"total": 97, "por_categoria": {"4_a_6": {"n": 25, "suprimido": false}, "otras": {"n": 72, "suprimido": false}}}, "reportes_biopsia": {"total": 18, "por_grado": {"BENIGNO": {"n": null, "suprimido": true}, "CARCINOMA_IN_SITU": {"n": null, "suprimido": true}, "CARCINOMA_INVASOR": {"n": 11, "suprimido": false}, "SIN_DATO": {"n": 0, "suprimido": false}}}, "maligno": {"estado": "disponible", "casos": 13, "total": 18, "valor": 72.22, "ic_bajo": 49.13, "ic_alto": 87.5}}, {"periodo": "2026-S2", "inicio": "2026-07-01", "fin": "2026-12-31", "incompleto": true, "reportes_mastografia": {"total": 72, "por_categoria": {"4_a_6": {"n": 27, "suprimido": false}, "otras": {"n": 45, "suprimido": false}}}, "reportes_biopsia": {"total": 19, "por_grado": {"BENIGNO": {"n": 9, "suprimido": false}, "CARCINOMA_IN_SITU": {"n": null, "suprimido": true}, "CARCINOMA_INVASOR": {"n": null, "suprimido": true}, "SIN_DATO": {"n": 0, "suprimido": false}}}, "maligno": {"estado": "disponible", "casos": 10, "total": 19, "valor": 52.63, "ic_bajo": 31.71, "ic_alto": 72.67}}]}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "cama_dias_resultado_diagnostico",
|
||||||
|
"titulo": "Tiempo de resultado a diagnóstico",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contrato": "C3r",
|
||||||
|
"unidad": "examen",
|
||||||
|
"sentido": "decrease",
|
||||||
|
"tipos_periodo": [
|
||||||
|
"semestre",
|
||||||
|
"mes"
|
||||||
|
],
|
||||||
|
"figuras": [
|
||||||
|
"fig_c3r_caja"
|
||||||
|
],
|
||||||
|
"estratos": [],
|
||||||
|
"filtros": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cama_histopatologia_birads",
|
||||||
|
"titulo": "Histopatología por BI-RADS",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contrato": "C2",
|
||||||
|
"unidad": "paciente",
|
||||||
|
"sentido": null,
|
||||||
|
"tipos_periodo": [
|
||||||
|
"semestre",
|
||||||
|
"mes"
|
||||||
|
],
|
||||||
|
"figuras": [
|
||||||
|
"fig_c2_barras",
|
||||||
|
"fig_c2_donas"
|
||||||
|
],
|
||||||
|
"estratos": [
|
||||||
|
"birads"
|
||||||
|
],
|
||||||
|
"filtros": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cama_tasa_deteccion_histopatologica",
|
||||||
|
"titulo": "Detección histopatológica",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contrato": "C1",
|
||||||
|
"unidad": "examen",
|
||||||
|
"sentido": null,
|
||||||
|
"tipos_periodo": [
|
||||||
|
"semestre",
|
||||||
|
"mes"
|
||||||
|
],
|
||||||
|
"figuras": [
|
||||||
|
"fig_c1_puntos"
|
||||||
|
],
|
||||||
|
"estratos": [],
|
||||||
|
"filtros": []
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"id": "cama_dias_resultado_diagnostico",
|
||||||
|
"titulo": "Tiempo de resultado a diagnóstico",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contrato": "C3r",
|
||||||
|
"unidad": "examen",
|
||||||
|
"tipo_periodo": "semestre",
|
||||||
|
"periodos": [
|
||||||
|
"2025-S1"
|
||||||
|
],
|
||||||
|
"estrato": null,
|
||||||
|
"valores_estrato": [],
|
||||||
|
"etiquetas_estrato": {},
|
||||||
|
"grupos": {
|
||||||
|
"TOTAL": "Días de resultado a diagnóstico"
|
||||||
|
},
|
||||||
|
"categorias": {},
|
||||||
|
"grupos_de_categoria": {},
|
||||||
|
"notas": [
|
||||||
|
"Sin nota hasta el corte no hay observación. Convención provisional."
|
||||||
|
],
|
||||||
|
"reportes": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"report_id": 71,
|
||||||
|
"periodo_inicio": "2025-01-01",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"fecha_corte": "2026-11-12",
|
||||||
|
"generado_en": "2026-11-12T17:00:26.219496+00:00",
|
||||||
|
"kit_version": "0.8.0",
|
||||||
|
"toml_sha": "9349fdd093c85bfe9adc86b91ea5350a03be829825645b51ab87a35fccc5d42d",
|
||||||
|
"parametros_sha": "5e4badce17afe0141e8296c9edd88ff1ce50a21c8c278d1aad5327069830d251",
|
||||||
|
"parametros": {
|
||||||
|
"sql": {
|
||||||
|
"_catalogo": [],
|
||||||
|
"_grupos": [
|
||||||
|
"TOTAL"
|
||||||
|
],
|
||||||
|
"fecha_corte": "2026-11-12",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"periodo_inicio": "2025-01-01"
|
||||||
|
},
|
||||||
|
"umbral_supresion": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filas": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": null,
|
||||||
|
"n": null,
|
||||||
|
"mediana": null,
|
||||||
|
"q1": null,
|
||||||
|
"q3": null,
|
||||||
|
"n_sin_evento": 0,
|
||||||
|
"n_excluido": 0,
|
||||||
|
"suprimido": 1,
|
||||||
|
"unidad": "dias"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totales_estrato": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"id": "cama_dias_resultado_diagnostico",
|
||||||
|
"titulo": "Tiempo de resultado a diagnóstico",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contrato": "C3r",
|
||||||
|
"unidad": "examen",
|
||||||
|
"tipo_periodo": "semestre",
|
||||||
|
"periodos": [
|
||||||
|
"2025-S1"
|
||||||
|
],
|
||||||
|
"estrato": null,
|
||||||
|
"valores_estrato": [],
|
||||||
|
"etiquetas_estrato": {},
|
||||||
|
"grupos": {
|
||||||
|
"TOTAL": "Días de resultado a diagnóstico"
|
||||||
|
},
|
||||||
|
"categorias": {},
|
||||||
|
"grupos_de_categoria": {},
|
||||||
|
"notas": [
|
||||||
|
"Sin nota hasta el corte no hay observación. Convención provisional."
|
||||||
|
],
|
||||||
|
"reportes": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"report_id": 71,
|
||||||
|
"periodo_inicio": "2025-01-01",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"fecha_corte": "2026-11-12",
|
||||||
|
"generado_en": "2026-11-12T17:00:38.264922+00:00",
|
||||||
|
"kit_version": "0.8.0",
|
||||||
|
"toml_sha": "38b2efac7d70f9c0bf37b03b7abd21d48bff4c6d8f6786fccbccfa31a7fcd7e7",
|
||||||
|
"parametros_sha": "f26ecdc2fcef0aa015f8997b7c1aa2053678cb86ca9cff9b1524efaf000971ad",
|
||||||
|
"parametros": {
|
||||||
|
"sql": {
|
||||||
|
"_catalogo": [],
|
||||||
|
"_grupos": [
|
||||||
|
"TOTAL"
|
||||||
|
],
|
||||||
|
"fecha_corte": "2026-11-12",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"periodo_inicio": "2025-01-01"
|
||||||
|
},
|
||||||
|
"umbral_supresion": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filas": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": null,
|
||||||
|
"n": 4,
|
||||||
|
"mediana": 6.5,
|
||||||
|
"q1": 2.25,
|
||||||
|
"q3": 12.5,
|
||||||
|
"n_sin_evento": 0,
|
||||||
|
"n_excluido": 1,
|
||||||
|
"suprimido": 0,
|
||||||
|
"unidad": "dias"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totales_estrato": []
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,842 @@
|
|||||||
|
{
|
||||||
|
"resourceType": "Bundle",
|
||||||
|
"type": "searchset",
|
||||||
|
"total": 8,
|
||||||
|
"link": [
|
||||||
|
{
|
||||||
|
"relation": "self",
|
||||||
|
"url": "http://127.0.0.1:28091/cama/fhir/Measure?_count=50&_offset=0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"entry": [
|
||||||
|
{
|
||||||
|
"fullUrl": "http://127.0.0.1:28091/cama/fhir/Measure/CAMA-BIOPSIAS",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Measure",
|
||||||
|
"id": "CAMA-BIOPSIAS",
|
||||||
|
"url": "https://isssteleon.org/fhir/Measure/CAMA-BIOPSIAS",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"name": "cama_biopsias",
|
||||||
|
"title": "Distribución de resultados de biopsia",
|
||||||
|
"status": "active",
|
||||||
|
"description": "Cuántas biopsias reportadas en el semestre caen en cada grado histológico. Se cuenta cada biopsia, no cada paciente. «Sin dato»: el reporte no trae grado.",
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/contrato",
|
||||||
|
"valueCode": "C2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "semestre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "mes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scoring": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
|
||||||
|
"code": "cohort"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida",
|
||||||
|
"code": "TOTAL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"population": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "initial-population"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades del periodo",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_biopsias"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stratifier": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/estratificador",
|
||||||
|
"code": "grado"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subjectCodeableConcept": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/unidad",
|
||||||
|
"code": "examen"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"mode": "match"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "http://127.0.0.1:28091/cama/fhir/Measure/CAMA-BIRADS",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Measure",
|
||||||
|
"id": "CAMA-BIRADS",
|
||||||
|
"url": "https://isssteleon.org/fhir/Measure/CAMA-BIRADS",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"name": "cama_birads",
|
||||||
|
"title": "Distribución de BI-RADS",
|
||||||
|
"status": "active",
|
||||||
|
"description": "Cuántas pacientes caen en cada categoría de BI-RADS en el semestre, cada una en la más grave de sus mastografías. «Sin dato»: ninguna de sus mastografías tiene reporte con BI-RADS.",
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/contrato",
|
||||||
|
"valueCode": "C2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "semestre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "mes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scoring": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
|
||||||
|
"code": "cohort"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida",
|
||||||
|
"code": "TOTAL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"population": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "initial-population"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades del periodo",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_birads"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stratifier": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/estratificador",
|
||||||
|
"code": "birads"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subjectCodeableConcept": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/unidad",
|
||||||
|
"code": "paciente"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"mode": "match"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "http://127.0.0.1:28091/cama/fhir/Measure/CAMA-BIRADS-CANCER-INVASOR",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Measure",
|
||||||
|
"id": "CAMA-BIRADS-CANCER-INVASOR",
|
||||||
|
"url": "https://isssteleon.org/fhir/Measure/CAMA-BIRADS-CANCER-INVASOR",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"name": "cama_birads_cancer_invasor",
|
||||||
|
"title": "BI-RADS de los cánceres invasores",
|
||||||
|
"status": "active",
|
||||||
|
"description": "De las pacientes con una biopsia reportada en el periodo con carcinoma invasor, cuántas tenían cada BI-RADS en la mastografía que originó su biopsia más reciente, por edad y por las características del tumor: estadio clínico, etapa, subtipo molecular y tamaño. Las características vienen de los reportes leídos por texto y son provisionales. «Sin dato»: la biopsia no se ligó a una mastografía con BI-RADS.",
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/contrato",
|
||||||
|
"valueCode": "C2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "semestre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "mes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scoring": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
|
||||||
|
"code": "cohort"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida",
|
||||||
|
"code": "TOTAL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"population": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "initial-population"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades del periodo",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_birads_cancer_invasor"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stratifier": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/estratificador",
|
||||||
|
"code": "birads"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/estratificador",
|
||||||
|
"code": "grupo_edad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "grupo_edad"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/estratificador",
|
||||||
|
"code": "estadio"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "Estadio clínico"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/estratificador",
|
||||||
|
"code": "etapa"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "Etapa"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/estratificador",
|
||||||
|
"code": "clasificacion"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "Subtipo molecular"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/estratificador",
|
||||||
|
"code": "tamano"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "Tamaño tumoral (T)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subjectCodeableConcept": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/unidad",
|
||||||
|
"code": "paciente"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"mode": "match"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "http://127.0.0.1:28091/cama/fhir/Measure/CAMA-BIRADS456-MASTOGRAFIA",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Measure",
|
||||||
|
"id": "CAMA-BIRADS456-MASTOGRAFIA",
|
||||||
|
"url": "https://isssteleon.org/fhir/Measure/CAMA-BIRADS456-MASTOGRAFIA",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"name": "cama_birads_456_mastografia",
|
||||||
|
"title": "Porcentaje individual de mastografías con resultado en la clasificación de BI-RADS 4, 5 y 6",
|
||||||
|
"status": "active",
|
||||||
|
"description": "Cuántas mastografías tomadas en el periodo tienen BI-RADS 4, 5 o 6, cada una con su categoría.",
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/contrato",
|
||||||
|
"valueCode": "C2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "semestre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "mes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scoring": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
|
||||||
|
"code": "cohort"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida",
|
||||||
|
"code": "TOTAL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"population": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "initial-population"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades del periodo",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_birads_456_mastografia"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stratifier": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/estratificador",
|
||||||
|
"code": "birads"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subjectCodeableConcept": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/unidad",
|
||||||
|
"code": "examen"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"mode": "match"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "http://127.0.0.1:28091/cama/fhir/Measure/CAMA-BIRADS456-PACIENTE",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Measure",
|
||||||
|
"id": "CAMA-BIRADS456-PACIENTE",
|
||||||
|
"url": "https://isssteleon.org/fhir/Measure/CAMA-BIRADS456-PACIENTE",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"name": "cama_birads_456_paciente",
|
||||||
|
"title": "Porcentaje de pacientes con resultados de BI-RADS 4, 5 y 6",
|
||||||
|
"status": "active",
|
||||||
|
"description": "Cuántas pacientes tienen como BI-RADS más grave del periodo un 4, 5 o 6, cada una en la más grave de sus mastografías.",
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/contrato",
|
||||||
|
"valueCode": "C2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "semestre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "mes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scoring": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
|
||||||
|
"code": "cohort"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida",
|
||||||
|
"code": "TOTAL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"population": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "initial-population"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades del periodo",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_birads_456_paciente"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stratifier": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/estratificador",
|
||||||
|
"code": "birads"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subjectCodeableConcept": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/unidad",
|
||||||
|
"code": "paciente"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"mode": "match"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "http://127.0.0.1:28091/cama/fhir/Measure/CAMA-CONFIRMACION-BIRADS45",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Measure",
|
||||||
|
"id": "CAMA-CONFIRMACION-BIRADS45",
|
||||||
|
"url": "https://isssteleon.org/fhir/Measure/CAMA-CONFIRMACION-BIRADS45",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"name": "cama_confirmacion_birads45",
|
||||||
|
"title": "Tasa de confirmación histopatológica",
|
||||||
|
"status": "active",
|
||||||
|
"description": "De las mastografías del semestre con BI-RADS de sospecha, las que tienen una biopsia reportada originada por esa mastografía. A la fecha de corte: sin un plazo máximo, el valor puede subir mientras lleguen reportes. No dice si la biopsia confirmó cáncer.",
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/contrato",
|
||||||
|
"valueCode": "C1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "semestre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "mes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scoring": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
|
||||||
|
"code": "proportion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida",
|
||||||
|
"code": "principal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"population": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "initial-population"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades del periodo",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_confirmacion_birads45_denominador"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "denominator"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Denominador",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_confirmacion_birads45_denominador"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "numerator"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Numerador",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_confirmacion_birads45_numerador"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subjectCodeableConcept": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/unidad",
|
||||||
|
"code": "episodio"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"improvementNotation": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation",
|
||||||
|
"code": "increase"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"mode": "match"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "http://127.0.0.1:28091/cama/fhir/Measure/CAMA-DIAS-TOMA-DIAGNOSTICO",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Measure",
|
||||||
|
"id": "CAMA-DIAS-TOMA-DIAGNOSTICO",
|
||||||
|
"url": "https://isssteleon.org/fhir/Measure/CAMA-DIAS-TOMA-DIAGNOSTICO",
|
||||||
|
"version": "0.2.2",
|
||||||
|
"name": "cama_dias_toma_diagnostico",
|
||||||
|
"title": "Tiempo de tamizaje a diagnóstico",
|
||||||
|
"status": "active",
|
||||||
|
"description": "Días naturales de la toma de cada mastografía del semestre a la primera nota médica posterior que la resuelve: un diagnóstico CIE-10 de la lista (normal, benigno, lesión o cáncer), escrito por una de las especialidades que diagnostican, dentro del horizonte y a la fecha de corte. Entran todas las mastografías, sean de tamizaje o no; se excluyen las de pacientes con un diagnóstico de cáncer de mama anterior a la toma.",
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/contrato",
|
||||||
|
"valueCode": "C3r"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "semestre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "mes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scoring": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
|
||||||
|
"code": "continuous-variable"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida",
|
||||||
|
"code": "TOTAL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"population": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "initial-population"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades del periodo",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_dias_toma_diagnostico"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "measure-observation"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades con valor",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_dias_toma_diagnostico"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "measure-population-exclusion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades sin valor",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_dias_toma_diagnostico"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subjectCodeableConcept": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/unidad",
|
||||||
|
"code": "examen"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"improvementNotation": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation",
|
||||||
|
"code": "decrease"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"mode": "match"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "http://127.0.0.1:28091/cama/fhir/Measure/CAMA-EU38A",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Measure",
|
||||||
|
"id": "CAMA-EU38A",
|
||||||
|
"url": "https://isssteleon.org/fhir/Measure/CAMA-EU38A",
|
||||||
|
"version": "0.2.1",
|
||||||
|
"name": "cama_eu38a",
|
||||||
|
"title": "Días de la toma de la mastografía a su resultado",
|
||||||
|
"status": "active",
|
||||||
|
"description": "Días naturales de la toma de cada mastografía del semestre a su resultado, a la fecha de corte. Las que aún no tienen resultado y siguen dentro del horizonte no se miden; las que lo pasaron sin resultado cuentan en los excluidos.",
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/contrato",
|
||||||
|
"valueCode": "C3r"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "semestre"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo",
|
||||||
|
"valueCode": "mes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scoring": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
|
||||||
|
"code": "continuous-variable"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida",
|
||||||
|
"code": "TOTAL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"population": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "initial-population"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades del periodo",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_eu38a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "measure-observation"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades con valor",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_eu38a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-population",
|
||||||
|
"code": "measure-population-exclusion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Unidades sin valor",
|
||||||
|
"criteria": {
|
||||||
|
"language": "text/x-dbt-metric",
|
||||||
|
"expression": "cama_eu38a"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subjectCodeableConcept": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/unidad",
|
||||||
|
"code": "examen"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"improvementNotation": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation",
|
||||||
|
"code": "decrease"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"mode": "match"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,477 @@
|
|||||||
|
{
|
||||||
|
"id": "cama_histopatologia_birads",
|
||||||
|
"titulo": "Histopatología por BI-RADS",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contrato": "C2",
|
||||||
|
"unidad": "paciente",
|
||||||
|
"tipo_periodo": "semestre",
|
||||||
|
"periodos": [
|
||||||
|
"2025-S1"
|
||||||
|
],
|
||||||
|
"estrato": "birads",
|
||||||
|
"valores_estrato": [
|
||||||
|
"BIRADS_4",
|
||||||
|
"BIRADS_4A",
|
||||||
|
"BIRADS_4B",
|
||||||
|
"BIRADS_4C",
|
||||||
|
"BIRADS_5",
|
||||||
|
"BIRADS_6"
|
||||||
|
],
|
||||||
|
"etiquetas_estrato": {
|
||||||
|
"BIRADS_4": "BI-RADS 4 sin subtipo",
|
||||||
|
"BIRADS_4A": "BI-RADS 4A",
|
||||||
|
"BIRADS_4B": "BI-RADS 4B",
|
||||||
|
"BIRADS_4C": "BI-RADS 4C",
|
||||||
|
"BIRADS_5": "BI-RADS 5",
|
||||||
|
"BIRADS_6": "BI-RADS 6"
|
||||||
|
},
|
||||||
|
"grupos": {
|
||||||
|
"TOTAL": "Total"
|
||||||
|
},
|
||||||
|
"categorias": {
|
||||||
|
"BENIGNO": {
|
||||||
|
"etiqueta": "Benigno",
|
||||||
|
"color": "#9DBFE3",
|
||||||
|
"grupo": "NO_MALIGNO",
|
||||||
|
"gravedad": 1
|
||||||
|
},
|
||||||
|
"RIESGO_B3": {
|
||||||
|
"etiqueta": "Lesión de riesgo (B3)",
|
||||||
|
"color": "#2F6DB3",
|
||||||
|
"grupo": "NO_MALIGNO",
|
||||||
|
"gravedad": 2
|
||||||
|
},
|
||||||
|
"IN_SITU": {
|
||||||
|
"etiqueta": "Carcinoma in situ",
|
||||||
|
"color": "#D9822B",
|
||||||
|
"grupo": "MALIGNO",
|
||||||
|
"gravedad": 3
|
||||||
|
},
|
||||||
|
"INVASOR": {
|
||||||
|
"etiqueta": "Carcinoma invasor",
|
||||||
|
"color": "#B5482E",
|
||||||
|
"grupo": "MALIGNO",
|
||||||
|
"gravedad": 4
|
||||||
|
},
|
||||||
|
"SIN_BIOPSIA": {
|
||||||
|
"etiqueta": "Sin biopsia reportada",
|
||||||
|
"color": "#C9CDD2",
|
||||||
|
"grupo": null,
|
||||||
|
"gravedad": null
|
||||||
|
},
|
||||||
|
"SIN_DATO": {
|
||||||
|
"etiqueta": "Sin dato",
|
||||||
|
"color": "#C9CDD2",
|
||||||
|
"grupo": "SIN_DATO",
|
||||||
|
"gravedad": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"grupos_de_categoria": {
|
||||||
|
"NO_MALIGNO": "No maligno",
|
||||||
|
"MALIGNO": "Maligno",
|
||||||
|
"SIN_DATO": "Sin dato"
|
||||||
|
},
|
||||||
|
"notas": [
|
||||||
|
"Convención provisional; BI-RADS 4 sin subtipo es una fila propia. Sin biopsia y sin dato quedan fuera del denominador con resultado."
|
||||||
|
],
|
||||||
|
"reportes": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"report_id": 141,
|
||||||
|
"periodo_inicio": "2025-01-01",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"fecha_corte": "2025-12-31",
|
||||||
|
"generado_en": "2026-11-12T16:33:37.621606+00:00",
|
||||||
|
"kit_version": "0.8.0",
|
||||||
|
"toml_sha": "9349fdd093c85bfe9adc86b91ea5350a03be829825645b51ab87a35fccc5d42d",
|
||||||
|
"parametros_sha": "75706ce35dbdd4440f22f71220400666e6a14eeb2922353960c1d66878bbf6fe",
|
||||||
|
"parametros": {
|
||||||
|
"sql": {
|
||||||
|
"_catalogo": [
|
||||||
|
"BENIGNO",
|
||||||
|
"RIESGO_B3",
|
||||||
|
"IN_SITU",
|
||||||
|
"INVASOR"
|
||||||
|
],
|
||||||
|
"_grupos": [
|
||||||
|
"TOTAL"
|
||||||
|
],
|
||||||
|
"fecha_corte": "2025-12-31",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"periodo_inicio": "2025-01-01"
|
||||||
|
},
|
||||||
|
"umbral_supresion": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filas": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4",
|
||||||
|
"categoria": "BENIGNO",
|
||||||
|
"n": 2,
|
||||||
|
"orden": 0,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4",
|
||||||
|
"categoria": "RIESGO_B3",
|
||||||
|
"n": 0,
|
||||||
|
"orden": 1,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4",
|
||||||
|
"categoria": "IN_SITU",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 2,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4",
|
||||||
|
"categoria": "INVASOR",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 3,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4",
|
||||||
|
"categoria": "SIN_BIOPSIA",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 4,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4",
|
||||||
|
"categoria": "SIN_DATO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 5,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4A",
|
||||||
|
"categoria": "BENIGNO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 0,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4A",
|
||||||
|
"categoria": "RIESGO_B3",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 1,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4A",
|
||||||
|
"categoria": "IN_SITU",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 2,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4A",
|
||||||
|
"categoria": "INVASOR",
|
||||||
|
"n": 2,
|
||||||
|
"orden": 3,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4A",
|
||||||
|
"categoria": "SIN_BIOPSIA",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 4,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4A",
|
||||||
|
"categoria": "SIN_DATO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 5,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4B",
|
||||||
|
"categoria": "BENIGNO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 0,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4B",
|
||||||
|
"categoria": "RIESGO_B3",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 1,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4B",
|
||||||
|
"categoria": "IN_SITU",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 2,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4B",
|
||||||
|
"categoria": "INVASOR",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 3,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4B",
|
||||||
|
"categoria": "SIN_BIOPSIA",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 4,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4B",
|
||||||
|
"categoria": "SIN_DATO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 5,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4C",
|
||||||
|
"categoria": "BENIGNO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 0,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4C",
|
||||||
|
"categoria": "RIESGO_B3",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 1,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4C",
|
||||||
|
"categoria": "IN_SITU",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 2,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4C",
|
||||||
|
"categoria": "INVASOR",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 3,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4C",
|
||||||
|
"categoria": "SIN_BIOPSIA",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 4,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4C",
|
||||||
|
"categoria": "SIN_DATO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 5,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_5",
|
||||||
|
"categoria": "BENIGNO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 0,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_5",
|
||||||
|
"categoria": "RIESGO_B3",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 1,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_5",
|
||||||
|
"categoria": "IN_SITU",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 2,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_5",
|
||||||
|
"categoria": "INVASOR",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 3,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_5",
|
||||||
|
"categoria": "SIN_BIOPSIA",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 4,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_5",
|
||||||
|
"categoria": "SIN_DATO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 5,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_6",
|
||||||
|
"categoria": "BENIGNO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 0,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_6",
|
||||||
|
"categoria": "RIESGO_B3",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 1,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_6",
|
||||||
|
"categoria": "IN_SITU",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 2,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_6",
|
||||||
|
"categoria": "INVASOR",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 3,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_6",
|
||||||
|
"categoria": "SIN_BIOPSIA",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 4,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_6",
|
||||||
|
"categoria": "SIN_DATO",
|
||||||
|
"n": 1,
|
||||||
|
"orden": 5,
|
||||||
|
"suprimido": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totales_estrato": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4",
|
||||||
|
"n": 6,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4A",
|
||||||
|
"n": 7,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4B",
|
||||||
|
"n": 6,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_4C",
|
||||||
|
"n": 6,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_5",
|
||||||
|
"n": 6,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": "BIRADS_6",
|
||||||
|
"n": 6,
|
||||||
|
"suprimido": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
{
|
||||||
|
"id": "cama_histopatologia_birads",
|
||||||
|
"titulo": "Histopatología por BI-RADS",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contrato": "C2",
|
||||||
|
"unidad": "paciente",
|
||||||
|
"tipo_periodo": "semestre",
|
||||||
|
"periodos": [
|
||||||
|
"2025-S1"
|
||||||
|
],
|
||||||
|
"estrato": null,
|
||||||
|
"valores_estrato": [],
|
||||||
|
"etiquetas_estrato": {},
|
||||||
|
"grupos": {
|
||||||
|
"TOTAL": "Total"
|
||||||
|
},
|
||||||
|
"categorias": {
|
||||||
|
"BENIGNO": {
|
||||||
|
"etiqueta": "Benigno",
|
||||||
|
"color": "#9DBFE3",
|
||||||
|
"grupo": "NO_MALIGNO",
|
||||||
|
"gravedad": 1
|
||||||
|
},
|
||||||
|
"RIESGO_B3": {
|
||||||
|
"etiqueta": "Lesión de riesgo (B3)",
|
||||||
|
"color": "#2F6DB3",
|
||||||
|
"grupo": "NO_MALIGNO",
|
||||||
|
"gravedad": 2
|
||||||
|
},
|
||||||
|
"IN_SITU": {
|
||||||
|
"etiqueta": "Carcinoma in situ",
|
||||||
|
"color": "#D9822B",
|
||||||
|
"grupo": "MALIGNO",
|
||||||
|
"gravedad": 3
|
||||||
|
},
|
||||||
|
"INVASOR": {
|
||||||
|
"etiqueta": "Carcinoma invasor",
|
||||||
|
"color": "#B5482E",
|
||||||
|
"grupo": "MALIGNO",
|
||||||
|
"gravedad": 4
|
||||||
|
},
|
||||||
|
"SIN_BIOPSIA": {
|
||||||
|
"etiqueta": "Sin biopsia reportada",
|
||||||
|
"color": "#C9CDD2",
|
||||||
|
"grupo": null,
|
||||||
|
"gravedad": null
|
||||||
|
},
|
||||||
|
"SIN_DATO": {
|
||||||
|
"etiqueta": "Sin dato",
|
||||||
|
"color": "#C9CDD2",
|
||||||
|
"grupo": "SIN_DATO",
|
||||||
|
"gravedad": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"grupos_de_categoria": {
|
||||||
|
"NO_MALIGNO": "No maligno",
|
||||||
|
"MALIGNO": "Maligno",
|
||||||
|
"SIN_DATO": "Sin dato"
|
||||||
|
},
|
||||||
|
"notas": [
|
||||||
|
"Convención provisional; BI-RADS 4 sin subtipo es una fila propia. Sin biopsia y sin dato quedan fuera del denominador con resultado."
|
||||||
|
],
|
||||||
|
"reportes": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"report_id": 141,
|
||||||
|
"periodo_inicio": "2025-01-01",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"fecha_corte": "2025-12-31",
|
||||||
|
"generado_en": "2026-11-12T16:33:37.621606+00:00",
|
||||||
|
"kit_version": "0.8.0",
|
||||||
|
"toml_sha": "9349fdd093c85bfe9adc86b91ea5350a03be829825645b51ab87a35fccc5d42d",
|
||||||
|
"parametros_sha": "75706ce35dbdd4440f22f71220400666e6a14eeb2922353960c1d66878bbf6fe",
|
||||||
|
"parametros": {
|
||||||
|
"sql": {
|
||||||
|
"_catalogo": [
|
||||||
|
"BENIGNO",
|
||||||
|
"RIESGO_B3",
|
||||||
|
"IN_SITU",
|
||||||
|
"INVASOR"
|
||||||
|
],
|
||||||
|
"_grupos": [
|
||||||
|
"TOTAL"
|
||||||
|
],
|
||||||
|
"fecha_corte": "2025-12-31",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"periodo_inicio": "2025-01-01"
|
||||||
|
},
|
||||||
|
"umbral_supresion": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filas": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": null,
|
||||||
|
"categoria": "BENIGNO",
|
||||||
|
"n": 7,
|
||||||
|
"orden": 0,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": null,
|
||||||
|
"categoria": "RIESGO_B3",
|
||||||
|
"n": 5,
|
||||||
|
"orden": 1,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": null,
|
||||||
|
"categoria": "IN_SITU",
|
||||||
|
"n": 6,
|
||||||
|
"orden": 2,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": null,
|
||||||
|
"categoria": "INVASOR",
|
||||||
|
"n": 7,
|
||||||
|
"orden": 3,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": null,
|
||||||
|
"categoria": "SIN_BIOPSIA",
|
||||||
|
"n": 6,
|
||||||
|
"orden": 4,
|
||||||
|
"suprimido": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "TOTAL",
|
||||||
|
"estrato": null,
|
||||||
|
"categoria": "SIN_DATO",
|
||||||
|
"n": 6,
|
||||||
|
"orden": 5,
|
||||||
|
"suprimido": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totales_estrato": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
{
|
||||||
|
"campo_ventana": "mastografia_fecha",
|
||||||
|
"columnas": [
|
||||||
|
{
|
||||||
|
"clave": "id_seudonimo",
|
||||||
|
"etiqueta": "Identificador seudónimo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "grupo_edad",
|
||||||
|
"etiqueta": "Grupo de edad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "estatus",
|
||||||
|
"etiqueta": "Estatus de seguimiento"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "birads",
|
||||||
|
"detalles": [
|
||||||
|
{
|
||||||
|
"clave": "mastografia_fecha",
|
||||||
|
"etiqueta": "Fecha"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"etiqueta": "Última mastografía"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "biopsia",
|
||||||
|
"detalles": [
|
||||||
|
{
|
||||||
|
"clave": "biopsia_fecha",
|
||||||
|
"etiqueta": "Fecha de biopsia"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"etiqueta": "Resultado histopatológico"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "dias_mastografia_diagnostico",
|
||||||
|
"etiqueta": "Días de mastografía a diagnóstico"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "prioridad",
|
||||||
|
"etiqueta": "Prioridad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"corte": "2026-10-20",
|
||||||
|
"filtros": {
|
||||||
|
"birads": null,
|
||||||
|
"estatus": null,
|
||||||
|
"grupo_edad": null,
|
||||||
|
"prioridad": null
|
||||||
|
},
|
||||||
|
"filtros_disponibles": [
|
||||||
|
{
|
||||||
|
"clave": "estatus",
|
||||||
|
"etiqueta": "Estatus de seguimiento",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "PENDIENTE_BIOPSIA",
|
||||||
|
"etiqueta": "Pendiente de biopsia"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIOPSIA_SIN_RESULTADO",
|
||||||
|
"etiqueta": "Biopsia sin resultado"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "CANCER_CONFIRMADO",
|
||||||
|
"etiqueta": "Cáncer confirmado"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BENIGNO",
|
||||||
|
"etiqueta": "Benigno, regresa a tamizaje"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "INFO_INSUFICIENTE",
|
||||||
|
"etiqueta": "Información insuficiente"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "birads",
|
||||||
|
"etiqueta": "Categoría BI-RADS",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_4A",
|
||||||
|
"etiqueta": "BI-RADS 4A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_4B",
|
||||||
|
"etiqueta": "BI-RADS 4B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_4C",
|
||||||
|
"etiqueta": "BI-RADS 4C"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_5",
|
||||||
|
"etiqueta": "BI-RADS 5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_6",
|
||||||
|
"etiqueta": "BI-RADS 6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "grupo_edad",
|
||||||
|
"etiqueta": "Grupo de edad",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "40-49",
|
||||||
|
"etiqueta": "40-49"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "50-59",
|
||||||
|
"etiqueta": "50-59"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "60-69",
|
||||||
|
"etiqueta": "60-69"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "70+",
|
||||||
|
"etiqueta": "70+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "prioridad",
|
||||||
|
"etiqueta": "Prioridad",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "ALTA",
|
||||||
|
"etiqueta": "Alta"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "MEDIA",
|
||||||
|
"etiqueta": "Media"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BAJA",
|
||||||
|
"etiqueta": "Baja"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"birads": "BI-RADS 5",
|
||||||
|
"birads_codigo": "BIRADS_5",
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"estatus": "Pendiente de biopsia",
|
||||||
|
"estatus_codigo": "PENDIENTE_BIOPSIA",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"id_seudonimo": "M-0001",
|
||||||
|
"mastografia_fecha": "2026-10-15",
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": "2026-10-18",
|
||||||
|
"birads": "BI-RADS 4A",
|
||||||
|
"birads_codigo": "BIRADS_4A",
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"estatus": "Biopsia sin resultado",
|
||||||
|
"estatus_codigo": "BIOPSIA_SIN_RESULTADO",
|
||||||
|
"grupo_edad": "40-49",
|
||||||
|
"grupo_edad_codigo": "40-49",
|
||||||
|
"id_seudonimo": "M-0002",
|
||||||
|
"mastografia_fecha": "2026-10-15",
|
||||||
|
"prioridad": "Media",
|
||||||
|
"prioridad_codigo": "MEDIA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"biopsia": "Benigno",
|
||||||
|
"biopsia_fecha": "2026-09-10",
|
||||||
|
"birads": "BI-RADS 4B",
|
||||||
|
"birads_codigo": "BIRADS_4B",
|
||||||
|
"dias_mastografia_diagnostico": 16,
|
||||||
|
"estatus": "Benigno, regresa a tamizaje",
|
||||||
|
"estatus_codigo": "BENIGNO",
|
||||||
|
"grupo_edad": "60-69",
|
||||||
|
"grupo_edad_codigo": "60-69",
|
||||||
|
"id_seudonimo": "M-0003",
|
||||||
|
"mastografia_fecha": "2026-09-01",
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"biopsia": "Carcinoma invasor",
|
||||||
|
"biopsia_fecha": "2026-08-22",
|
||||||
|
"birads": "BI-RADS 4C",
|
||||||
|
"birads_codigo": "BIRADS_4C",
|
||||||
|
"dias_mastografia_diagnostico": 20,
|
||||||
|
"estatus": "Cáncer confirmado",
|
||||||
|
"estatus_codigo": "CANCER_CONFIRMADO",
|
||||||
|
"grupo_edad": "70+",
|
||||||
|
"grupo_edad_codigo": "70+",
|
||||||
|
"id_seudonimo": "M-0004",
|
||||||
|
"mastografia_fecha": "2026-08-15",
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"birads": "BI-RADS 6",
|
||||||
|
"birads_codigo": "BIRADS_6",
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"estatus": "Información insuficiente",
|
||||||
|
"estatus_codigo": "INFO_INSUFICIENTE",
|
||||||
|
"grupo_edad": "40-49",
|
||||||
|
"grupo_edad_codigo": "40-49",
|
||||||
|
"id_seudonimo": "M-0005",
|
||||||
|
"mastografia_fecha": "2026-07-21",
|
||||||
|
"prioridad": "Media",
|
||||||
|
"prioridad_codigo": "MEDIA"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paginacion": {
|
||||||
|
"page": 1,
|
||||||
|
"page_size": 50,
|
||||||
|
"total_items": 5,
|
||||||
|
"total_pages": 1
|
||||||
|
},
|
||||||
|
"simulado": true,
|
||||||
|
"ventana": {
|
||||||
|
"desde": "2026-07-21",
|
||||||
|
"hasta": "2026-10-20",
|
||||||
|
"meses": 3
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
{
|
||||||
|
"campo_ventana": "mastografia_fecha",
|
||||||
|
"columnas": [
|
||||||
|
{
|
||||||
|
"clave": "id_seudonimo",
|
||||||
|
"etiqueta": "Identificador seudónimo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "grupo_edad",
|
||||||
|
"etiqueta": "Grupo de edad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "estatus",
|
||||||
|
"etiqueta": "Estatus de seguimiento"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "birads",
|
||||||
|
"detalles": [
|
||||||
|
{
|
||||||
|
"clave": "mastografia_fecha",
|
||||||
|
"etiqueta": "Fecha"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"etiqueta": "Última mastografía"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "biopsia",
|
||||||
|
"detalles": [
|
||||||
|
{
|
||||||
|
"clave": "biopsia_fecha",
|
||||||
|
"etiqueta": "Fecha de biopsia"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"etiqueta": "Resultado histopatológico"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "dias_mastografia_diagnostico",
|
||||||
|
"etiqueta": "Días de mastografía a diagnóstico"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "prioridad",
|
||||||
|
"etiqueta": "Prioridad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"corte": "2026-10-20",
|
||||||
|
"filtros": {
|
||||||
|
"birads": null,
|
||||||
|
"estatus": null,
|
||||||
|
"grupo_edad": null,
|
||||||
|
"prioridad": "ALTA"
|
||||||
|
},
|
||||||
|
"filtros_disponibles": [
|
||||||
|
{
|
||||||
|
"clave": "estatus",
|
||||||
|
"etiqueta": "Estatus de seguimiento",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "PENDIENTE_BIOPSIA",
|
||||||
|
"etiqueta": "Pendiente de biopsia"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIOPSIA_SIN_RESULTADO",
|
||||||
|
"etiqueta": "Biopsia sin resultado"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "CANCER_CONFIRMADO",
|
||||||
|
"etiqueta": "Cáncer confirmado"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BENIGNO",
|
||||||
|
"etiqueta": "Benigno, regresa a tamizaje"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "INFO_INSUFICIENTE",
|
||||||
|
"etiqueta": "Información insuficiente"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "birads",
|
||||||
|
"etiqueta": "Categoría BI-RADS",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_4A",
|
||||||
|
"etiqueta": "BI-RADS 4A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_4B",
|
||||||
|
"etiqueta": "BI-RADS 4B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_4C",
|
||||||
|
"etiqueta": "BI-RADS 4C"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_5",
|
||||||
|
"etiqueta": "BI-RADS 5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_6",
|
||||||
|
"etiqueta": "BI-RADS 6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "grupo_edad",
|
||||||
|
"etiqueta": "Grupo de edad",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "40-49",
|
||||||
|
"etiqueta": "40-49"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "50-59",
|
||||||
|
"etiqueta": "50-59"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "60-69",
|
||||||
|
"etiqueta": "60-69"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "70+",
|
||||||
|
"etiqueta": "70+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "prioridad",
|
||||||
|
"etiqueta": "Prioridad",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "ALTA",
|
||||||
|
"etiqueta": "Alta"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "MEDIA",
|
||||||
|
"etiqueta": "Media"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BAJA",
|
||||||
|
"etiqueta": "Baja"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"items": [],
|
||||||
|
"paginacion": {
|
||||||
|
"page": 4,
|
||||||
|
"page_size": 1,
|
||||||
|
"total_items": 3,
|
||||||
|
"total_pages": 3
|
||||||
|
},
|
||||||
|
"simulado": true,
|
||||||
|
"ventana": {
|
||||||
|
"desde": "2025-10-21",
|
||||||
|
"hasta": "2026-10-20",
|
||||||
|
"meses": 12
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,565 @@
|
|||||||
|
{
|
||||||
|
"simulado": true,
|
||||||
|
"corte": "2026-10-20",
|
||||||
|
"ventana": {
|
||||||
|
"meses": 3,
|
||||||
|
"desde": "2026-07-21",
|
||||||
|
"hasta": "2026-10-20"
|
||||||
|
},
|
||||||
|
"campo_ventana": "mastografia_fecha",
|
||||||
|
"filtros": {
|
||||||
|
"estatus": null,
|
||||||
|
"birads": null,
|
||||||
|
"grupo_edad": null,
|
||||||
|
"prioridad": null
|
||||||
|
},
|
||||||
|
"filtros_disponibles": [
|
||||||
|
{
|
||||||
|
"clave": "estatus",
|
||||||
|
"etiqueta": "Estatus de seguimiento",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "PENDIENTE_BIOPSIA",
|
||||||
|
"etiqueta": "Pendiente de biopsia"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIOPSIA_SIN_RESULTADO",
|
||||||
|
"etiqueta": "Biopsia sin resultado"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "CANCER_CONFIRMADO",
|
||||||
|
"etiqueta": "Cáncer confirmado"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BENIGNO",
|
||||||
|
"etiqueta": "Benigno, regresa a tamizaje"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "INFO_INSUFICIENTE",
|
||||||
|
"etiqueta": "Información insuficiente"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "birads",
|
||||||
|
"etiqueta": "Categoría BI-RADS",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_4A",
|
||||||
|
"etiqueta": "BI-RADS 4A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_4B",
|
||||||
|
"etiqueta": "BI-RADS 4B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_4C",
|
||||||
|
"etiqueta": "BI-RADS 4C"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_5",
|
||||||
|
"etiqueta": "BI-RADS 5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BIRADS_6",
|
||||||
|
"etiqueta": "BI-RADS 6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "grupo_edad",
|
||||||
|
"etiqueta": "Grupo de edad",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "40-49",
|
||||||
|
"etiqueta": "40-49"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "50-59",
|
||||||
|
"etiqueta": "50-59"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "60-69",
|
||||||
|
"etiqueta": "60-69"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "70+",
|
||||||
|
"etiqueta": "70+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "prioridad",
|
||||||
|
"etiqueta": "Prioridad",
|
||||||
|
"opciones": [
|
||||||
|
{
|
||||||
|
"codigo": "ALTA",
|
||||||
|
"etiqueta": "Alta"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "MEDIA",
|
||||||
|
"etiqueta": "Media"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"codigo": "BAJA",
|
||||||
|
"etiqueta": "Baja"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"columnas": [
|
||||||
|
{
|
||||||
|
"clave": "id_seudonimo",
|
||||||
|
"etiqueta": "Identificador seudónimo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "grupo_edad",
|
||||||
|
"etiqueta": "Grupo de edad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "estatus",
|
||||||
|
"etiqueta": "Estatus de seguimiento"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "birads",
|
||||||
|
"etiqueta": "Última mastografía",
|
||||||
|
"detalles": [
|
||||||
|
{
|
||||||
|
"clave": "mastografia_fecha",
|
||||||
|
"etiqueta": "Fecha"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "biopsia",
|
||||||
|
"etiqueta": "Resultado histopatológico",
|
||||||
|
"detalles": [
|
||||||
|
{
|
||||||
|
"clave": "biopsia_fecha",
|
||||||
|
"etiqueta": "Fecha de biopsia"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "dias_mastografia_diagnostico",
|
||||||
|
"etiqueta": "Días de mastografía a diagnóstico"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clave": "prioridad",
|
||||||
|
"etiqueta": "Prioridad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paginacion": {
|
||||||
|
"page": 1,
|
||||||
|
"page_size": 50,
|
||||||
|
"total_items": 27,
|
||||||
|
"total_pages": 1
|
||||||
|
},
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0081",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Pendiente de biopsia",
|
||||||
|
"estatus_codigo": "PENDIENTE_BIOPSIA",
|
||||||
|
"birads": "BI-RADS 4A",
|
||||||
|
"birads_codigo": "BIRADS_4A",
|
||||||
|
"mastografia_fecha": "2026-07-25",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0020",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Información insuficiente",
|
||||||
|
"estatus_codigo": "INFO_INSUFICIENTE",
|
||||||
|
"birads": "BI-RADS 4C",
|
||||||
|
"birads_codigo": "BIRADS_4C",
|
||||||
|
"mastografia_fecha": "2026-07-31",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0051",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Pendiente de biopsia",
|
||||||
|
"estatus_codigo": "PENDIENTE_BIOPSIA",
|
||||||
|
"birads": "BI-RADS 5",
|
||||||
|
"birads_codigo": "BIRADS_5",
|
||||||
|
"mastografia_fecha": "2026-08-01",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0022",
|
||||||
|
"grupo_edad": "60-69",
|
||||||
|
"grupo_edad_codigo": "60-69",
|
||||||
|
"estatus": "Pendiente de biopsia",
|
||||||
|
"estatus_codigo": "PENDIENTE_BIOPSIA",
|
||||||
|
"birads": "BI-RADS 6",
|
||||||
|
"birads_codigo": "BIRADS_6",
|
||||||
|
"mastografia_fecha": "2026-08-03",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0029",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Biopsia sin resultado",
|
||||||
|
"estatus_codigo": "BIOPSIA_SIN_RESULTADO",
|
||||||
|
"birads": "BI-RADS 4C",
|
||||||
|
"birads_codigo": "BIRADS_4C",
|
||||||
|
"mastografia_fecha": "2026-08-13",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": "2026-09-11",
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0019",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Pendiente de biopsia",
|
||||||
|
"estatus_codigo": "PENDIENTE_BIOPSIA",
|
||||||
|
"birads": "BI-RADS 4C",
|
||||||
|
"birads_codigo": "BIRADS_4C",
|
||||||
|
"mastografia_fecha": "2026-08-21",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0064",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Información insuficiente",
|
||||||
|
"estatus_codigo": "INFO_INSUFICIENTE",
|
||||||
|
"birads": "BI-RADS 5",
|
||||||
|
"birads_codigo": "BIRADS_5",
|
||||||
|
"mastografia_fecha": "2026-08-22",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0048",
|
||||||
|
"grupo_edad": "60-69",
|
||||||
|
"grupo_edad_codigo": "60-69",
|
||||||
|
"estatus": "Biopsia sin resultado",
|
||||||
|
"estatus_codigo": "BIOPSIA_SIN_RESULTADO",
|
||||||
|
"birads": "BI-RADS 4C",
|
||||||
|
"birads_codigo": "BIRADS_4C",
|
||||||
|
"mastografia_fecha": "2026-09-01",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": "2026-10-07",
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0059",
|
||||||
|
"grupo_edad": "40-49",
|
||||||
|
"grupo_edad_codigo": "40-49",
|
||||||
|
"estatus": "Pendiente de biopsia",
|
||||||
|
"estatus_codigo": "PENDIENTE_BIOPSIA",
|
||||||
|
"birads": "BI-RADS 4C",
|
||||||
|
"birads_codigo": "BIRADS_4C",
|
||||||
|
"mastografia_fecha": "2026-09-05",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0050",
|
||||||
|
"grupo_edad": "60-69",
|
||||||
|
"grupo_edad_codigo": "60-69",
|
||||||
|
"estatus": "Información insuficiente",
|
||||||
|
"estatus_codigo": "INFO_INSUFICIENTE",
|
||||||
|
"birads": "BI-RADS 5",
|
||||||
|
"birads_codigo": "BIRADS_5",
|
||||||
|
"mastografia_fecha": "2026-09-06",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0084",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Biopsia sin resultado",
|
||||||
|
"estatus_codigo": "BIOPSIA_SIN_RESULTADO",
|
||||||
|
"birads": "BI-RADS 4C",
|
||||||
|
"birads_codigo": "BIRADS_4C",
|
||||||
|
"mastografia_fecha": "2026-09-08",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": "2026-09-18",
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0054",
|
||||||
|
"grupo_edad": "60-69",
|
||||||
|
"grupo_edad_codigo": "60-69",
|
||||||
|
"estatus": "Pendiente de biopsia",
|
||||||
|
"estatus_codigo": "PENDIENTE_BIOPSIA",
|
||||||
|
"birads": "BI-RADS 4C",
|
||||||
|
"birads_codigo": "BIRADS_4C",
|
||||||
|
"mastografia_fecha": "2026-10-04",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Alta",
|
||||||
|
"prioridad_codigo": "ALTA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0035",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Biopsia sin resultado",
|
||||||
|
"estatus_codigo": "BIOPSIA_SIN_RESULTADO",
|
||||||
|
"birads": "BI-RADS 4B",
|
||||||
|
"birads_codigo": "BIRADS_4B",
|
||||||
|
"mastografia_fecha": "2026-08-21",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": "2026-08-31",
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Media",
|
||||||
|
"prioridad_codigo": "MEDIA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0052",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Información insuficiente",
|
||||||
|
"estatus_codigo": "INFO_INSUFICIENTE",
|
||||||
|
"birads": "BI-RADS 4A",
|
||||||
|
"birads_codigo": "BIRADS_4A",
|
||||||
|
"mastografia_fecha": "2026-10-01",
|
||||||
|
"biopsia": null,
|
||||||
|
"biopsia_fecha": null,
|
||||||
|
"dias_mastografia_diagnostico": null,
|
||||||
|
"prioridad": "Media",
|
||||||
|
"prioridad_codigo": "MEDIA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0033",
|
||||||
|
"grupo_edad": "40-49",
|
||||||
|
"grupo_edad_codigo": "40-49",
|
||||||
|
"estatus": "Cáncer confirmado",
|
||||||
|
"estatus_codigo": "CANCER_CONFIRMADO",
|
||||||
|
"birads": "BI-RADS 5",
|
||||||
|
"birads_codigo": "BIRADS_5",
|
||||||
|
"mastografia_fecha": "2026-07-25",
|
||||||
|
"biopsia": "Carcinoma invasor",
|
||||||
|
"biopsia_fecha": "2026-09-03",
|
||||||
|
"dias_mastografia_diagnostico": 15,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0040",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Benigno, regresa a tamizaje",
|
||||||
|
"estatus_codigo": "BENIGNO",
|
||||||
|
"birads": "BI-RADS 4A",
|
||||||
|
"birads_codigo": "BIRADS_4A",
|
||||||
|
"mastografia_fecha": "2026-07-25",
|
||||||
|
"biopsia": "Benigno",
|
||||||
|
"biopsia_fecha": "2026-08-16",
|
||||||
|
"dias_mastografia_diagnostico": 71,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0011",
|
||||||
|
"grupo_edad": "40-49",
|
||||||
|
"grupo_edad_codigo": "40-49",
|
||||||
|
"estatus": "Benigno, regresa a tamizaje",
|
||||||
|
"estatus_codigo": "BENIGNO",
|
||||||
|
"birads": "BI-RADS 4B",
|
||||||
|
"birads_codigo": "BIRADS_4B",
|
||||||
|
"mastografia_fecha": "2026-08-08",
|
||||||
|
"biopsia": "Benigno",
|
||||||
|
"biopsia_fecha": "2026-08-16",
|
||||||
|
"dias_mastografia_diagnostico": 46,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0047",
|
||||||
|
"grupo_edad": "60-69",
|
||||||
|
"grupo_edad_codigo": "60-69",
|
||||||
|
"estatus": "Cáncer confirmado",
|
||||||
|
"estatus_codigo": "CANCER_CONFIRMADO",
|
||||||
|
"birads": "BI-RADS 5",
|
||||||
|
"birads_codigo": "BIRADS_5",
|
||||||
|
"mastografia_fecha": "2026-08-28",
|
||||||
|
"biopsia": "Carcinoma invasor",
|
||||||
|
"biopsia_fecha": "2026-09-28",
|
||||||
|
"dias_mastografia_diagnostico": 36,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0038",
|
||||||
|
"grupo_edad": "60-69",
|
||||||
|
"grupo_edad_codigo": "60-69",
|
||||||
|
"estatus": "Cáncer confirmado",
|
||||||
|
"estatus_codigo": "CANCER_CONFIRMADO",
|
||||||
|
"birads": "BI-RADS 4A",
|
||||||
|
"birads_codigo": "BIRADS_4A",
|
||||||
|
"mastografia_fecha": "2026-08-29",
|
||||||
|
"biopsia": "Carcinoma invasor",
|
||||||
|
"biopsia_fecha": "2026-10-08",
|
||||||
|
"dias_mastografia_diagnostico": 42,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0072",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Benigno, regresa a tamizaje",
|
||||||
|
"estatus_codigo": "BENIGNO",
|
||||||
|
"birads": "BI-RADS 4A",
|
||||||
|
"birads_codigo": "BIRADS_4A",
|
||||||
|
"mastografia_fecha": "2026-09-03",
|
||||||
|
"biopsia": "Benigno",
|
||||||
|
"biopsia_fecha": "2026-09-26",
|
||||||
|
"dias_mastografia_diagnostico": 49,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0021",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Cáncer confirmado",
|
||||||
|
"estatus_codigo": "CANCER_CONFIRMADO",
|
||||||
|
"birads": "BI-RADS 5",
|
||||||
|
"birads_codigo": "BIRADS_5",
|
||||||
|
"mastografia_fecha": "2026-09-07",
|
||||||
|
"biopsia": "Carcinoma invasor",
|
||||||
|
"biopsia_fecha": "2026-09-27",
|
||||||
|
"dias_mastografia_diagnostico": 56,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0039",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Benigno, regresa a tamizaje",
|
||||||
|
"estatus_codigo": "BENIGNO",
|
||||||
|
"birads": "BI-RADS 4C",
|
||||||
|
"birads_codigo": "BIRADS_4C",
|
||||||
|
"mastografia_fecha": "2026-09-08",
|
||||||
|
"biopsia": "Benigno",
|
||||||
|
"biopsia_fecha": "2026-09-17",
|
||||||
|
"dias_mastografia_diagnostico": 27,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0083",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Cáncer confirmado",
|
||||||
|
"estatus_codigo": "CANCER_CONFIRMADO",
|
||||||
|
"birads": "BI-RADS 5",
|
||||||
|
"birads_codigo": "BIRADS_5",
|
||||||
|
"mastografia_fecha": "2026-09-20",
|
||||||
|
"biopsia": "Carcinoma invasor",
|
||||||
|
"biopsia_fecha": "2026-09-27",
|
||||||
|
"dias_mastografia_diagnostico": 25,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0062",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Benigno, regresa a tamizaje",
|
||||||
|
"estatus_codigo": "BENIGNO",
|
||||||
|
"birads": "BI-RADS 4A",
|
||||||
|
"birads_codigo": "BIRADS_4A",
|
||||||
|
"mastografia_fecha": "2026-09-26",
|
||||||
|
"biopsia": "Benigno",
|
||||||
|
"biopsia_fecha": "2026-10-14",
|
||||||
|
"dias_mastografia_diagnostico": 19,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0032",
|
||||||
|
"grupo_edad": "40-49",
|
||||||
|
"grupo_edad_codigo": "40-49",
|
||||||
|
"estatus": "Benigno, regresa a tamizaje",
|
||||||
|
"estatus_codigo": "BENIGNO",
|
||||||
|
"birads": "BI-RADS 4B",
|
||||||
|
"birads_codigo": "BIRADS_4B",
|
||||||
|
"mastografia_fecha": "2026-10-07",
|
||||||
|
"biopsia": "Benigno",
|
||||||
|
"biopsia_fecha": "2026-10-20",
|
||||||
|
"dias_mastografia_diagnostico": 61,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0077",
|
||||||
|
"grupo_edad": "50-59",
|
||||||
|
"grupo_edad_codigo": "50-59",
|
||||||
|
"estatus": "Benigno, regresa a tamizaje",
|
||||||
|
"estatus_codigo": "BENIGNO",
|
||||||
|
"birads": "BI-RADS 4B",
|
||||||
|
"birads_codigo": "BIRADS_4B",
|
||||||
|
"mastografia_fecha": "2026-10-14",
|
||||||
|
"biopsia": "Lesión de riesgo (B3)",
|
||||||
|
"biopsia_fecha": "2026-10-20",
|
||||||
|
"dias_mastografia_diagnostico": 60,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id_seudonimo": "M-0027",
|
||||||
|
"grupo_edad": "70+",
|
||||||
|
"grupo_edad_codigo": "70+",
|
||||||
|
"estatus": "Cáncer confirmado",
|
||||||
|
"estatus_codigo": "CANCER_CONFIRMADO",
|
||||||
|
"birads": "BI-RADS 4B",
|
||||||
|
"birads_codigo": "BIRADS_4B",
|
||||||
|
"mastografia_fecha": "2026-10-16",
|
||||||
|
"biopsia": "Carcinoma invasor",
|
||||||
|
"biopsia_fecha": "2026-10-20",
|
||||||
|
"dias_mastografia_diagnostico": 36,
|
||||||
|
"prioridad": "Baja",
|
||||||
|
"prioridad_codigo": "BAJA"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"error": "la selección tiene menos de 5 pacientes: su lista no se publica.", "motivo": "supresion"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"simulado": true, "cohorte": "cama_birads_v1", "escenario": "diagnostico", "revision": "a2c95b755ba3ccab288c148153e14be1e958aadff1f5a320a4d54e84b3cae745", "corte": "2026-11-17", "ventana": {"meses": 6, "desde": "2026-05-18", "hasta": "2026-11-17"}, "filtros": {"birads": "BIRADS_5", "grupo_edad": null, "biopsia": null}, "filtros_disponibles": [{"clave": "birads", "etiqueta": "Categoría BI-RADS", "opciones": [{"codigo": "BIRADS_4", "etiqueta": "BI-RADS 4"}, {"codigo": "BIRADS_4A", "etiqueta": "BI-RADS 4A"}, {"codigo": "BIRADS_4B", "etiqueta": "BI-RADS 4B"}, {"codigo": "BIRADS_4C", "etiqueta": "BI-RADS 4C"}, {"codigo": "BIRADS_5", "etiqueta": "BI-RADS 5"}, {"codigo": "BIRADS_6", "etiqueta": "BI-RADS 6"}]}, {"clave": "grupo_edad", "etiqueta": "Grupo de edad", "opciones": [{"codigo": "<40", "etiqueta": "<40"}, {"codigo": "40-49", "etiqueta": "40-49"}, {"codigo": "50-59", "etiqueta": "50-59"}, {"codigo": "60-69", "etiqueta": "60-69"}, {"codigo": "70+", "etiqueta": "70+"}, {"codigo": "SIN_DATO", "etiqueta": "Sin dato"}]}, {"clave": "biopsia", "etiqueta": "Resultado de la biopsia", "opciones": [{"codigo": "BENIGNO", "etiqueta": "Benigno"}, {"codigo": "CARCINOMA_IN_SITU", "etiqueta": "Carcinoma in situ"}, {"codigo": "CARCINOMA_INVASOR", "etiqueta": "Carcinoma invasor"}, {"codigo": "SIN_DATO", "etiqueta": "Biopsia reportada sin resultado"}, {"codigo": "SIN_BIOPSIA", "etiqueta": "Sin biopsia reportada"}]}], "columnas": [{"clave": "pac_id", "etiqueta": "Identificador de paciente"}, {"clave": "grupo_edad", "etiqueta": "Grupo de edad"}, {"clave": "birads", "etiqueta": "Última mastografía", "detalles": [{"clave": "mastografia_fecha", "etiqueta": "Fecha"}]}, {"clave": "biopsia", "etiqueta": "Resultado histopatológico", "detalles": [{"clave": "biopsia_fecha", "etiqueta": "Fecha de reporte"}]}], "paginacion": {"page": 1, "page_size": 50, "total_items": 16, "total_pages": 1}, "items": [{"pac_id": "251", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-11-05", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "185", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-10-24", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "95", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-10-15", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-11-14"}, {"pac_id": "188", "grupo_edad": "50-59", "birads": "BIRADS_5", "mastografia_fecha": "2026-10-04", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-10-20"}, {"pac_id": "126", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-08-27", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-10-04"}, {"pac_id": "52", "grupo_edad": "40-49", "birads": "BIRADS_5", "mastografia_fecha": "2026-08-20", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "220", "grupo_edad": "50-59", "birads": "BIRADS_5", "mastografia_fecha": "2026-08-19", "biopsia": "BENIGNO", "biopsia_fecha": "2026-09-23"}, {"pac_id": "254", "grupo_edad": "50-59", "birads": "BIRADS_5", "mastografia_fecha": "2026-08-11", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-09-16"}, {"pac_id": "129", "grupo_edad": "40-49", "birads": "BIRADS_5", "mastografia_fecha": "2026-07-22", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-08-20"}, {"pac_id": "117", "grupo_edad": "40-49", "birads": "BIRADS_5", "mastografia_fecha": "2026-07-21", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-08-09"}, {"pac_id": "101", "grupo_edad": "50-59", "birads": "BIRADS_5", "mastografia_fecha": "2026-07-03", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-07-31"}, {"pac_id": "225", "grupo_edad": "40-49", "birads": "BIRADS_5", "mastografia_fecha": "2026-07-02", "biopsia": "CARCINOMA_IN_SITU", "biopsia_fecha": "2026-07-31"}, {"pac_id": "287", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-06-14", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-07-13"}, {"pac_id": "55", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-06-09", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-06-30"}, {"pac_id": "7", "grupo_edad": "40-49", "birads": "BIRADS_5", "mastografia_fecha": "2026-06-02", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "260", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-05-21", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-06-07"}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"simulado": true, "cohorte": "cama_birads_v1", "escenario": "diagnostico", "revision": "a2c95b755ba3ccab288c148153e14be1e958aadff1f5a320a4d54e84b3cae745", "corte": "2026-11-17", "ventana": {"meses": 3, "desde": "2026-08-18", "hasta": "2026-11-17"}, "filtros": {"birads": null, "grupo_edad": null, "biopsia": null}, "filtros_disponibles": [{"clave": "birads", "etiqueta": "Categoría BI-RADS", "opciones": [{"codigo": "BIRADS_4", "etiqueta": "BI-RADS 4"}, {"codigo": "BIRADS_4A", "etiqueta": "BI-RADS 4A"}, {"codigo": "BIRADS_4B", "etiqueta": "BI-RADS 4B"}, {"codigo": "BIRADS_4C", "etiqueta": "BI-RADS 4C"}, {"codigo": "BIRADS_5", "etiqueta": "BI-RADS 5"}, {"codigo": "BIRADS_6", "etiqueta": "BI-RADS 6"}]}, {"clave": "grupo_edad", "etiqueta": "Grupo de edad", "opciones": [{"codigo": "<40", "etiqueta": "<40"}, {"codigo": "40-49", "etiqueta": "40-49"}, {"codigo": "50-59", "etiqueta": "50-59"}, {"codigo": "60-69", "etiqueta": "60-69"}, {"codigo": "70+", "etiqueta": "70+"}, {"codigo": "SIN_DATO", "etiqueta": "Sin dato"}]}, {"clave": "biopsia", "etiqueta": "Resultado de la biopsia", "opciones": [{"codigo": "BENIGNO", "etiqueta": "Benigno"}, {"codigo": "CARCINOMA_IN_SITU", "etiqueta": "Carcinoma in situ"}, {"codigo": "CARCINOMA_INVASOR", "etiqueta": "Carcinoma invasor"}, {"codigo": "SIN_DATO", "etiqueta": "Biopsia reportada sin resultado"}, {"codigo": "SIN_BIOPSIA", "etiqueta": "Sin biopsia reportada"}]}], "columnas": [{"clave": "pac_id", "etiqueta": "Identificador de paciente"}, {"clave": "grupo_edad", "etiqueta": "Grupo de edad"}, {"clave": "birads", "etiqueta": "Última mastografía", "detalles": [{"clave": "mastografia_fecha", "etiqueta": "Fecha"}]}, {"clave": "biopsia", "etiqueta": "Resultado histopatológico", "detalles": [{"clave": "biopsia_fecha", "etiqueta": "Fecha de reporte"}]}], "paginacion": {"page": 1, "page_size": 50, "total_items": 16, "total_pages": 1}, "items": [{"pac_id": "251", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-11-05", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "54", "grupo_edad": "60-69", "birads": "BIRADS_4", "mastografia_fecha": "2026-10-24", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "185", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-10-24", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "255", "grupo_edad": "60-69", "birads": "BIRADS_4", "mastografia_fecha": "2026-10-21", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "95", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-10-15", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-11-14"}, {"pac_id": "4", "grupo_edad": "50-59", "birads": "BIRADS_4", "mastografia_fecha": "2026-10-10", "biopsia": "BENIGNO", "biopsia_fecha": "2026-11-06"}, {"pac_id": "256", "grupo_edad": "60-69", "birads": "BIRADS_4", "mastografia_fecha": "2026-10-08", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "188", "grupo_edad": "50-59", "birads": "BIRADS_5", "mastografia_fecha": "2026-10-04", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-10-20"}, {"pac_id": "239", "grupo_edad": "50-59", "birads": "BIRADS_4", "mastografia_fecha": "2026-09-14", "biopsia": "BENIGNO", "biopsia_fecha": "2026-10-06"}, {"pac_id": "245", "grupo_edad": "40-49", "birads": "BIRADS_4", "mastografia_fecha": "2026-09-09", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "186", "grupo_edad": "60-69", "birads": "BIRADS_4", "mastografia_fecha": "2026-08-31", "biopsia": "BENIGNO", "biopsia_fecha": "2026-09-23"}, {"pac_id": "282", "grupo_edad": "50-59", "birads": "BIRADS_4", "mastografia_fecha": "2026-08-29", "biopsia": "BENIGNO", "biopsia_fecha": "2026-09-10"}, {"pac_id": "126", "grupo_edad": "60-69", "birads": "BIRADS_5", "mastografia_fecha": "2026-08-27", "biopsia": "CARCINOMA_INVASOR", "biopsia_fecha": "2026-10-04"}, {"pac_id": "31", "grupo_edad": "50-59", "birads": "BIRADS_4", "mastografia_fecha": "2026-08-20", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "52", "grupo_edad": "40-49", "birads": "BIRADS_5", "mastografia_fecha": "2026-08-20", "biopsia": null, "biopsia_fecha": null}, {"pac_id": "220", "grupo_edad": "50-59", "birads": "BIRADS_5", "mastografia_fecha": "2026-08-19", "biopsia": "BENIGNO", "biopsia_fecha": "2026-09-23"}]}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"id": "cama_tasa_deteccion_histopatologica",
|
||||||
|
"titulo": "Detección histopatológica",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contrato": "C1",
|
||||||
|
"unidad": "examen",
|
||||||
|
"tipo_periodo": "semestre",
|
||||||
|
"periodos": [
|
||||||
|
"2025-S1"
|
||||||
|
],
|
||||||
|
"estrato": null,
|
||||||
|
"valores_estrato": [],
|
||||||
|
"etiquetas_estrato": {},
|
||||||
|
"grupos": {
|
||||||
|
"total": "Total"
|
||||||
|
},
|
||||||
|
"categorias": {},
|
||||||
|
"grupos_de_categoria": {},
|
||||||
|
"notas": [
|
||||||
|
"Detección histopatológica"
|
||||||
|
],
|
||||||
|
"reportes": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"report_id": 127,
|
||||||
|
"periodo_inicio": "2025-01-01",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"fecha_corte": "2026-11-12",
|
||||||
|
"generado_en": "2026-11-12T17:00:31.282549+00:00",
|
||||||
|
"kit_version": "0.8.0",
|
||||||
|
"toml_sha": "9349fdd093c85bfe9adc86b91ea5350a03be829825645b51ab87a35fccc5d42d",
|
||||||
|
"parametros_sha": "d909bc4a153b244533acde1f26ce8c4cfaaedf0d277239dd9b1ce9e9f65b23a9",
|
||||||
|
"parametros": {
|
||||||
|
"sql": {
|
||||||
|
"fecha_corte": "2026-11-12",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"periodo_inicio": "2025-01-01"
|
||||||
|
},
|
||||||
|
"umbral_supresion": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filas": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "total",
|
||||||
|
"estrato": null,
|
||||||
|
"numerador": null,
|
||||||
|
"denominador": null,
|
||||||
|
"valor": null,
|
||||||
|
"ic_bajo": null,
|
||||||
|
"ic_alto": null,
|
||||||
|
"suprimido": 1,
|
||||||
|
"n_sin_evento": 0,
|
||||||
|
"n_excluido": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totales_estrato": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"id": "cama_tasa_deteccion_histopatologica",
|
||||||
|
"titulo": "Detección histopatológica",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contrato": "C1",
|
||||||
|
"unidad": "examen",
|
||||||
|
"tipo_periodo": "semestre",
|
||||||
|
"periodos": [
|
||||||
|
"2025-S1"
|
||||||
|
],
|
||||||
|
"estrato": null,
|
||||||
|
"valores_estrato": [],
|
||||||
|
"etiquetas_estrato": {},
|
||||||
|
"grupos": {
|
||||||
|
"total": "Total"
|
||||||
|
},
|
||||||
|
"categorias": {},
|
||||||
|
"grupos_de_categoria": {},
|
||||||
|
"notas": [
|
||||||
|
"Detección histopatológica"
|
||||||
|
],
|
||||||
|
"reportes": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"report_id": 127,
|
||||||
|
"periodo_inicio": "2025-01-01",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"fecha_corte": "2026-11-12",
|
||||||
|
"generado_en": "2026-11-12T17:00:42.857591+00:00",
|
||||||
|
"kit_version": "0.8.0",
|
||||||
|
"toml_sha": "38b2efac7d70f9c0bf37b03b7abd21d48bff4c6d8f6786fccbccfa31a7fcd7e7",
|
||||||
|
"parametros_sha": "7202a2779ae47c29a7659dd6fdfb77e8895d4d778a772ff13cc2ce93c5a6e871",
|
||||||
|
"parametros": {
|
||||||
|
"sql": {
|
||||||
|
"fecha_corte": "2026-11-12",
|
||||||
|
"periodo_fin": "2025-07-01",
|
||||||
|
"periodo_inicio": "2025-01-01"
|
||||||
|
},
|
||||||
|
"umbral_supresion": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filas": [
|
||||||
|
{
|
||||||
|
"periodo": "2025-S1",
|
||||||
|
"grupo": "total",
|
||||||
|
"estrato": null,
|
||||||
|
"numerador": 0,
|
||||||
|
"denominador": 1,
|
||||||
|
"valor": 0.0,
|
||||||
|
"ic_bajo": 0.0,
|
||||||
|
"ic_alto": 79.3450688208,
|
||||||
|
"suprimido": 0,
|
||||||
|
"n_sin_evento": 1,
|
||||||
|
"n_excluido": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totales_estrato": []
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,835 @@
|
|||||||
|
{
|
||||||
|
"resourceType": "Bundle",
|
||||||
|
"type": "collection",
|
||||||
|
"entry": [
|
||||||
|
{
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"id": "ados2-vista-previa",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2",
|
||||||
|
"display": "ADOS-2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "Patient/vista-previa"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "1985-01-01",
|
||||||
|
"component": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.modulo",
|
||||||
|
"display": "Módulo"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueCodeableConcept": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.modulo.MODULO_2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.css",
|
||||||
|
"display": "Puntaje de severidad (CSS)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.clasificacion",
|
||||||
|
"display": "Clasificación"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueCodeableConcept": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.clasificacion.AUTISMO"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/ados2-dominio",
|
||||||
|
"code": "SA",
|
||||||
|
"display": "Afecto social"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/ados2-dominio",
|
||||||
|
"code": "RRB",
|
||||||
|
"display": "Comportamiento restringido y repetitivo"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.rrb_a4",
|
||||||
|
"display": "Uso estereotipado o idiosincrásico de palabras o frases"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 1,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "RRB"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.rrb_d2",
|
||||||
|
"display": "Manierismos de manos y dedos y otros manierismos complejos"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 2,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "RRB"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.rrb_d4",
|
||||||
|
"display": "Intereses inusualmente repetitivos o comportamientos estereotipados"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 1,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "RRB"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.sa_a6",
|
||||||
|
"display": "Señalar"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 1,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "SA"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.sa_a7",
|
||||||
|
"display": "Señalar"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 0,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "SA"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.sa_b1",
|
||||||
|
"display": "Contacto visual inusual"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 2,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "SA"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.sa_b12",
|
||||||
|
"display": "Características de las iniciaciones sociales"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 2,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "SA"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.sa_b2",
|
||||||
|
"display": "Expresiones faciales dirigidas a otros"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 1,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "SA"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.sa_b3",
|
||||||
|
"display": "Expresiones faciales dirigidas a otros"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 0,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "SA"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.sa_b5",
|
||||||
|
"display": "Disfrute compartido durante la interacción"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 2,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "SA"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.sa_b6",
|
||||||
|
"display": "Iniciación espontánea de la atención conjunta"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 1,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "SA"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "ados2.sa_b8",
|
||||||
|
"display": "Características de las iniciaciones sociales"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"valueInteger": 1,
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/puntaje-algoritmo",
|
||||||
|
"valueInteger": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/dominio",
|
||||||
|
"valueCode": "SA"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/etiqueta",
|
||||||
|
"code": "simulado",
|
||||||
|
"display": "Datos simulados"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Procedure",
|
||||||
|
"id": "eeg-vista-previa",
|
||||||
|
"status": "completed",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "eeg",
|
||||||
|
"display": "Electroencefalograma"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "Patient/vista-previa"
|
||||||
|
},
|
||||||
|
"performedDateTime": "1985-01-01",
|
||||||
|
"meta": {
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/etiqueta",
|
||||||
|
"code": "simulado",
|
||||||
|
"display": "Datos simulados"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "DiagnosticReport",
|
||||||
|
"id": "eeg-vista-previa",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/tea-catalogo",
|
||||||
|
"code": "eeg",
|
||||||
|
"display": "Electroencefalograma"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "Patient/vista-previa"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "1985-01-01",
|
||||||
|
"result": [
|
||||||
|
{
|
||||||
|
"reference": "Observation/calidad-bad-scalp-triage-vista-previa"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"reference": "Observation/calidad-clean-windows-vista-previa"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"reference": "Observation/calidad-internal-coverage-vista-previa"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"reference": "Observation/calidad-line-noise-vista-previa"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"reference": "Observation/calidad-triage-level-vista-previa"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"reference": "Observation/calidad-usable-scalp-vista-previa"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conclusionCode": [
|
||||||
|
{
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/calidad",
|
||||||
|
"code": "MALO"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "urn:tea:validation",
|
||||||
|
"code": "not-valid"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extension": [
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/duracion-min",
|
||||||
|
"valueDecimal": 2.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/edad-meses",
|
||||||
|
"valueDecimal": 30.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://isssteleon.org/fhir/StructureDefinition/canales",
|
||||||
|
"valueInteger": 24
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conclusion": "EEG de mala calidad: no es válido para el estudio (nivel de triaje: no_analizable).",
|
||||||
|
"meta": {
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/etiqueta",
|
||||||
|
"code": "simulado",
|
||||||
|
"display": "Datos simulados"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"id": "calidad-bad-scalp-triage-vista-previa",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "urn:tea:validation",
|
||||||
|
"code": "bad-scalp-triage",
|
||||||
|
"display": "bad-scalp-triage"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "bad-scalp-triage"
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "Patient/vista-previa"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "1985-01-01",
|
||||||
|
"interpretation": [
|
||||||
|
{
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
|
||||||
|
"code": "N"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valueQuantity": {
|
||||||
|
"value": 0.0,
|
||||||
|
"unit": "electrodes"
|
||||||
|
},
|
||||||
|
"referenceRange": [
|
||||||
|
{
|
||||||
|
"high": {
|
||||||
|
"value": 2.0,
|
||||||
|
"unit": "electrodes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"component": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"text": "decisive"
|
||||||
|
},
|
||||||
|
"valueBoolean": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/etiqueta",
|
||||||
|
"code": "simulado",
|
||||||
|
"display": "Datos simulados"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"id": "calidad-clean-windows-vista-previa",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "urn:tea:validation",
|
||||||
|
"code": "clean-windows",
|
||||||
|
"display": "clean-windows"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "clean-windows"
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "Patient/vista-previa"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "1985-01-01",
|
||||||
|
"interpretation": [
|
||||||
|
{
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
|
||||||
|
"code": "N"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valueQuantity": {
|
||||||
|
"value": 100.0,
|
||||||
|
"unit": "%"
|
||||||
|
},
|
||||||
|
"referenceRange": [
|
||||||
|
{
|
||||||
|
"low": {
|
||||||
|
"value": 60.0,
|
||||||
|
"unit": "%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"component": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"text": "decisive"
|
||||||
|
},
|
||||||
|
"valueBoolean": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/etiqueta",
|
||||||
|
"code": "simulado",
|
||||||
|
"display": "Datos simulados"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"id": "calidad-internal-coverage-vista-previa",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "urn:tea:validation",
|
||||||
|
"code": "internal-coverage",
|
||||||
|
"display": "internal-coverage"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "internal-coverage"
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "Patient/vista-previa"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "1985-01-01",
|
||||||
|
"interpretation": [
|
||||||
|
{
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
|
||||||
|
"code": "N"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valueQuantity": {
|
||||||
|
"value": 1.0,
|
||||||
|
"unit": "fraction"
|
||||||
|
},
|
||||||
|
"referenceRange": [
|
||||||
|
{
|
||||||
|
"low": {
|
||||||
|
"value": 0.9,
|
||||||
|
"unit": "fraction"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"component": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"text": "decisive"
|
||||||
|
},
|
||||||
|
"valueBoolean": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/etiqueta",
|
||||||
|
"code": "simulado",
|
||||||
|
"display": "Datos simulados"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"id": "calidad-line-noise-vista-previa",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "urn:tea:validation",
|
||||||
|
"code": "line-noise",
|
||||||
|
"display": "line-noise"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "line-noise"
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "Patient/vista-previa"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "1985-01-01",
|
||||||
|
"interpretation": [
|
||||||
|
{
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
|
||||||
|
"code": "N"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valueQuantity": {
|
||||||
|
"value": 9.231034526452635,
|
||||||
|
"unit": "dB"
|
||||||
|
},
|
||||||
|
"referenceRange": [
|
||||||
|
{
|
||||||
|
"high": {
|
||||||
|
"value": 45.0,
|
||||||
|
"unit": "dB"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"component": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"text": "decisive"
|
||||||
|
},
|
||||||
|
"valueBoolean": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/etiqueta",
|
||||||
|
"code": "simulado",
|
||||||
|
"display": "Datos simulados"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"id": "calidad-triage-level-vista-previa",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "urn:tea:validation",
|
||||||
|
"code": "triage-level",
|
||||||
|
"display": "triage-level"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "triage-level"
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "Patient/vista-previa"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "1985-01-01",
|
||||||
|
"interpretation": [
|
||||||
|
{
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
|
||||||
|
"code": "A"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valueString": "no_analizable",
|
||||||
|
"component": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"text": "decisive"
|
||||||
|
},
|
||||||
|
"valueBoolean": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/etiqueta",
|
||||||
|
"code": "simulado",
|
||||||
|
"display": "Datos simulados"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"id": "calidad-usable-scalp-vista-previa",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "urn:tea:validation",
|
||||||
|
"code": "usable-scalp",
|
||||||
|
"display": "usable-scalp"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "usable-scalp"
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "Patient/vista-previa"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "1985-01-01",
|
||||||
|
"interpretation": [
|
||||||
|
{
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
|
||||||
|
"code": "N"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valueQuantity": {
|
||||||
|
"value": 19.0,
|
||||||
|
"unit": "electrodes"
|
||||||
|
},
|
||||||
|
"referenceRange": [
|
||||||
|
{
|
||||||
|
"low": {
|
||||||
|
"value": 12.0,
|
||||||
|
"unit": "electrodes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"component": [
|
||||||
|
{
|
||||||
|
"code": {
|
||||||
|
"text": "decisive"
|
||||||
|
},
|
||||||
|
"valueBoolean": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"system": "https://isssteleon.org/fhir/CodeSystem/etiqueta",
|
||||||
|
"code": "simulado",
|
||||||
|
"display": "Datos simulados"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// Covers the round "?" help of TEA's cards: hover or focus shows the text, a click keeps it until the next click.
|
||||||
|
// Fixture: a host component that projects one line of text into the button.
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { IndicadorAyuda } from './indicador-ayuda';
|
||||||
|
|
||||||
|
@Component({ imports: [IndicadorAyuda], template: `<app-indicador-ayuda etiqueta="Cómo leer: prueba" (opened)="aperturas = aperturas + 1">Texto de ayuda</app-indicador-ayuda>` })
|
||||||
|
class Host { aperturas = 0; }
|
||||||
|
|
||||||
|
describe('Ayuda redonda', () => {
|
||||||
|
function crear() {
|
||||||
|
const fixture = TestBed.createComponent(Host);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const root: HTMLElement = fixture.nativeElement;
|
||||||
|
const boton = () => root.querySelector<HTMLButtonElement>('.ayuda-boton')!;
|
||||||
|
const texto = () => root.querySelector('.ayuda-texto')?.textContent?.trim();
|
||||||
|
const ayuda = root.querySelector('.ayuda')!;
|
||||||
|
return { fixture, boton, texto, ayuda };
|
||||||
|
}
|
||||||
|
|
||||||
|
it('muestra el texto al pasar el cursor y lo oculta al salir', () => {
|
||||||
|
// Fails if hovering stops showing the guide or leaving leaves it open when it was not pinned.
|
||||||
|
const { fixture, texto, ayuda } = crear();
|
||||||
|
expect(texto()).toBeUndefined();
|
||||||
|
ayuda.dispatchEvent(new MouseEvent('mouseenter')); fixture.detectChanges();
|
||||||
|
expect(texto()).toBe('Texto de ayuda');
|
||||||
|
ayuda.dispatchEvent(new MouseEvent('mouseleave')); fixture.detectChanges();
|
||||||
|
expect(texto()).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('un clic fija el texto hasta el siguiente clic', () => {
|
||||||
|
// Fails if the click stops pinning the text, if leaving closes a pinned text, or if a second click does not close it.
|
||||||
|
const { fixture, boton, texto, ayuda } = crear();
|
||||||
|
ayuda.dispatchEvent(new MouseEvent('mouseenter')); boton().click(); fixture.detectChanges();
|
||||||
|
ayuda.dispatchEvent(new MouseEvent('mouseleave')); fixture.detectChanges();
|
||||||
|
expect(texto()).toBe('Texto de ayuda');
|
||||||
|
expect(boton().getAttribute('aria-expanded')).toBe('true');
|
||||||
|
boton().click(); fixture.detectChanges();
|
||||||
|
expect(texto()).toBeUndefined();
|
||||||
|
expect(boton().getAttribute('aria-expanded')).toBe('false');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('avisa solo al abrirse con un clic y nombra el botón', () => {
|
||||||
|
// Fails if closing also reports an opening (the metadata would be requested again) or the accessible name is lost.
|
||||||
|
const { fixture, boton } = crear();
|
||||||
|
boton().click(); boton().click(); boton().click(); fixture.detectChanges();
|
||||||
|
expect(fixture.componentInstance.aperturas).toBe(2);
|
||||||
|
expect(boton().getAttribute('aria-label')).toBe('Cómo leer: prueba');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import { Component, input, output, signal } from '@angular/core';
|
||||||
|
|
||||||
|
// Round "?" button at the top right of a card. Hover or focus shows its text; a click keeps it open until the next click.
|
||||||
|
@Component({
|
||||||
|
selector: 'app-indicador-ayuda',
|
||||||
|
template: `
|
||||||
|
<div class="ayuda" (mouseenter)="sobre.set(true)" (mouseleave)="sobre.set(false)" (focusin)="sobre.set(true)" (focusout)="sobre.set(false)">
|
||||||
|
<button type="button" class="ayuda-boton" [attr.aria-label]="etiqueta()" [attr.aria-expanded]="visible()"
|
||||||
|
[attr.aria-controls]="visible() ? idPanel : null" (click)="alternar()"><span aria-hidden="true">?</span></button>
|
||||||
|
@if (visible()) {
|
||||||
|
<div class="ayuda-texto" role="tooltip" [id]="idPanel"><ng-content /></div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
styles: `
|
||||||
|
:host { position: absolute; top: .5rem; right: .5rem; z-index: 2; }
|
||||||
|
.ayuda { position: relative; }
|
||||||
|
.ayuda-boton { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; padding: 0; border: 0;
|
||||||
|
border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px var(--issste-text-secondary); color: var(--issste-text); font: inherit; font-weight: 800; line-height: 1; cursor: pointer; }
|
||||||
|
.ayuda-boton:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 3px; }
|
||||||
|
.ayuda-texto { position: absolute; top: calc(100% + .375rem); right: 0; width: min(22rem, 80vw); box-sizing: border-box; padding: var(--issste-space-3) var(--issste-space-4);
|
||||||
|
background: var(--issste-surface); color: var(--issste-text); border: 1px solid var(--issste-border); border-inline-start: 3px solid var(--issste-accent);
|
||||||
|
border-radius: var(--issste-radius); box-shadow: 0 4px 16px rgb(0 0 0 / .18); font: var(--mat-sys-body-small); line-height: 1.5; text-align: start; overflow-wrap: anywhere; }
|
||||||
|
`,
|
||||||
|
})
|
||||||
|
export class IndicadorAyuda {
|
||||||
|
readonly etiqueta = input('Cómo leer');
|
||||||
|
readonly opened = output<void>();
|
||||||
|
readonly sobre = signal(false);
|
||||||
|
readonly fijo = signal(false);
|
||||||
|
private static contador = 0;
|
||||||
|
readonly idPanel = 'ayuda-' + ++IndicadorAyuda.contador;
|
||||||
|
visible() { return this.sobre() || this.fijo(); }
|
||||||
|
alternar() {
|
||||||
|
const abre = !this.fijo();
|
||||||
|
this.fijo.set(abre);
|
||||||
|
if (abre) this.opened.emit();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ import { TestBed } from '@angular/core/testing';
|
|||||||
import { provideHttpClient } from '@angular/common/http';
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { MatSelect } from '@angular/material/select';
|
|
||||||
import { IndicadorCatalogCard } from './indicador-catalog-card';
|
import { IndicadorCatalogCard } from './indicador-catalog-card';
|
||||||
import { IndicadorFigureCard } from './indicador-figure-card';
|
import { IndicadorFigureCard } from './indicador-figure-card';
|
||||||
import { IndicadorFigurePanel } from './indicador-figure-panel';
|
import { IndicadorFigurePanel } from './indicador-figure-panel';
|
||||||
@@ -28,7 +27,6 @@ describe('UX-06E.D.2.1 selector de representación', () => {
|
|||||||
fixture.componentRef.setInput('indicador', { id: 'i', titulo: 'I', contrato: 'C2', figuras, tipos_periodo: ['semestre'] });
|
fixture.componentRef.setInput('indicador', { id: 'i', titulo: 'I', contrato: 'C2', figuras, tipos_periodo: ['semestre'] });
|
||||||
fixture.componentRef.setInput('tema', 'claro'); fixture.componentRef.setInput('applied', applied); fixture.detectChanges();
|
fixture.componentRef.setInput('tema', 'claro'); fixture.componentRef.setInput('applied', applied); fixture.detectChanges();
|
||||||
}
|
}
|
||||||
function select() { return fixture.debugElement.query(By.directive(MatSelect)).componentInstance as MatSelect; }
|
|
||||||
function panels() { return fixture.debugElement.queryAll(By.directive(IndicadorFigurePanel)).filter(e => e.componentInstance.result().status !== 'deferred'); }
|
function panels() { return fixture.debugElement.queryAll(By.directive(IndicadorFigurePanel)).filter(e => e.componentInstance.result().status !== 'deferred'); }
|
||||||
function request(id: string) { return http.expectOne(r => r.url.endsWith('/figuras/' + id)); }
|
function request(id: string) { return http.expectOne(r => r.url.endsWith('/figuras/' + id)); }
|
||||||
function open() { fixture.componentInstance.setVisible(true); fixture.detectChanges(); }
|
function open() { fixture.componentInstance.setVisible(true); fixture.detectChanges(); }
|
||||||
@@ -38,7 +36,8 @@ describe('UX-06E.D.2.1 selector de representación', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(fixture.nativeElement.querySelector('h2').textContent).toBe('EEG con ≥ 20 min de registro');
|
expect(fixture.nativeElement.querySelector('h2').textContent).toBe('EEG con ≥ 20 min de registro');
|
||||||
expect(fixture.nativeElement.querySelector('.indicator-id')).toBeNull();
|
expect(fixture.nativeElement.querySelector('.indicator-id')).toBeNull();
|
||||||
expect(fixture.nativeElement.querySelector('.catalog-metadata').textContent.trim()).toBe('2 figuras publicadas');
|
expect(fixture.nativeElement.querySelector('.catalog-metadata')).toBeNull();
|
||||||
|
expect(fixture.nativeElement.querySelector('.pin-toggle')).toBeNull();
|
||||||
// The internal panel heading is deliberately visually hidden and retains identity.
|
// The internal panel heading is deliberately visually hidden and retains identity.
|
||||||
const copy = fixture.nativeElement.cloneNode(true) as HTMLElement;
|
const copy = fixture.nativeElement.cloneNode(true) as HTMLElement;
|
||||||
copy.querySelectorAll('.visually-hidden').forEach(node => node.remove());
|
copy.querySelectorAll('.visually-hidden').forEach(node => node.remove());
|
||||||
@@ -47,13 +46,9 @@ describe('UX-06E.D.2.1 selector de representación', () => {
|
|||||||
expect(fixture.componentInstance.indicador.contrato).toBe(contrato);
|
expect(fixture.componentInstance.indicador.contrato).toBe(contrato);
|
||||||
http.expectNone(() => true);
|
http.expectNone(() => true);
|
||||||
});
|
});
|
||||||
it('UX-07A/07D.1 presenta nombres amigables y conserva IDs para selector, consulta y memoria', () => {
|
it('UX-07A/07D.1 presenta nombres amigables y conserva IDs para consulta y memoria', () => {
|
||||||
fixture.destroy(); create(['fig_c1_grupos', 'fig_c2_apiladas', 'fig_c2_barras', 'fig_c2_donas', 'fig_c9_futura']);
|
fixture.destroy(); create(['fig_c1_grupos', 'fig_c2_apiladas', 'fig_c2_barras', 'fig_c2_donas', 'fig_c9_futura']);
|
||||||
fixture.componentRef.setInput('indicador', { ...fixture.componentInstance.indicador, contrato: 'C1' }); fixture.detectChanges();
|
fixture.componentRef.setInput('indicador', { ...fixture.componentInstance.indicador, contrato: 'C1' }); fixture.detectChanges();
|
||||||
expect(select().options.map(option => [option.value, option.viewValue])).toEqual([
|
|
||||||
['fig_c1_grupos', 'Grupos'], ['fig_c2_apiladas', 'Barras apiladas'],
|
|
||||||
['fig_c2_barras', 'Barras'], ['fig_c2_donas', 'Donas'], ['fig_c9_futura', 'Representación 5'],
|
|
||||||
]);
|
|
||||||
http.expectNone(() => true);
|
http.expectNone(() => true);
|
||||||
open(); request('fig_c1_grupos').flush({ data: [], layout: {} });
|
open(); request('fig_c1_grupos').flush({ data: [], layout: {} });
|
||||||
for (const [id, label] of [
|
for (const [id, label] of [
|
||||||
@@ -62,7 +57,7 @@ describe('UX-06E.D.2.1 selector de representación', () => {
|
|||||||
['fig_c2_donas', 'Donas'],
|
['fig_c2_donas', 'Donas'],
|
||||||
['fig_c9_futura', 'Representación 5'],
|
['fig_c9_futura', 'Representación 5'],
|
||||||
]) {
|
]) {
|
||||||
select().selectionChange.emit({ source: select(), value: id }); fixture.detectChanges();
|
fixture.componentInstance.selectFigure(id); fixture.detectChanges();
|
||||||
const pending = request(id);
|
const pending = request(id);
|
||||||
expect(pending.request.url).toBe('/cacu/indicadores/i/figuras/' + id);
|
expect(pending.request.url).toBe('/cacu/indicadores/i/figuras/' + id);
|
||||||
expect(pending.request.params.get('tema')).toBe('claro');
|
expect(pending.request.params.get('tema')).toBe('claro');
|
||||||
@@ -74,9 +69,9 @@ describe('UX-06E.D.2.1 selector de representación', () => {
|
|||||||
}
|
}
|
||||||
http.expectNone(() => true);
|
http.expectNone(() => true);
|
||||||
});
|
});
|
||||||
it('una opción publicada está deshabilitada y sólo consulta esa figura', () => {
|
it('no ofrece selector de representación y sólo consulta la figura mostrada', () => {
|
||||||
fixture.destroy(); create(['f']); open(); expect(select().disabled).toBe(true);
|
fixture.destroy(); create(['f', 'g']); open(); expect(fixture.nativeElement.querySelector('mat-select')).toBeNull();
|
||||||
expect(select().options.map(o => o.value)).toEqual(['f']); request('f').flush({ data: [], layout: {} }); http.expectNone(() => true);
|
request('f').flush({ data: [], layout: {} }); http.expectNone(() => true);
|
||||||
});
|
});
|
||||||
it('comparte una sola solicitud de metadatos entre las dos figuras y asocia por ID exacto', () => {
|
it('comparte una sola solicitud de metadatos entre las dos figuras y asocia por ID exacto', () => {
|
||||||
fixture.componentRef.setInput('indicador', { id: 'cacu_eu13', titulo: 'EU13', contrato: 'C2',
|
fixture.componentRef.setInput('indicador', { id: 'cacu_eu13', titulo: 'EU13', contrato: 'C2',
|
||||||
@@ -98,9 +93,8 @@ describe('UX-06E.D.2.1 selector de representación', () => {
|
|||||||
expect(cards.every(card => card.interpretation.every(line => line !== 'No debe asignarse.'))).toBe(true);
|
expect(cards.every(card => card.interpretation.every(line => line !== 'No debe asignarse.'))).toBe(true);
|
||||||
});
|
});
|
||||||
it('múltiples opciones habilitan el selector, mantienen una representación y cancelan cambios rápidos', () => {
|
it('múltiples opciones habilitan el selector, mantienen una representación y cancelan cambios rápidos', () => {
|
||||||
open(); const first = request('f'); expect(select().disabled).toBe(false);
|
open(); const first = request('f'); expect(panels()).toHaveLength(1);
|
||||||
expect(select().options.map(o => o.value)).toEqual(['f', 'g']); expect(panels()).toHaveLength(1);
|
fixture.componentInstance.selectFigure('g'); fixture.detectChanges();
|
||||||
select().selectionChange.emit({ source: select(), value: 'g' }); fixture.detectChanges();
|
|
||||||
const next = request('g'); expect(first.cancelled).toBe(true); expect(panels()).toHaveLength(1);
|
const next = request('g'); expect(first.cancelled).toBe(true); expect(panels()).toHaveLength(1);
|
||||||
expect(next.request.params.get('periodos')).toBe('2025-S1');
|
expect(next.request.params.get('periodos')).toBe('2025-S1');
|
||||||
fixture.componentInstance.selectFigure('f'); fixture.detectChanges(); expect(next.cancelled).toBe(true);
|
fixture.componentInstance.selectFigure('f'); fixture.detectChanges(); expect(next.cancelled).toBe(true);
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import { ChangeDetectorRef, Component, effect, ElementRef, inject, Input, OnChan
|
|||||||
import { catchError, of, Subscription } from 'rxjs';
|
import { catchError, of, Subscription } from 'rxjs';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
||||||
import { MatSelectModule } from '@angular/material/select';
|
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { Dominio, Indicador, IndicadorMetadatos, Tema } from './indicadores.models';
|
import { Dominio, Indicador, IndicadorMetadatos, Tema } from './indicadores.models';
|
||||||
import { GlobalApplied, IndicadoresMemory } from './indicadores-memory';
|
import { GlobalApplied, IndicadoresMemory } from './indicadores-memory';
|
||||||
@@ -20,26 +18,36 @@ import { IndicadorEu7Escenario } from './indicador-eu7-escenario';
|
|||||||
import { IndicadorTiemposPareados } from './indicador-tiempos-pareados';
|
import { IndicadorTiemposPareados } from './indicador-tiempos-pareados';
|
||||||
import { IndicadorConfirmacionCitologia } from './indicador-confirmacion-citologia';
|
import { IndicadorConfirmacionCitologia } from './indicador-confirmacion-citologia';
|
||||||
import { ID_CONFIRMACION } from './indicadores-confirmacion-citologia';
|
import { ID_CONFIRMACION } from './indicadores-confirmacion-citologia';
|
||||||
|
import { IndicadorHistopatologiaCama } from './indicador-histopatologia-cama';
|
||||||
|
import { ID_HISTOPATOLOGIA } from './indicadores-histopatologia-cama';
|
||||||
import { parTiempos } from './indicadores-tiempos-pareados';
|
import { parTiempos } from './indicadores-tiempos-pareados';
|
||||||
|
import { IndicadorConteosPareados } from './indicador-conteos-pareados';
|
||||||
|
import { parConteos } from './indicadores-conteos-pareados';
|
||||||
|
|
||||||
|
const DOBLE_ANCHO_TEA: readonly string[] = ['M28_casos_por_estado', 'M23_pacientes_evaluados'];
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-indicador-catalog-card',
|
selector: 'app-indicador-catalog-card',
|
||||||
host: { '[class.dual-card]': 'isDual || isEu7 || isConfirmacion || !!tiempos' },
|
host: { '[class.dual-card]': 'isDual || isEu7 || isConfirmacion || isHistopatologia || !!tiempos || !!conteos', '[class.doble]': 'ocupaDos' },
|
||||||
imports: [MatButtonModule, MatCardModule, MatIconModule, MatFormFieldModule, MatSelectModule, IndicadorFigurePanel, IndicadorEu7Escenario, IndicadorTiemposPareados, IndicadorConfirmacionCitologia],
|
imports: [MatButtonModule, MatCardModule, MatIconModule, IndicadorFigurePanel, IndicadorEu7Escenario, IndicadorTiemposPareados, IndicadorConfirmacionCitologia, IndicadorHistopatologiaCama, IndicadorConteosPareados],
|
||||||
template: `
|
template: `
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<header>
|
@if (!conteos) {
|
||||||
<div class="card-identity">
|
<header>
|
||||||
<h2 [id]="titleId" tabindex="-1">{{ indicador.titulo }}</h2>
|
<div class="card-identity">
|
||||||
</div>
|
<h2 [id]="titleId" tabindex="-1" [class.con-ayuda]="dominio === 'tea'">{{ indicador.titulo }}</h2>
|
||||||
</header>
|
</div>
|
||||||
<button class="pin-toggle" mat-button type="button" [attr.aria-pressed]="pinned"
|
</header>
|
||||||
[attr.aria-label]="(pinned ? 'Desfijar indicador' : 'Fijar indicador') + ', ' + indicador.titulo"
|
}
|
||||||
(click)="pinChanged.emit()">
|
@if (!sobrio) {
|
||||||
<mat-icon aria-hidden="true">push_pin</mat-icon>{{ pinned ? 'Desfijar indicador' : 'Fijar indicador' }}
|
<button class="pin-toggle" mat-button type="button" [attr.aria-pressed]="pinned"
|
||||||
</button>
|
[attr.aria-label]="(pinned ? 'Desfijar indicador' : 'Fijar indicador') + ', ' + indicador.titulo"
|
||||||
<div class="catalog-content" [id]="contentId" [attr.aria-labelledby]="titleId">
|
(click)="pinChanged.emit()">
|
||||||
<p class="catalog-metadata">{{ indicador.figuras.length }} figuras publicadas</p>
|
<mat-icon aria-hidden="true">push_pin</mat-icon>{{ pinned ? 'Desfijar indicador' : 'Fijar indicador' }}
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
<div class="catalog-content" [id]="contentId" [attr.aria-labelledby]="conteos ? null : titleId">
|
||||||
|
@if (!sobrio) { <p class="catalog-metadata">{{ indicador.figuras.length }} figuras publicadas</p> }
|
||||||
@if (isEu7) {
|
@if (isEu7) {
|
||||||
<div #visibilityRegion class="eu7-region">
|
<div #visibilityRegion class="eu7-region">
|
||||||
<app-indicador-eu7-escenario [dominio]="dominio" [indicador]="indicador" [tema]="tema" [applied]="applied" [visible]="visible" [metadata]="metadata" (metadataRequested)="loadMetadata()" />
|
<app-indicador-eu7-escenario [dominio]="dominio" [indicador]="indicador" [tema]="tema" [applied]="applied" [visible]="visible" [metadata]="metadata" (metadataRequested)="loadMetadata()" />
|
||||||
@@ -48,21 +56,19 @@ import { parTiempos } from './indicadores-tiempos-pareados';
|
|||||||
<div #visibilityRegion class="confirmacion-region">
|
<div #visibilityRegion class="confirmacion-region">
|
||||||
<app-indicador-confirmacion-citologia [dominio]="dominio" [indicador]="indicador" [tema]="tema" [applied]="applied" [visible]="visible" [metadata]="metadata" (metadataRequested)="loadMetadata()" />
|
<app-indicador-confirmacion-citologia [dominio]="dominio" [indicador]="indicador" [tema]="tema" [applied]="applied" [visible]="visible" [metadata]="metadata" (metadataRequested)="loadMetadata()" />
|
||||||
</div>
|
</div>
|
||||||
|
} @else if (isHistopatologia) {
|
||||||
|
<div #visibilityRegion class="confirmacion-region">
|
||||||
|
<app-indicador-histopatologia-cama [dominio]="dominio" [indicador]="indicador" [tema]="tema" [applied]="applied" [visible]="visible" [metadata]="metadata" (metadataRequested)="loadMetadata()" />
|
||||||
|
</div>
|
||||||
} @else if (tiempos; as par) {
|
} @else if (tiempos; as par) {
|
||||||
<div #visibilityRegion class="tiempos-region">
|
<div #visibilityRegion class="tiempos-region">
|
||||||
<app-indicador-tiempos-pareados [dominio]="dominio" [par]="par" [indicador]="indicador" [tema]="tema" [applied]="applied" [visible]="visible" [metadata]="metadata" (metadataRequested)="loadMetadata()" />
|
<app-indicador-tiempos-pareados [dominio]="dominio" [par]="par" [indicador]="indicador" [tema]="tema" [applied]="applied" [visible]="visible" [metadata]="metadata" (metadataRequested)="loadMetadata()" />
|
||||||
</div>
|
</div>
|
||||||
|
} @else if (conteos; as par) {
|
||||||
|
<div #visibilityRegion class="conteos-region">
|
||||||
|
<app-indicador-conteos-pareados [dominio]="dominio" [par]="par" [indicador]="indicador" [tema]="tema" [applied]="applied" [visible]="visible" />
|
||||||
|
</div>
|
||||||
} @else if (selectedFigure) {
|
} @else if (selectedFigure) {
|
||||||
@if (!pair.length || otherFigures.length) {
|
|
||||||
<mat-form-field appearance="outline" subscriptSizing="dynamic">
|
|
||||||
<mat-label>Representación gráfica</mat-label>
|
|
||||||
<mat-select [value]="selectedFigure" [disabled]="indicador.figuras.length === 1"
|
|
||||||
[attr.aria-label]="'Representación gráfica de ' + indicador.titulo" (selectionChange)="selectFigure($event.value)">
|
|
||||||
@if (pair.length) { <mat-option [value]="pair[0]">Dona y barras</mat-option> }
|
|
||||||
@for (figure of (pair.length ? otherFigures : indicador.figuras); track figure) { <mat-option [value]="figure">{{ figureDisplayName(figure, indicador.figuras) }}</mat-option> }
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
}
|
|
||||||
<div #visibilityRegion class="graphic-region" [class.dual-panels]="isDual">
|
<div #visibilityRegion class="graphic-region" [class.dual-panels]="isDual">
|
||||||
@for (figure of displayFigures; track panelIdentity(figure)) {
|
@for (figure of displayFigures; track panelIdentity(figure)) {
|
||||||
<div class="representation-panel">
|
<div class="representation-panel">
|
||||||
@@ -77,12 +83,13 @@ import { parTiempos } from './indicadores-tiempos-pareados';
|
|||||||
`,
|
`,
|
||||||
styles: `
|
styles: `
|
||||||
:host { display: flex; min-width: 0; margin: 0; }
|
:host { display: flex; min-width: 0; margin: 0; }
|
||||||
mat-card { flex: 1; min-width: 0; padding: clamp(.75rem, 2vw, 1.5rem); background: var(--issste-surface);
|
mat-card { position: relative; flex: 1; min-width: 0; padding: clamp(.75rem, 2vw, 1.5rem); background: var(--issste-surface);
|
||||||
color: var(--issste-text); border: 1px solid var(--issste-border); border-radius: var(--issste-radius); box-shadow: none; }
|
color: var(--issste-text); border: 1px solid var(--issste-border); border-radius: var(--issste-radius); box-shadow: none; }
|
||||||
header { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: var(--issste-space-3); }
|
header { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: var(--issste-space-3); }
|
||||||
.catalog-content { display: flex; flex-direction: column; flex: 1; min-width: 0; }
|
.catalog-content { display: flex; flex-direction: column; flex: 1; min-width: 0; }
|
||||||
.graphic-region { flex: 1; min-width: 0; }
|
.graphic-region { flex: 1; min-width: 0; }
|
||||||
:host(.dual-card) { grid-column: 1 / -1; }
|
:host(.dual-card) { grid-column: 1 / -1; }
|
||||||
|
:host(.doble) { grid-column: span 2; }
|
||||||
.graphic-region { display: grid; grid-template-columns: minmax(0, 1fr); }
|
.graphic-region { display: grid; grid-template-columns: minmax(0, 1fr); }
|
||||||
.representation-panel { display: grid; min-width: 0; grid-template-rows: auto minmax(0, 1fr); }
|
.representation-panel { display: grid; min-width: 0; grid-template-rows: auto minmax(0, 1fr); }
|
||||||
.representation-panel > h3 { margin: 1rem 0 0; overflow-wrap: anywhere; }
|
.representation-panel > h3 { margin: 1rem 0 0; overflow-wrap: anywhere; }
|
||||||
@@ -103,7 +110,8 @@ import { parTiempos } from './indicadores-tiempos-pareados';
|
|||||||
}
|
}
|
||||||
.card-identity { min-width: 0; }
|
.card-identity { min-width: 0; }
|
||||||
h2, p { overflow-wrap: anywhere; }
|
h2, p { overflow-wrap: anywhere; }
|
||||||
h2 { margin: 0; font-family: var(--issste-font-heading); font-weight: 700; font-size: 1.5rem; line-height: 1.25; }
|
h2 { margin: 0; font-family: var(--issste-font-heading); font-weight: 500; font-size: 1.125rem; line-height: 1.3; }
|
||||||
|
h2.con-ayuda { padding-right: 2.5rem; }
|
||||||
.pin-toggle { align-self: start; margin-top: var(--issste-space-1); max-width: 100%; height: auto;
|
.pin-toggle { align-self: start; margin-top: var(--issste-space-1); max-width: 100%; height: auto;
|
||||||
min-width: 48px; min-height: 48px; color: var(--issste-text); }
|
min-width: 48px; min-height: 48px; color: var(--issste-text); }
|
||||||
.pin-toggle mat-icon { flex-shrink: 0; }
|
.pin-toggle mat-icon { flex-shrink: 0; }
|
||||||
@@ -131,12 +139,19 @@ export class IndicadorCatalogCard implements OnChanges, OnDestroy {
|
|||||||
if (this.indicador && this.applied) untracked(() => this.updateNumeric());
|
if (this.indicador && this.applied) untracked(() => this.updateNumeric());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Every domain follows CaMa's mockup: no pin, representation selector or figure count.
|
||||||
|
get sobrio() { return true; }
|
||||||
|
// TEA's stacked case charts span two columns of its three-column grid.
|
||||||
|
get ocupaDos() { return this.dominio === 'tea' && DOBLE_ANCHO_TEA.includes(this.indicador.id); }
|
||||||
get pair() { return dualFigures(this.indicador); }
|
get pair() { return dualFigures(this.indicador); }
|
||||||
get isEu7() { return this.dominio === 'cacu' && this.indicador.id === 'cacu_eu7'; }
|
get isEu7() { return this.dominio === 'cacu' && this.indicador.id === 'cacu_eu7'; }
|
||||||
get isConfirmacion() { return this.dominio === 'cacu' && this.indicador.id === ID_CONFIRMACION; }
|
get isConfirmacion() { return this.dominio === 'cacu' && this.indicador.id === ID_CONFIRMACION; }
|
||||||
|
// CaMa's histopathology by BI-RADS has its own coordinated view, as the cytology confirmation has in CaCu.
|
||||||
|
get isHistopatologia() { return this.dominio === 'cama' && this.indicador.id === ID_HISTOPATOLOGIA; }
|
||||||
// Connected time pairs replace the diagnosis card with one coordinated box plot.
|
// Connected time pairs replace the diagnosis card with one coordinated box plot.
|
||||||
get tiempos() { return parTiempos(this.dominio, this.indicador.id); }
|
get tiempos() { return this.individual ? undefined : parTiempos(this.dominio, this.indicador.id); }
|
||||||
get otherFigures() { return this.indicador.figuras.filter(id => !this.pair.includes(id)); }
|
// Exams and patients of the same finding, drawn together on the exams' card.
|
||||||
|
get conteos() { return parConteos(this.dominio, this.indicador.id); }
|
||||||
get isDual() { return this.pair.includes(this.selectedFigure ?? ''); }
|
get isDual() { return this.pair.includes(this.selectedFigure ?? ''); }
|
||||||
get displayFigures() { return this.isDual ? this.pair : this.selectedFigure ? [this.selectedFigure] : []; }
|
get displayFigures() { return this.isDual ? this.pair : this.selectedFigure ? [this.selectedFigure] : []; }
|
||||||
private updateNumeric() {
|
private updateNumeric() {
|
||||||
@@ -161,6 +176,8 @@ export class IndicadorCatalogCard implements OnChanges, OnDestroy {
|
|||||||
@Input({ required: true }) applied!: GlobalApplied;
|
@Input({ required: true }) applied!: GlobalApplied;
|
||||||
@Input() independentPeriods = false;
|
@Input() independentPeriods = false;
|
||||||
@Input() pinned = false;
|
@Input() pinned = false;
|
||||||
|
// Draws the indicator alone even when it belongs to a connected pair.
|
||||||
|
@Input() individual = false;
|
||||||
@Input() visualProfile: FigureVisualProfile = READABLE_VISUAL_PROFILE;
|
@Input() visualProfile: FigureVisualProfile = READABLE_VISUAL_PROFILE;
|
||||||
readonly pinChanged = output<void>();
|
readonly pinChanged = output<void>();
|
||||||
@ViewChild('visibilityRegion') visibilityRegion?: ElementRef<HTMLElement>;
|
@ViewChild('visibilityRegion') visibilityRegion?: ElementRef<HTMLElement>;
|
||||||
|
|||||||
@@ -5,6 +5,15 @@ p, h3, summary { overflow-wrap: anywhere; }
|
|||||||
.methodology { padding: 1rem; border: 1px solid var(--issste-border); border-radius: var(--issste-radius); }
|
.methodology { padding: 1rem; border: 1px solid var(--issste-border); border-radius: var(--issste-radius); }
|
||||||
.selection-status { font-weight: 600; }
|
.selection-status { font-weight: 600; }
|
||||||
.legend { display: grid; gap: .6rem; margin-block: 1rem; }
|
.legend { display: grid; gap: .6rem; margin-block: 1rem; }
|
||||||
|
.families { display: flex; flex-wrap: wrap; gap: .75rem; }
|
||||||
|
.family { flex: 1 1 16rem; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--issste-border); border-radius: 1rem; background: var(--issste-surface); }
|
||||||
|
.family button { display: inline-flex; align-items: center; gap: .55rem; }
|
||||||
|
.family .parent { width: 100%; justify-content: flex-start; border: 0; border-radius: 0; border-bottom: 1px solid var(--issste-border); font-weight: 650; background: color-mix(in srgb, var(--swatch) 14%, var(--issste-surface)); }
|
||||||
|
.family .children { display: flex; flex-wrap: wrap; gap: .4rem; padding: .55rem; }
|
||||||
|
.family .child { flex: 1 1 8rem; border-radius: .75rem; border-color: color-mix(in srgb, var(--swatch) 55%, var(--issste-border)); background: var(--issste-surface); }
|
||||||
|
.family .parent[aria-pressed=true] { background: color-mix(in srgb, var(--swatch) 24%, var(--issste-surface)); box-shadow: inset 0 -3px 0 var(--swatch); }
|
||||||
|
.family .child[aria-pressed=true] { background: color-mix(in srgb, var(--swatch) 16%, var(--issste-surface)); border-color: var(--swatch); transform: scale(1.03); }
|
||||||
|
.family .swatch { width: .35rem; height: 1.15rem; border: 0; border-radius: .2rem; background: var(--swatch); }
|
||||||
.keys { display: flex; flex-wrap: wrap; gap: .5rem; }
|
.keys { display: flex; flex-wrap: wrap; gap: .5rem; }
|
||||||
.legend > button { justify-self: start; }
|
.legend > button { justify-self: start; }
|
||||||
button { min-height: 44px; max-width: 100%; padding: .5rem .8rem; border: 1px solid var(--issste-border);
|
button { min-height: 44px; max-width: 100%; padding: .5rem .8rem; border: 1px solid var(--issste-border);
|
||||||
@@ -26,6 +35,23 @@ summary { cursor: pointer; padding-block: .75rem; }
|
|||||||
table { border-collapse: collapse; width: 100%; margin-block: 1rem; }
|
table { border-collapse: collapse; width: 100%; margin-block: 1rem; }
|
||||||
th, td { padding: .5rem; text-align: start; border-bottom: 1px solid var(--issste-border); }
|
th, td { padding: .5rem; text-align: start; border-bottom: 1px solid var(--issste-border); }
|
||||||
caption { text-align: start; font-weight: 600; }
|
caption { text-align: start; font-weight: 600; }
|
||||||
|
.histo-meta { display: flex; justify-content: flex-end; align-items: flex-start; gap: .75rem; margin: -.85rem -.65rem 0 0; }
|
||||||
|
.view-context { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; margin: .2rem 0 0; color: var(--issste-text-secondary); font-size: .75rem; line-height: 1.35; }
|
||||||
|
.histo .figure { border-top: 0; }
|
||||||
|
.histo .figure + .figure { border-top: 1px solid var(--issste-border); padding-top: .25rem; }
|
||||||
|
.histo .help { position: relative; display: flex; justify-content: flex-end; padding-bottom: 0; }
|
||||||
|
.histo .help .methodology-toggle { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; min-width: 1.75rem; min-height: 1.75rem; padding: 0; border: 0; border-radius: 50%; font-weight: 800; font-size: 1rem; line-height: 1; background: var(--issste-accent); color: var(--issste-on-accent); }
|
||||||
|
.histo .help .methodology { position: absolute; z-index: 8; top: 100%; right: 0; width: min(34rem, calc(100vw - 2rem)); max-height: 18rem; overflow: auto; background: var(--issste-surface); box-shadow: 0 10px 28px rgb(0 0 0 / .14); }
|
||||||
|
.histo .legend { display: flex; flex-direction: column; gap: 0; margin-block: .15rem 1rem; }
|
||||||
|
.histo .tab-bar { display: flex; align-items: flex-end; gap: .5rem; border-bottom: 1px solid var(--issste-border); }
|
||||||
|
.histo .tabs { display: flex; flex-wrap: wrap; gap: .2rem; min-width: 0; }
|
||||||
|
.histo .tabs .tab { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid transparent; border-bottom: 0; border-radius: .75rem .75rem 0 0; background: transparent; box-shadow: none; }
|
||||||
|
.histo .tabs .tab[aria-selected=true] { background: color-mix(in srgb, var(--swatch) 18%, var(--issste-surface)); border-color: var(--issste-border); box-shadow: inset 0 -3px 0 var(--swatch); font-weight: 700; }
|
||||||
|
.histo .child-groups { display: flex; flex-wrap: wrap; align-items: center; column-gap: 2rem; row-gap: .45rem; padding: .65rem .1rem .1rem; }
|
||||||
|
.histo .tab-panel { display: flex; flex-wrap: wrap; gap: .45rem; }
|
||||||
|
.histo .tab-panel .child { display: inline-flex; align-items: center; gap: .45rem; border-radius: .75rem; border-color: color-mix(in srgb, var(--swatch) 55%, var(--issste-border)); background: var(--issste-surface); }
|
||||||
|
.histo .tab-panel .child[aria-pressed=true] { background: color-mix(in srgb, var(--swatch) 16%, var(--issste-surface)); border-color: var(--swatch); }
|
||||||
|
.histo .tab .swatch, .histo .tab-panel .swatch { display: block; width: .35rem; height: 1em; margin: 0; border: 0; border-radius: .2rem; background: var(--swatch); align-self: center; }
|
||||||
.reading-guide h3 { margin: 0 0 .25rem; }
|
.reading-guide h3 { margin: 0 0 .25rem; }
|
||||||
.reading-guide + .reading-guide { margin-top: 1rem; }
|
.reading-guide + .reading-guide { margin-top: 1rem; }
|
||||||
.reading-guide ul { margin: .5rem 0 0; padding-inline-start: 1.25rem; }
|
.reading-guide ul { margin: .5rem 0 0; padding-inline-start: 1.25rem; }
|
||||||
@@ -34,4 +60,7 @@ app-plotly-chart { --plot-height: 360px; }
|
|||||||
.rate-states { margin: 0; padding-inline-start: 1.25rem; color: var(--issste-text-secondary); }
|
.rate-states { margin: 0; padding-inline-start: 1.25rem; color: var(--issste-text-secondary); }
|
||||||
.rate-states:empty { display: none; }
|
.rate-states:empty { display: none; }
|
||||||
/* Rates on the left, donut on the right (the reverse of EU7). */
|
/* Rates on the left, donut on the right (the reverse of EU7). */
|
||||||
@media (min-width: 1100px) { .figures { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
|
@media (min-width: 1100px) {
|
||||||
|
.figures { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
|
||||||
|
.histo .figure + .figure { border-top: 0; border-inline-start: 1px solid var(--issste-border); padding-top: 0; padding-inline-start: 1rem; }
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<section class="conteos" [attr.aria-label]="indicador.titulo + ', por ' + par.unidades.pacientes.slice(0, -1) + ' y por ' + par.unidades.examenes.slice(0, -1)">
|
||||||
|
@switch (status()) {
|
||||||
|
@case ('deferred') { <p role="status">La vista se cargará al acercarse a esta región.</p> }
|
||||||
|
@case ('loading') { <mat-progress-bar mode="indeterminate" [attr.aria-label]="'Cargando ' + indicador.titulo" /><p role="status">Cargando {{ par.unidades.examenes }} y {{ par.unidades.pacientes }} del mismo periodo…</p> }
|
||||||
|
@case ('empty') { <p role="status">No hay periodos publicados por los dos conteos.</p> }
|
||||||
|
@case ('error') { <div role="alert"><p>{{ message }}</p><button mat-stroked-button type="button" (click)="retry()">Reintentar</button></div> }
|
||||||
|
@case ('incompatible') { <div role="alert"><p>Respuesta incompatible: {{ message }}</p><button mat-stroked-button type="button" (click)="retry()">Reintentar</button></div> }
|
||||||
|
}
|
||||||
|
@if (status() === 'ready' && model; as m) {
|
||||||
|
@let tituloMastografias = 'Porcentaje de mastografías con resultado BI-RADS 4, 5 ó 6 en ' + m.periodo;
|
||||||
|
@let tituloPacientes = 'Porcentaje de pacientes con resultados BI-RADS 4, 5 ó 6 en ' + m.periodo;
|
||||||
|
@if (pages.length > 1) {
|
||||||
|
<nav class="periods" [attr.aria-label]="'Periodos, ' + indicador.titulo">
|
||||||
|
<button type="button" aria-label="Periodo anterior" [disabled]="periodIndex === 0" (click)="changePeriod(-1)">‹</button>
|
||||||
|
<span role="status">{{ m.periodo }}, {{ periodIndex + 1 }} de {{ pages.length }}</span>
|
||||||
|
<button type="button" aria-label="Periodo siguiente" [disabled]="periodIndex === pages.length - 1" (click)="changePeriod(1)">›</button>
|
||||||
|
</nav>
|
||||||
|
}
|
||||||
|
<div class="figures">
|
||||||
|
<section class="figure">
|
||||||
|
<div class="figure-head">
|
||||||
|
<h3>{{ tituloMastografias }}</h3>
|
||||||
|
<div class="help" (mouseenter)="openHelp('examenes')" (mouseleave)="hideHelp('examenes')" (focusin)="openHelp('examenes')" (focusout)="onHelpFocusOut('examenes', $event)">
|
||||||
|
<button type="button" class="help-icon" aria-label="Cómo leer, mastografías por categoría" [attr.aria-expanded]="helpWhich === 'examenes'"
|
||||||
|
[attr.aria-describedby]="helpWhich === 'examenes' ? 'cama-birads-ayuda-mastografias' : null" (click)="toggleHelp('examenes')"><span aria-hidden="true">!</span></button>
|
||||||
|
@if (helpWhich === 'examenes') {
|
||||||
|
<div class="methodology" id="cama-birads-ayuda-mastografias" role="tooltip">Cada mastografía cuenta en su propia categoría.</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if (total) {
|
||||||
|
<app-plotly-chart [figure]="donutFigure!" class="donut-chart" (widthChanged)="ajustarAnchoDona($event)" [showNotes]="false" [label]="tituloMastografias" />
|
||||||
|
} @else { <p role="status">{{ total === null ? 'Dona no disponible: hay celdas suprimidas o sin dato.' : 'Sin ' + par.unidades.examenes + ' en el periodo.' }}</p> }
|
||||||
|
@if (m.sinDato) { <p class="note">Fuera de la dona: {{ texto(m.sinDato) }} {{ par.unidades.examenes }} sin categoría.</p> }
|
||||||
|
</section>
|
||||||
|
<section class="figure">
|
||||||
|
<div class="figure-head">
|
||||||
|
<h3>{{ tituloPacientes }}</h3>
|
||||||
|
<div class="help" (mouseenter)="openHelp('pacientes')" (mouseleave)="hideHelp('pacientes')" (focusin)="openHelp('pacientes')" (focusout)="onHelpFocusOut('pacientes', $event)">
|
||||||
|
<button type="button" class="help-icon" aria-label="Cómo leer, pacientes por categoría" [attr.aria-expanded]="helpWhich === 'pacientes'"
|
||||||
|
[attr.aria-describedby]="helpWhich === 'pacientes' ? 'cama-birads-ayuda-pacientes' : null" (click)="toggleHelp('pacientes')"><span aria-hidden="true">!</span></button>
|
||||||
|
@if (helpWhich === 'pacientes') {
|
||||||
|
<div class="methodology" id="cama-birads-ayuda-pacientes" role="tooltip">La paciente se cuenta una vez con la categoría más alta de sus mastografías en el periodo.</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if (totalPacientes) {
|
||||||
|
<app-plotly-chart [figure]="patientsFigure!" class="donut-chart" (widthChanged)="ajustarAnchoPacientes($event)" [showNotes]="false" [label]="tituloPacientes" />
|
||||||
|
} @else { <p role="status">{{ !m.pacientesVerificados ? 'Dona de pacientes no disponible hasta verificar la definición publicada.' : totalPacientes === null ? 'Dona no disponible: hay celdas suprimidas o sin dato.' : 'Sin ' + par.unidades.pacientes + ' en el periodo.' }}</p> }
|
||||||
|
@if (!m.pacientesVerificados) { <p class="note" role="status">Pacientes pendientes: la versión publicada del indicador de pacientes no es una cuya definición se haya verificado para sumar sus categorías.</p> }
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
@for (note of m.notas; track $index) { <p class="note">{{ note }}</p> }
|
||||||
|
<details class="published-values"><summary>Valores publicados</summary>
|
||||||
|
<div class="table-scroll" role="region" [attr.aria-label]="'Tabla de valores, ' + indicador.titulo" tabindex="0">
|
||||||
|
<table><caption>{{ par.unidades.pacientes | titlecase }} (su categoría más alta) y {{ par.unidades.examenes }}, {{ m.periodo }}</caption>
|
||||||
|
<thead><tr><th scope="col">Familia de BI-RADS</th><th scope="col">{{ par.unidades.pacientes | titlecase }}</th><th scope="col">{{ par.unidades.examenes | titlecase }}</th></tr></thead>
|
||||||
|
<tbody>@for (f of m.filas; track f.id) { <tr><th scope="row">{{ f.etiqueta }}</th><td>{{ textoPacientes(f.pacientes) }}</td><td>{{ texto(f.examenes) }}</td></tr> }</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
}
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
:host { display: block; min-width: 0; }
|
||||||
|
.conteos { min-width: 0; padding-top: var(--issste-space-3); }
|
||||||
|
p, h3, summary { overflow-wrap: anywhere; }
|
||||||
|
.applied-summary, .note { color: var(--issste-text-secondary); }
|
||||||
|
.methodology { padding: 1rem; border: 1px solid var(--issste-border); border-radius: var(--issste-radius); }
|
||||||
|
.figure-head { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
|
||||||
|
.figure-head h3 { margin: 0; }
|
||||||
|
.help { display: flex; flex: none; justify-content: flex-end; }
|
||||||
|
.help .methodology { position: absolute; z-index: 8; inset-block-start: calc(100% + .35rem); inset-inline-end: 0;
|
||||||
|
box-sizing: border-box; inline-size: min(34rem, 100%); background: var(--issste-surface); box-shadow: 0 10px 28px rgb(0 0 0 / .14); }
|
||||||
|
h3 { font-size: 1rem; font-weight: 500; line-height: 1.5; }
|
||||||
|
.periods { display: flex; align-items: center; gap: var(--issste-space-3); }
|
||||||
|
.periods button { min-width: 44px; min-height: 44px; font-size: 1.25rem; color: var(--issste-text); background: var(--issste-surface);
|
||||||
|
border: 1px solid var(--issste-border); border-radius: var(--issste-radius); cursor: pointer; }
|
||||||
|
.periods button:disabled { opacity: .5; cursor: default; }
|
||||||
|
// The two figures share the card in equal halves; one above the other on a narrow card.
|
||||||
|
.help-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; min-width: 1.75rem; min-height: 1.75rem; padding: 0; border: 0; border-radius: 50%; background: var(--issste-accent); color: var(--issste-on-accent); font: inherit; font-weight: 800; line-height: 1; cursor: pointer; }
|
||||||
|
.help-icon:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 3px; }
|
||||||
|
.figures { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
|
||||||
|
.figure + .figure { border-top: 1px solid var(--issste-border); margin-top: var(--issste-space-4); padding-top: var(--issste-space-4); }
|
||||||
|
@media (min-width: 1100px) {
|
||||||
|
.figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||||
|
.figure + .figure { border-top: 0; margin-top: 0; padding-top: 0; border-inline-start: 1px solid var(--issste-border); padding-inline-start: var(--issste-space-6); }
|
||||||
|
}
|
||||||
|
app-plotly-chart { --plot-height: 400px; }
|
||||||
|
// Keep space for the outside labels and let the existing plot viewport scroll on very narrow cards.
|
||||||
|
.donut-chart { --plot-min-width: 230px; }
|
||||||
|
summary { cursor: pointer; padding-block: .75rem; }
|
||||||
|
summary:focus-visible, .table-scroll:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 3px; }
|
||||||
|
.table-scroll { overflow: auto; }
|
||||||
|
table { border-collapse: collapse; width: 100%; margin-block: 1rem; }
|
||||||
|
th, td { padding: .5rem; text-align: start; border-bottom: 1px solid var(--issste-border); }
|
||||||
|
caption { text-align: start; font-weight: 600; }
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
import { ChangeDetectorRef, Component, inject, Input, OnChanges, OnDestroy, signal, SimpleChanges } from '@angular/core';
|
||||||
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
|
import { TitleCasePipe } from '@angular/common';
|
||||||
|
import { combineLatest, Subscription, timeout, TimeoutError } from 'rxjs';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||||
|
import { PlotlyChart } from '../../shared/plotly/plotly-chart';
|
||||||
|
import { Dominio, Indicador, PlotlyFigure, Tema } from './indicadores.models';
|
||||||
|
import { filterCompatibility, GlobalApplied } from './indicadores-memory';
|
||||||
|
import { IndicadoresSnapshots, snapshotKey } from './indicadores-snapshots';
|
||||||
|
import { httpMessage } from './indicadores-http';
|
||||||
|
import { ConteosIncompatibles, donaConteos, donaPacientes, ModeloConteos, modelosConteos, ParConteos, totalExamenes, totalPacientes } from './indicadores-conteos-pareados';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-indicador-conteos-pareados',
|
||||||
|
imports: [MatButtonModule, MatProgressBarModule, PlotlyChart, TitleCasePipe],
|
||||||
|
templateUrl: './indicador-conteos-pareados.html',
|
||||||
|
styleUrl: './indicador-conteos-pareados.scss',
|
||||||
|
})
|
||||||
|
export class IndicadorConteosPareados implements OnChanges, OnDestroy {
|
||||||
|
@Input({ required: true }) dominio!: Dominio;
|
||||||
|
@Input({ required: true }) par!: ParConteos;
|
||||||
|
// The card's indicator (the exams); its partner (the patients) has no card and is requested by id.
|
||||||
|
@Input({ required: true }) indicador!: Indicador;
|
||||||
|
@Input({ required: true }) tema!: Tema;
|
||||||
|
@Input({ required: true }) applied!: GlobalApplied;
|
||||||
|
@Input() visible = true;
|
||||||
|
readonly status = signal<'deferred' | 'loading' | 'ready' | 'empty' | 'error' | 'incompatible'>('deferred');
|
||||||
|
message = '';
|
||||||
|
periodIndex = 0;
|
||||||
|
pages: ModeloConteos[] = [];
|
||||||
|
donutFigure?: PlotlyFigure;
|
||||||
|
patientsFigure?: PlotlyFigure;
|
||||||
|
private readonly snapshots = inject(IndicadoresSnapshots);
|
||||||
|
private readonly changeDetector = inject(ChangeDetectorRef);
|
||||||
|
private subscription?: Subscription;
|
||||||
|
private key = '';
|
||||||
|
private loaded = false;
|
||||||
|
private anchoDona = 390;
|
||||||
|
private anchoPacientes = 390;
|
||||||
|
|
||||||
|
get model(): ModeloConteos | undefined { return this.pages[this.periodIndex]; }
|
||||||
|
get total() { return this.model ? totalExamenes(this.model) : null; }
|
||||||
|
get totalPacientes() { return this.model ? totalPacientes(this.model) : null; }
|
||||||
|
texto(n: number | null) { return n === null ? 'Sin dato' : n.toLocaleString('es-MX'); }
|
||||||
|
textoPacientes(n: number | null) { return n === null && this.model && !this.model.pacientesVerificados ? 'Pendiente' : this.texto(n); }
|
||||||
|
helpWhich: 'examenes' | 'pacientes' | null = null;
|
||||||
|
private helpPinned: 'examenes' | 'pacientes' | null = null;
|
||||||
|
toggleHelp(which: 'examenes' | 'pacientes') {
|
||||||
|
if (this.helpPinned === which) { this.helpPinned = null; this.helpWhich = null; return; }
|
||||||
|
this.helpPinned = which;
|
||||||
|
this.openHelp(which);
|
||||||
|
}
|
||||||
|
openHelp(which: 'examenes' | 'pacientes') {
|
||||||
|
this.helpWhich = which;
|
||||||
|
}
|
||||||
|
hideHelp(which: 'examenes' | 'pacientes') {
|
||||||
|
if (this.helpPinned === which) return;
|
||||||
|
if (this.helpWhich === which) this.helpWhich = null;
|
||||||
|
}
|
||||||
|
onHelpFocusOut(which: 'examenes' | 'pacientes', event: FocusEvent) {
|
||||||
|
const next = event.relatedTarget;
|
||||||
|
if (next instanceof Node && (event.currentTarget as Node).contains(next)) return;
|
||||||
|
if (this.helpPinned === which) this.helpPinned = null;
|
||||||
|
if (this.helpWhich === which) this.helpWhich = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
const key = snapshotKey(this.dominio, this.indicador, this.applied) + JSON.stringify([this.par.examenes, this.par.pacientes, this.indicador.tipos_periodo]);
|
||||||
|
if (key !== this.key) {
|
||||||
|
this.subscription?.unsubscribe(); this.key = key; this.loaded = false; this.clear();
|
||||||
|
if (!this.visible) { this.status.set('deferred'); return; }
|
||||||
|
this.load();
|
||||||
|
} else if (this.visible && !this.loaded) this.load();
|
||||||
|
else if (this.model && changes['tema']) this.draw();
|
||||||
|
}
|
||||||
|
retry() { if (this.visible) this.load(); }
|
||||||
|
private clear() { this.pages = []; this.periodIndex = 0; this.donutFigure = undefined; this.patientsFigure = undefined; }
|
||||||
|
private load() {
|
||||||
|
this.subscription?.unsubscribe();
|
||||||
|
this.loaded = true; this.clear();
|
||||||
|
const compatibility = filterCompatibility(this.applied, this.indicador.tipos_periodo);
|
||||||
|
if (this.indicador.id !== this.par.examenes || this.indicador.contrato !== 'C2' || !compatibility.compatible) {
|
||||||
|
this.message = !compatibility.compatible ? compatibility.reason : 'El catálogo no publica el conteo necesario para esta vista.';
|
||||||
|
this.status.set('incompatible'); return;
|
||||||
|
}
|
||||||
|
const key = this.key;
|
||||||
|
const periods = this.applied.selection.mode === 'explicit' ? [...this.applied.selection.periodos] : undefined;
|
||||||
|
this.status.set('loading');
|
||||||
|
this.subscription = combineLatest([
|
||||||
|
this.snapshots.datos(this.dominio, this.par.examenes, this.applied.tipo, periods, this.indicador.version),
|
||||||
|
this.snapshots.datos(this.dominio, this.par.pacientes, this.applied.tipo, periods),
|
||||||
|
]).pipe(timeout({ first: 40000 })).subscribe({
|
||||||
|
next: ([examenes, pacientes]) => {
|
||||||
|
if (key !== this.key) return;
|
||||||
|
try {
|
||||||
|
this.pages = modelosConteos(this.par, examenes, pacientes, this.applied.tipo);
|
||||||
|
// The most recent period first; navigation goes back.
|
||||||
|
this.periodIndex = Math.max(0, this.pages.length - 1);
|
||||||
|
this.draw(); this.status.set(this.model ? 'ready' : 'empty');
|
||||||
|
} catch (error) { this.failure(error); }
|
||||||
|
},
|
||||||
|
error: error => { if (key === this.key) this.failure(error); },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
private failure(error: unknown) {
|
||||||
|
this.clear();
|
||||||
|
this.message = error instanceof TimeoutError ? 'El servicio tardó demasiado. Vuelve a intentar.'
|
||||||
|
: error instanceof ConteosIncompatibles ? error.message : httpMessage(error);
|
||||||
|
this.status.set(error instanceof ConteosIncompatibles || error instanceof Error && !(error instanceof HttpErrorResponse) && !(error instanceof TimeoutError)
|
||||||
|
? 'incompatible' : 'error');
|
||||||
|
this.changeDetector.markForCheck();
|
||||||
|
}
|
||||||
|
changePeriod(step: number) {
|
||||||
|
if (![1, -1].includes(step) || !this.pages[this.periodIndex + step]) return;
|
||||||
|
this.periodIndex += step; this.draw();
|
||||||
|
}
|
||||||
|
ajustarAnchoDona(ancho: number) {
|
||||||
|
if (ancho === this.anchoDona) return;
|
||||||
|
this.anchoDona = ancho;
|
||||||
|
const m = this.model;
|
||||||
|
if (m) this.donutFigure = donaConteos(m, this.par, this.tema, ancho);
|
||||||
|
}
|
||||||
|
ajustarAnchoPacientes(ancho: number) {
|
||||||
|
if (ancho === this.anchoPacientes) return;
|
||||||
|
this.anchoPacientes = ancho;
|
||||||
|
const m = this.model;
|
||||||
|
if (m) this.patientsFigure = donaPacientes(m, this.par, this.tema, ancho);
|
||||||
|
}
|
||||||
|
private draw() {
|
||||||
|
const m = this.model;
|
||||||
|
if (!m) return;
|
||||||
|
this.donutFigure = donaConteos(m, this.par, this.tema, this.anchoDona);
|
||||||
|
this.patientsFigure = donaPacientes(m, this.par, this.tema, this.anchoPacientes);
|
||||||
|
this.changeDetector.markForCheck();
|
||||||
|
}
|
||||||
|
ngOnDestroy() { this.subscription?.unsubscribe(); }
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ import { describePeriods, filterCompatibility, GlobalApplied } from './indicador
|
|||||||
import { IndicadoresSnapshots, snapshotKey } from './indicadores-snapshots';
|
import { IndicadoresSnapshots, snapshotKey } from './indicadores-snapshots';
|
||||||
import { httpMessage } from './indicadores-http';
|
import { httpMessage } from './indicadores-http';
|
||||||
import { percentText } from './indicadores-format';
|
import { percentText } from './indicadores-format';
|
||||||
import { stratifiedCapabilities } from './indicadores-stratified';
|
import { declaraEstrato, stratifiedCapabilities } from './indicadores-stratified';
|
||||||
import { barras, Celda, clic, dona, ESTRATO, Escenario, Eu7Incompatible, Modelo, modelo, porcentaje,
|
import { barras, Celda, clic, dona, ESTRATO, Escenario, Eu7Incompatible, Modelo, modelo, porcentaje,
|
||||||
periodosCompatibles, Seleccion, seleccionEtiqueta } from './indicadores-eu7-escenario';
|
periodosCompatibles, Seleccion, seleccionEtiqueta } from './indicadores-eu7-escenario';
|
||||||
|
|
||||||
@@ -101,7 +101,8 @@ export class IndicadorEu7Escenario implements OnChanges, OnDestroy {
|
|||||||
const compatibility = filterCompatibility(this.applied, this.indicador.tipos_periodo);
|
const compatibility = filterCompatibility(this.applied, this.indicador.tipos_periodo);
|
||||||
if (this.dominio !== 'cacu' || this.indicador.id !== 'cacu_eu7' || this.indicador.contrato !== 'C2'
|
if (this.dominio !== 'cacu' || this.indicador.id !== 'cacu_eu7' || this.indicador.contrato !== 'C2'
|
||||||
|| !this.indicador.figuras.includes('fig_c2_donas') || !this.indicador.figuras.includes('fig_c2_barras')
|
|| !this.indicador.figuras.includes('fig_c2_donas') || !this.indicador.figuras.includes('fig_c2_barras')
|
||||||
|| !stratifiedCapabilities(this.indicador).includes(ESTRATO) || !compatibility.compatible) {
|
|| !(stratifiedCapabilities(this.indicador).includes(ESTRATO) || declaraEstrato(this.indicador, ESTRATO))
|
||||||
|
|| !compatibility.compatible) {
|
||||||
this.message = !compatibility.compatible ? compatibility.reason : 'El catálogo no publica las capacidades necesarias para esta vista EU7.';
|
this.message = !compatibility.compatible ? compatibility.reason : 'El catálogo no publica las capacidades necesarias para esta vista EU7.';
|
||||||
this.status.set('incompatible'); return;
|
this.status.set('incompatible'); return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { Component, Input } from '@angular/core';
|
||||||
|
import { MatCardModule } from '@angular/material/card';
|
||||||
|
|
||||||
|
/** A figure the catalog does not publish yet: it keeps its place and title, with no figure and no number. */
|
||||||
|
@Component({
|
||||||
|
selector: 'app-indicador-figura-pendiente',
|
||||||
|
imports: [MatCardModule],
|
||||||
|
template: `
|
||||||
|
<mat-card>
|
||||||
|
<h2>{{ titulo }}</h2>
|
||||||
|
<p class="estado" role="status"><strong>Integración pendiente.</strong> {{ detalle }}</p>
|
||||||
|
<div class="vacio">Sin datos publicados</div>
|
||||||
|
</mat-card>
|
||||||
|
`,
|
||||||
|
styles: `
|
||||||
|
:host { display: flex; min-width: 0; margin: 0; }
|
||||||
|
mat-card { flex: 1; min-width: 0; padding: clamp(.75rem, 2vw, 1.5rem); background: var(--issste-surface); color: var(--issste-text);
|
||||||
|
border: 1px solid var(--issste-border); border-radius: var(--issste-radius); box-shadow: none; }
|
||||||
|
h2 { margin: 0; font-family: var(--issste-font-heading); font-weight: 500; font-size: 1.125rem; line-height: 1.3; overflow-wrap: anywhere; }
|
||||||
|
p { margin: var(--issste-space-3) 0 0; overflow-wrap: anywhere; }
|
||||||
|
.estado { color: var(--issste-text-secondary); }
|
||||||
|
.vacio { display: grid; place-items: center; min-height: 12rem; margin-top: var(--issste-space-3); color: var(--issste-text-secondary);
|
||||||
|
border: 1px dashed var(--issste-border); border-radius: var(--issste-radius); }
|
||||||
|
`,
|
||||||
|
})
|
||||||
|
export class IndicadorFiguraPendiente {
|
||||||
|
@Input({ required: true }) titulo!: string;
|
||||||
|
@Input() detalle = 'Este indicador aún no está publicado por el catálogo institucional.';
|
||||||
|
}
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
<mat-card class="figure-card" [class.dark]="tema === 'oscuro'" [attr.data-render-source]="state.source" [attr.aria-label]="dominio + ', ' + selected?.id + ', ' + figuraId" [attr.aria-busy]="state.status === 'loading'">
|
<mat-card class="figure-card" [class.sin-marco]="ayudaRedonda" [class.dark]="tema === 'oscuro'" [attr.data-render-source]="state.source" [attr.aria-label]="dominio + ', ' + selected?.id + ', ' + figuraId" [attr.aria-busy]="state.status === 'loading'">
|
||||||
@if (selected) {
|
@if (selected && ayudaRedonda) {
|
||||||
|
<app-indicador-ayuda [etiqueta]="'Cómo leer: ' + selected.titulo" (opened)="!metadata && metadataRequested.emit()">
|
||||||
|
<ul class="ayuda-lista">@for (line of interpretation; track $index) { <li>{{ line }}</li> }</ul>
|
||||||
|
@if (state.status === 'ready' && state.footnotes?.length) {
|
||||||
|
@for (note of state.footnotes; track $index) { <p class="ayuda-nota">{{ note }}</p> }
|
||||||
|
}
|
||||||
|
</app-indicador-ayuda>
|
||||||
|
} @else if (selected) {
|
||||||
<section class="interpretation" [class.expanded]="methodologyExpanded()">
|
<section class="interpretation" [class.expanded]="methodologyExpanded()">
|
||||||
<button mat-stroked-button type="button" class="methodology-toggle"
|
<button mat-stroked-button type="button" class="methodology-toggle"
|
||||||
[attr.aria-label]="'Cómo leer esta figura: ' + selected.titulo + ', ' + dominio + ', ' + figuraId"
|
[attr.aria-label]="'Cómo leer esta figura: ' + selected.titulo + ', ' + dominio + ', ' + figuraId"
|
||||||
@@ -37,8 +44,10 @@
|
|||||||
@if (hasNoVisibleValues(figure)) {
|
@if (hasNoVisibleValues(figure)) {
|
||||||
<p class="state" role="status">{{ state.emptyMessage ?? 'No hay valores visibles para la selección. No se puede determinar la causa a partir de la figura recibida.' }}</p>
|
<p class="state" role="status">{{ state.emptyMessage ?? 'No hay valores visibles para la selección. No se puede determinar la causa a partir de la figura recibida.' }}</p>
|
||||||
}
|
}
|
||||||
<h2 class="figure-title" [innerHTML]="figureTitle(figure, selected?.titulo ?? '')"></h2>
|
@if (!ayudaRedonda) {
|
||||||
<p class="figure-id">Figura: {{ figureDisplayName(figuraId, selected?.figuras ?? []) }}</p>
|
<h2 class="figure-title" [innerHTML]="figureTitle(figure, selected?.titulo ?? '')"></h2>
|
||||||
|
<p class="figure-id">Figura: {{ figureDisplayName(figuraId, selected?.figuras ?? []) }}</p>
|
||||||
|
}
|
||||||
} @else {
|
} @else {
|
||||||
<p class="state" role="status">{{ !selected?.figuras?.length ? 'El indicador no tiene figuras disponibles.' : 'Completa una selección válida para consultar la figura.' }}</p>
|
<p class="state" role="status">{{ !selected?.figuras?.length ? 'El indicador no tiene figuras disponibles.' : 'Completa una selección válida para consultar la figura.' }}</p>
|
||||||
}
|
}
|
||||||
@@ -83,7 +92,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (state.status === 'ready' && state.donutLegend?.length) {
|
@if (state.status === 'ready' && state.highlight; as h) {
|
||||||
|
<div class="highlight-legend" [class.sin-estado]="ayudaRedonda" role="group" aria-label="Resaltar partes de la figura">
|
||||||
|
<p class="highlight-status" role="status" aria-live="polite">Selección: {{ highlightStatus }}</p>
|
||||||
|
<button type="button" class="highlight-back" (click)="highlightBack()" [disabled]="!highlightSelection.group && !highlightSelection.item">Volver</button>
|
||||||
|
@for (row of highlightRows(h); track row.group?.id ?? '') {
|
||||||
|
<div class="highlight-keys" role="group" [attr.aria-label]="row.group ? row.group.label + ' y sus categorías' : 'Categorías'">
|
||||||
|
@if (row.group; as g) {
|
||||||
|
<button type="button" class="highlight-group" [attr.aria-pressed]="highlightSelection.group === g.id" (click)="highlight('group', g.id)"><span class="legend-swatch" [style.background]="g.color" aria-hidden="true"></span>{{ g.label }}</button>
|
||||||
|
}
|
||||||
|
@for (c of row.items; track c.id) {
|
||||||
|
<button type="button" [attr.aria-pressed]="highlightSelection.item === c.id" [disabled]="!!highlightSelection.group && c.group !== highlightSelection.group"
|
||||||
|
[attr.aria-label]="c.short ? c.label : null" (click)="highlight('item', c.id)"><span class="legend-swatch" [style.background]="c.color" aria-hidden="true"></span>{{ c.short ?? c.label }}</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else if (state.status === 'ready' && state.donutLegend?.length) {
|
||||||
<div class="donut-static-legend" role="list" aria-label="Leyenda de la dona">
|
<div class="donut-static-legend" role="list" aria-label="Leyenda de la dona">
|
||||||
@for (entry of state.donutLegend; track entry.label) {
|
@for (entry of state.donutLegend; track entry.label) {
|
||||||
<span class="donut-static-legend__item" role="listitem">
|
<span class="donut-static-legend__item" role="listitem">
|
||||||
@@ -94,7 +119,7 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="plot-slot" [hidden]="state.status !== 'ready'">
|
<div class="plot-slot" [hidden]="state.status !== 'ready'">
|
||||||
<app-plotly-chart [style.--plot-height]="state.plotHeight ? state.plotHeight + 'px' : (state.hierarchy || state.donutLegend ? '440px' : null)" [style.--plot-min-width]="chartMinimumWidth ? chartMinimumWidth + 'px' : null" [showNotes]="false" [label]="dominio + ', ' + selected?.id + ', ' + figuraId" [figure]="chartFigure" (widthChanged)="reportPlotWidth($event)" (plotClick)="plotClicked($event)" />
|
<app-plotly-chart [style.--plot-height]="state.plotHeight ? state.plotHeight + 'px' : (state.hierarchy || state.donutLegend || state.highlight ? '440px' : null)" [style.--plot-min-width]="chartMinimumWidth ? chartMinimumWidth + 'px' : null" [showNotes]="false" [label]="dominio + ', ' + selected?.id + ', ' + figuraId" [figure]="chartFigure" (widthChanged)="reportPlotWidth($event)" (plotClick)="plotClicked($event)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<div class="figure-footer" [hidden]="state.status !== 'ready'">
|
<div class="figure-footer" [hidden]="state.status !== 'ready'">
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user