Skip to content

Nm1Segment

Nm1Segment models the X12 NM1 individual/organizational name segment, one of the most heavily reused segments across 837/835/277 transactions for naming any party in the transaction (subscriber, patient, provider, payer, and more). When entity type "1" is set, the party is treated as a person with last/first/middle/prefix/suffix name parts; any other entity type is treated as an organization with a single name field (BR-047). Fill() also composes a single CompleteName string from the parsed parts (BR-048), and optional trailing elements are written only when populated (BR-059).

Purpose

  • Represents the NM1 segment identity via SegmentId returning the literal "NM1" (BR-020).
  • Carries EntityIdentifierCode classifying which party role this instance represents, and EntityType distinguishing a person ("1") from an organization (any other value) (BR-047).
  • For a person, writes/reads LastName, FirstName, MiddleName, NamePrefix, and NameSuffix; for an organization, writes/reads a single OrganizationName (BR-047).
  • Composes CompleteName on Fill() as LastName + NameSuffix + ", " + FirstName + " " + MiddleName for a person, or as OrganizationName for an organization (BR-048).
  • Writes MiddleName, NamePrefix, NameSuffix, IdentificationCodeQualifier, and IdentificationCode on Build() only when they are non-empty (BR-059).

Context

  • Namespace: SAIF.Common.Files.Edi.Segments
  • Assembly/package: SAIF.Framework.Common.Files

Public members

Member Signature Purpose
SegmentId string SegmentId { get; } Returns the literal X12 segment identifier "NM1".
EntityIdentifierCode string EntityIdentifierCode { get; set; } Code identifying which party role this NM1 instance represents (NM101), element 1.
IsForPerson bool IsForPerson { get; set; } Recomputed on both Build() and Fill() as EntityType == "1"; drives whether person or organization name fields are used (BR-047).
EntityType string EntityType { get; set; } The entity-type qualifier code (NM102): "1" for a person, any other value for an organization (NM102), element 2 (BR-047).
OrganizationName string OrganizationName { get; set; } The organization's name (NM103), used when EntityType is not "1" (BR-047).
LastName string LastName { get; set; } The person's last name (NM103), used when EntityType is "1" (BR-047).
FirstName string FirstName { get; set; } The person's first name (NM104), used when EntityType is "1".
MiddleName string MiddleName { get; set; } The person's middle name (NM105), written on Build() only when populated (BR-059).
NamePrefix string NamePrefix { get; set; } The person's name prefix (NM106), written on Build() only when populated (BR-059).
NameSuffix string NameSuffix { get; set; } The person's name suffix (NM107), written on Build() only when populated (BR-059); also appended into CompleteName (BR-048).
IdentificationCodeQualifier string IdentificationCodeQualifier { get; set; } The qualifier for IdentificationCode (NM108), written on Build() only when populated (BR-059).
IdentificationCode string IdentificationCode { get; set; } The party's identification code value (NM109), written on Build() only when populated (BR-059).
CompleteName string CompleteName { get; set; } The composed display name for the party, computed by Fill() from either the person's name parts or the organization name (BR-048); not written by Build().
Build IEdiSegment Build() Creates a SegmentBuilder("NM1"), adds EntityIdentifierCode and EntityType, then branches on IsForPerson to add either the person name parts (with optional fields only when populated) or OrganizationName, and finally adds IdentificationCodeQualifier/IdentificationCode only when populated, returning the built segment (BR-047, BR-059).
Fill void Fill(IEdiSegment segment) Reads EntityIdentifierCode/EntityType, branches on IsForPerson to populate either the person name parts or OrganizationName, composes CompleteName accordingly, and reads IdentificationCodeQualifier/IdentificationCode (BR-047, BR-048).
Parse static Nm1Segment Parse(IEdiSegment segment) Instantiates a new Nm1Segment, calls Fill(segment) on it, and returns it.

Sources

  • Common\SAIF.Common.Files\Edi\Segments\Nm1Segment.cs