Code4PuertoRico / covid19-pr-api

COVID-19 Open API for Datasets in Puerto Rico
21 stars 5 forks source link

OCR pipeline for extracting the data from daily reports #2

Open pedrocruzio opened 4 years ago

pedrocruzio commented 4 years ago

Create a pipeline to upload a report from the log. I'm thinking the easiest way would be with a small web app that does the following:

  1. Home page shows instructions to upload a report and an upload box
  2. Images and PDFs can be dragged and dropped onto the upload box
  3. After the report has been uploaded, the server will extract the text and display it in CSV, JSON, and plain text.

Afterwards, we might be able to start adding the data to the API with a cron job.

froi commented 4 years ago

I'll take a stab at this.

froi commented 4 years ago

Dandole un vistazo rapido utilizando libs de Python Pillow y Pytesseract se puede sacar el texto de las imagenes. Tome la imagen de 3-24-2020.md

El texto se extrae de la siguiente forma:

RESULTADOS DE PRUEBAS PARA COVID-19

Fecha de actualización de datos: 24 de marzo de 2020
Total de casos nuevos desde último informe: 12
* Departamento de Salud ú
* Administración de Veteranos:
* Laboratorios Privados: 1

RESUMEN DE RESULTADOS DE PRUEB)

Total Total Laboratorios Total PR

Resultado Salud Veteranos — privados e
Positivos 34 16 1 51 88
Negativos 254 48 15 317 545
Pendientes 70 36 108 214 368
Total 358 100 124 582 100.0
DESCRIPCIÓN DE CASOS POSITIVOS:
7 Frecuencia Porciento
Característica a eS
Sexo
* Femenino 16 320
* Masculino 34 68.0
*No disponible 1
¡Grupo de edad
*20-29 3 60
*30-39 9 18.0
* 40-49 7 14.0
* 50-59 7 14.0
* 60-69 10 20.0
*70-79 9 18.0
* 80-89 5 10.0
Promediotd.e. 56.3 118.0
*No disponible 1
¡Región
* Arecibo 0 0.0
* Bayamón 2 4.0
* Caguas 3 60
“Fajardo 1 20
* Mayagúez 9 18.0
* Metro 34 68.0
* Ponce 1 20
*No disponible 1
Sintomático
«sí 20 952
*No 1 48
*No disponible 30

Horrible pero trabajable. Voy a crear un pequeño PoC para esto. Comments and ideas welcome.

froi commented 4 years ago

Quick and dirty example here https://github.com/Code4PuertoRico/ocr_poc