# datazooidu/datazoo-kyb-fullname-parser architecture

> Architecture diagram of the GitHub repository datazooidu/datazoo-kyb-fullname-parser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/datazooidu/datazoo-kyb-fullname-parser
- Repository: https://github.com/datazooidu/datazoo-kyb-fullname-parser

## Overview

##### Project type and purpose
- This is an open-source Go library (module) whose sole purpose is to parse “full name” strings into their constituent parts (title, first, middle, last, nick, suffix).
- It exposes one public API: ParseFullname(string) → ParsedName struct.

##### File structure
- Top level contains:
- parser.go – implementation of the parsing logic
- parser_test.go – unit tests that validate the parser
- go.mod & go.sum – Go module definition
- README.md, LICENSE, .gitignore – metadata and documentation
- There are no separate “frontend” or “backend” directories; it’s a single-library codebase.

##### README for additional insights
- It documents the API signature and the fields of ParsedName.
- It references a precursor library, implying a need for extensibility and rule-based patterns.

##### Components & interactions
a. Main components
- Client / Consumer (any Go code that calls ParseFullname)
- FullNameParser API layer (public function signature)
- Core Parsing Pipeline (internals of parser.go):
– Preprocessor
– Tokenizer
– Format Detector / Rule Matcher
– Part Extractor
– Assembler → ParsedName
- ParsedName struct (output data model)
- Test Harness (parser_test.go)
b. Relationships & data flow
1. Client invokes ParseFullname(inputString)
2. Preprocessor normalizes whitespace/punctuation
3. Tokenizer splits string into tokens
4. Format Detector matches against known name‐format rules
5. Part Extractor assigns tokens to title, first, middle, last, nick, suffix
6. Assembler bundles them into ParsedName
7. Returned to caller
8. Test Harness invokes the same entry point with sample inputs and asserts outputs
c. Architectural patterns / design principles
- Pipeline (each stage has a single responsibility)
- Test-driven design (see parser_test.go)
d. Key technologies & libraries
- Go standard library (strings, regexp)
- Go modules for dependency management
- Go testing package (for parser_test.go)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Public API Boundary
    subgraph "Public API"
        direction TB
        ClientConsumer["Client / Consumer"]:::client
        ParseFullName["ParseFullname(string)"]:::api
    end

    ClientConsumer -->|"calls"| ParseFullName

    %% Core Parsing Pipeline
    subgraph "Core Parsing Pipeline"
        direction TB
        Preprocessor["Preprocessor"]:::stage
        Tokenizer["Tokenizer"]:::stage
        FormatDetector["Format Detector / Rule Matcher"]:::stage
        PartExtractor["Part Extractor"]:::stage
        Assembler["Assembler"]:::stage
    end

    ParseFullName --> Preprocessor
    Preprocessor --> Tokenizer
    Tokenizer --> FormatDetector
    FormatDetector --> PartExtractor
    PartExtractor --> Assembler
    Assembler --> ParsedName

    %% Output Data Model
    ParsedName["ParsedName struct"]:::data

    %% Rule DB for extensibility
    RuleDB["Rule DB / Config Loader"]:::config
    RuleDB -.-> FormatDetector

    %% Test Harness
    subgraph "Test Harness"
        direction TB
        TestHarness["parser_test.go"]:::test
    end

    TestHarness -->|"invokes"| ParseFullName
    TestHarness -->|"asserts output on"| ParsedName

    %% Project Artifacts
    subgraph "Project Artifacts"
        direction TB
        ModuleDef["go.mod"]:::artifact
        DepMgmt["go.sum"]:::artifact
        README["README.md"]:::artifact
        LICENSE["LICENSE"]:::artifact
        Gitignore[".gitignore"]:::artifact
    end

    %% Click Events
    click ParseFullName "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/parser.go"
    click Preprocessor "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/parser.go"
    click Tokenizer "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/parser.go"
    click FormatDetector "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/parser.go"
    click PartExtractor "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/parser.go"
    click Assembler "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/parser.go"
    click ParsedName "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/parser.go"
    click TestHarness "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/parser_test.go"
    click ModuleDef "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/go.mod"
    click DepMgmt "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/go.sum"
    click README "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/README.md"
    click LICENSE "https://github.com/datazooidu/datazoo-kyb-fullname-parser/tree/master/LICENSE"
    click Gitignore "https://github.com/datazooidu/datazoo-kyb-fullname-parser/blob/master/.gitignore"

    %% Styles
    classDef client fill:#a2f5a2,stroke:#2d862d,color:#000
    classDef api fill:#b2f7b2,stroke:#2d862d,color:#000
    classDef stage fill:#ace7ff,stroke:#005f8f,color:#000
    classDef data fill:#ffd59e,stroke:#b87300,color:#000
    classDef test fill:#d3d3d3,stroke:#7f7f7f,color:#000
    classDef artifact fill:#f0f0f0,stroke:#999999,color:#000
    classDef config fill:#fff2a8,stroke:#bf8f00,color:#000
```
