degrees.py


Overview

The degrees.py module provides a simple lookup utility for mapping between educational degree identifiers (IDs) and their corresponding degree names. It includes predefined mappings for various academic degrees, primarily in Chinese and English, and offers two straightforward functions to convert from ID to name and vice versa.

This file is designed to serve as a centralized reference for degree codes used within the larger InfiniFlow system, enabling consistent and error-free translation between numeric/string codes and human-readable degree names. It is useful in contexts such as user profiles, academic records, or any component where degree information needs to be normalized or validated.


Classes and Functions

This module does not define any classes; it only contains constants and functions.

Constants

TBL

TBL_


Functions

get_name(id)

def get_name(id: str) -> str:
>>> get_name("3")
'博士'

>>> get_name(94)
'EMBA'

>>> get_name("999")
''

get_id(nm)

def get_id(nm: str) -> str:
>>> get_id("博士")
'3'

>>> get_id("MBA")
'6'

>>> get_id("mba")  # Case insensitive due to upper()
'6'

>>> get_id("Unknown Degree")
''

Implementation Details


System Interaction


Diagram: Module Function Flow

flowchart TD
    A[get_id(nm)] -->|Uses| B[TBL_ Dictionary]
    C[get_name(id)] -->|Uses| D[TBL Dictionary]

    subgraph Dictionaries
        B
        D
    end

    style Dictionaries fill:#f9f,stroke:#333,stroke-width:1px

Summary

The degrees.py file is a focused utility module within the InfiniFlow project that provides straightforward mappings between degree IDs and degree names. It ensures consistent interpretation of academic degree codes across the system with minimal overhead and simple API functions.


End of degrees.py documentation