Creating a Historical Migration Dataset from Finnish Church Records, 1800–1920

Ari Vesalainen, Jenna Kanerva, Aïda Nitsch, Kiia Korsu, Ilari Larkiola, Laura Ruotsalainen, Filip Ginter

Abstract: This article presents a large-scale effort to create a structured dataset of internal migration in Finland between 1800 and 1920 using digitized church moving records. These records, maintained by Evangelical-Lutheran parishes, document the migration of individuals and families and offer a valuable source for studying historical demographic patterns. The dataset includes over six million entries extracted from approximately 200,000 images of handwritten migration records. The data extraction process was automated using a deep learning pipeline that included layout analysis, table detection, cell classification, and handwriting recognition. The complete pipeline was applied to all images, resulting in a structured dataset suitable for research. The dataset can be used to study internal migration, urbanization, and family migration, and the spread of disease in preindustrial Finland. A case study from the Elimäki parish shows how local migration histories can be reconstructed. The work demonstrates how large volumes of handwritten archival material can be transformed into structured data to support historical and demographic research.

Introduction

Historical documents serve as a vital repository for social scientists, yet they are often characterized by significant "noise" that complicates large-scale analysis. Between 1800 and 1920, Finnish Evangelical-Lutheran parishes meticulously documented the movement of individuals and families in and out of their jurisdictions. These records, while rich in demographic detail, exist as handwritten tables with highly inconsistent layouts. Challenges range from fading ink and skewed pages to a mix of preprinted forms and entirely hand-drawn entries.

Example of a handwritten migration record from the 19th century.

Manual transcription of the approximately 200,000 double-page openings is logistically and economically unfeasible. Furthermore, standard Optical Character Recognition (OCR) technology typically fails when confronted with handwritten, tabular data where structural markers like lines are weak or absent. This research presents an automated, scalable deep learning pipeline designed to "understand" these complex table structures and transcribe 19th-century handwriting with the precision required for quantitative historical research.

The Automated Extraction Pipeline

The researchers developed a modular pipeline that approaches data extraction as a multi-stage computer vision and natural language processing task. The process begins with a two-stage de-skewing method. Using a YOLO (You Only Look Once) pose detection model, the system identifies six key points on a page, followed by a second "zoomed-in" YOLO model to refine these points. This high-precision alignment is foundational for all subsequent steps.

Table structure detection follows, combining YOLO for broad cell detection with DBSCAN clustering to infer missing cells. For fine-grained line detection, the team employed Mask R-CNN, an instance segmentation model capable of pixel-level precision, which is essential for processing degraded documents. Before transcription, a classifier categorizes cells as single-line, multi-line, repetition, or empty. This step optimizes computational resources by skipping empty cells and prevents the handwriting model from generating "hallucinated" text.

The core transcription is handled by TrOCR, a transformer-based encoder-decoder model fine-tuned on a massive corpus of 700,000 lines of historical Finnish and Swedish text. Finally, the pipeline incorporates a novel post-correction step using GPT-4o-mini. By recognizing that years follow a logical sequence within a book, the LLM can infer correct dates by analyzing the context of surrounding pages, correcting errors that a purely visual model might miss.

Dataset Composition

The resulting "Finnish Migration Records 1800–1920" dataset contains approximately 6.2 million extracted records. The primary source material consists of roughly 200,000 images from 2,781 books across 468 parishes.

Breakdown of layout types across the digitized images.

As shown in the data breakdown, nearly half of the images (47.07%) feature hand-drawn layouts, which present the greatest challenge for automated extraction. Preprinted forms account for 39.48%, while the remainder consists of half-tables, free text, and other miscellaneous formats. The diversity of these layouts underscores the necessity of the robust, multi-stage detection approach employed by the researchers.

Key Results and Insights

The pipeline demonstrated remarkable efficiency, processing the entire 200,000-image collection in just four days using parallelization on NVIDIA V100 GPUs. Structural accuracy was high, with table detection achieving an F1-score of 97%, and row/column detection ranging between 95% and 97%.

While the Character Error Rate (CER) for the HTR model was 0.19, numeric data such as dates and page numbers proved more reliable, with a 65.8% exact match rate. A case study of the Elimäki parish confirmed the dataset's utility for reconstructing local migration volumes. Although only 8% of extracted parish names matched modern master lists perfectly, 72% were recoverable through simple edit-distance matching, highlighting the phonetic nature of historical spellings.

Limitations and Future Work

Despite its success, the pipeline faces ongoing challenges. Tables spanning across two pages are sometimes incorrectly split, a problem the authors intend to address through "stitching" post-processing methods. Additionally, the phonetic spelling of place names—where Swedish-speaking clerks wrote Finnish names as they heard them—makes mapping to modern locations difficult. Future efforts will focus on specialized LLM tools to normalize historical orthography and improving line detection for the older, hand-drawn portions of the archive.

The complete dataset is now openly available on Zenodo, providing a massive new resource for studying urbanization, family migration, and the spread of disease in preindustrial Finland.

Summary updated

BibTeX
@article{vesalainen2025creating,
  author = {Ari Vesalainen and Jenna Kanerva and Aïda Nitsch and Kiia Korsu and Ilari Larkiola and Laura Ruotsalainen and Filip Ginter},
  title = {{Creating a Historical Migration Dataset from Finnish Church Records, 1800\–1920}},
  journal = {Journal of Open Humanities Data},
  year = {2025},
  doi = {10.5334/johd.345},
}
Figure