Vectr.Consulting built a bot to support government officials with the official death registration and allows for a faster such registration. The bot automatically reads doctors handwriting on Belgian death certificates with an accuracy of 47% of certificates of the usable data set correctly predicted.
When a person deceases, a medical practitioner must certify the deceased state of the person. There is a standard form which the physician fills in. This is done “in the field,” through a handwritten statement on the form, which is subsequently forwarded to other officials under sealed envelope.
The physician officially records the direct cause of death, and, if known, any secondary causes.
Example death certificate
Reading a doctor’s handwriting is feasible using a trained neural network. Careful image processing is essential in the success of the project.
For neural-network predictions we and the text matching, calculate confidence levels which can be used to define thresholds for automation purposes.
A Hard-to-read handwriting
The solution for reading the handwriting is a combination of image processing, deep learning, and natural language processing.
The raw data are one-page scans, provided as a PDF.
This yields smaller images than the originals, and there is no link from the images back to the original scans.
One of the most difficult parts of building a neural network is to decide about its architecture. We defined a five-layer convolutional neural net (CNN), a two-layer recurrent neural net (RNN), and one connectionist temporal classification (CTC) layer. This NN trains on character and punctuation-mark recognition, and can therefore also recognize new texts consisting of the same characters and punctuation marks.
Before training the NN, we need to examine the quality of the data. We want to train the NN with data for which we have high confidence that the labels are correct. All certificates with insufficient confidence in the correctness of the label are excluded from the training, validation, and test set. The exclusion rules result in 128.794 from 344.365 certificates being excluded, which is 38% of the total. Remain 215.571 well-labeled certificates. Of these, we define 60% as training set, 20% as validation set, and 20% as test set.
Training occurs on text lines, not on full certificates, and after segmentation.
The NN model assigns a confidence level to each prediction. For the test set, we know whether or not the prediction exactly matches the label. For each prediction we know whether it falls within the set of correct predictions or the set of incorrect predictions. We can then plot the number of predictions within a confidence range.
Predictions with high confidence is what we aim for. These predictions should be accurate enough. The results show indeed that the number of correct predictions peaks at 95–100% confidence, and is lower at lower confidence levels.
The neural network is primarily trained to recognize letters. It doesn’t know about words. This means that NN predictions form a sequence of letters, and although it has some sense of sequential probabilities, some letter combinations do not make sense.
If the NN prediction exactly matches words from the dictionary, we do not perform further NLP. If there is already an exact match, we would only risk modifying a correct prediction and turn it into something else. So the text matching to words described below is only done when the NN prediction does not exactly match dictionary words.
Thus, the NN is trained on character recognition only, and we use additional NLP to improve the matching to the dictionary.
Eager to learn more about this success story? Contact Ignaz, Bruno or Jony or continue reading on the website of Vectr.Consulting.