Skip to main content

Module models

Module models 

Source
Expand description

Data models for worker demographics and identifiers.

This module is intentionally logic-free: it defines the types that flow through the matching engine but contains no matching code itself. See crate::matcher for the engine and crate::normalizer for the text transformations that the matcher applies to these fields.

All public types here are Serialize + Deserialize so they round-trip through JSON, MessagePack, or any other serde format.

§Building a worker

Prefer Worker::builder over constructing the struct literal — the builder accepts impl Into<String> so call-sites can pass &str, String, or owned values interchangeably.

use worker_matcher::{Gender, Worker};
use chrono::NaiveDate;

let p = Worker::builder()
    .uk_nhs_number("9434765919")
    .given_name("Dafydd")
    .family_name("Jones")
    .date_of_birth(NaiveDate::from_ymd_opt(1980, 5, 15).unwrap())
    .gender(Gender::Male)
    .build();

assert_eq!(p.given_name.as_deref(), Some("Dafydd"));
assert_eq!(p.gender, Some(Gender::Male));

Structs§

Address
Physical address used as supporting evidence in worker matcher.
PassportBook
A passport book — country of issue, book number, and optional effective date range.
Worker
Core worker demographic data structure.
WorkerBuilder
Fluent builder for Worker.

Enums§

BloodType
ABO + RhD blood type used as supporting evidence in worker matcher.
Gender
Gender/sex classification used to compare two Worker records.