Skip to content

Proposal: Add FLEX (coming from #680 and is an unseparable part of it.) #694

@mother10

Description

@mother10

FLEX

FLEX_STRUCTURE :=

n FLEX <Text>                         {1:1}  g8:FLEX
  +1 TYPE <Text>                      {1:M}  g8:FLEX-TYPE
  +1 PHRASE <Text>                  {1:1}  g8:PHRASE
    +2 LANG <Language>              {0:1}  g7:LANG
  +1 CONTENTS <Text>                  {1:1}  g8:CONTENTS
  +1 RESN <List:Enum>                 {0:1}  g8:RESN
  +1 <<NOTE_STRUCTURE>>               {0:1}

A FLEX structure allows flexible encoding of additional typed values within records, that are specific to a document, template, or local practice. It supports structured value recording even when the type is not part of standard GEDCOM fields.
It processes lots of possibilities as DATA, NOT as a new structure or a new TAG.
When you look at the accompanying enumtable you see the DATA-types under the TYPE column. It has all DATA types GEDCOM understands. And some more because of my TEMPLATE and STICKY proposal.

And I added a couple that can be seen as a DATATYPE although in current GEDCOM they are not mentioned like that. Like NOTE and ADDRPLUS. Those are structures, but they contain DATA.

Software can handle a FLEX in 1 and the same way, no matter what DATA it processses.
Only thing needed is that once in the software code is written to process that DATA type.
As soon as thats done, we can add as many lines of this DATAtype we want.

@albertemmerich
Remember you mentioned a RESEARCH type as you wanted to be able to have special researcher notes?

Now look at how easy this can be implemented with a FLEX. All we need to do is add 1 extra line in the FLEX enumtable, and because the processing of a FLEX NOTE is programmed once already, we could keep adding lines for all things we want to be treated as a `NOTE but we wanted to call different.

We want a TODO, ok great we add 1 line saying this is a TODO type,
fill in the fields the correct way, and we have a TODO

without having to program anything extra !!!

So nothing changes in the software and I guess that will please developers.

Now how easy do you want it to be!

And if we would make things very easy for developers, we hand them the enumtables as a MYSQL downloadable files, each time we add or change some lines.
Discussion about a new event could be easy, and it would not have to take until a new release to add just those (changed) lines of an enum.

I tried to make GEDCOM datadriven, as much as possible. Following the saying we once used way back in 1971 when I started programming:

Good declarations do half of the job !

If you define your data smart, it takes less code and less trouble to introduce something new.
Adding a line does not have to change the code of software. And if the table is a bit more difficult, as with the events, we add an extra column that "defines" the actions software should take for a certain event. And we add an extra table with these actions.
Now all software has to do is go over the event it finds in the TEMPLATE, run over the event-table till it finds the correct line, and look in that extra column for the actions it has to take.
You define and program the actions once, and you never have to touch them again anymore.

That is the way my proposal was constructed. Thats why it took so much time, as those tables are realy important and should be carefully crafted to make sure things work.

FLEX can be the answer to #692 and probably more.

Some of you asked what the data driven meant, well THIS is what I call datadriven.
My proposal #680 s full of those enumtables. Realy huge ones.

Do people want a new EVENT, ok we add a line or we add an extra keyword for a line that already has that kind of event, so we do not unnessarily keep adding lines.

Do we want an extra ROLE, ok same thing. Do we want an extra ENTITY type, same thing too.

Rules

  • FLEX can only be used inside TEMPLATE, STICKY, ASSET, PROOF or GROUP.
  • Unless it is decided it can be implemented in GEDCOM 7.1 there it could be used on more places.
    That is up to the committee.

Ok now back to FLEX

What is FLEX and how does it look?
It consists of a FLEX tag followed by one or more subordinate lines that define its meaning.

By using FLEX, a lot of the maybe dozens and more widespread _SILLYTAG's, can be changed into user readable information, while the software processing it, can deal with it, without having to know the real meaning, or its definition or otherwise. If a FLEX later will have to be replaced by an offcial GEDCOM tag, because that FLEX is so widespread and often used, it deserves its own tag, its likely that software can do that, without much user assistance. (By comparing the PHRASE of the FLEX, with the _SILLYTAG's tagname.)

  • The TYPE line declares one or more types describing the structure of the CONTENTS. If multiple types are given, they must be separated by a comma and a space. The TYPE's appear on the same line as FLEX, separated from FLEX by 1 space.

  • The CONTENTS line contains the value, matching the declared TYPE. In certain case this line can be followed by 2 CONT some text, in case the FLEX type is a NOTE-type enum.

  • The PHRASE line must be present and must exactly match the label of the field on the original document or template. This ensures that software can display or print human-readable information even if it does not interpret the TYPE or CONTENTS. The PHRASE line appears directly after the FLEXline.

  • LANG, defines the language of the PHRASE.

  • NOTE can be used for special remarks about this specific FLEX.

  • RESN, with this the user can decide if the information of this FLEX should be presented in the outputs.

Rules:
  • TYPE values must be valid entries from the FLEX-TYPE enumeration. For readability they must be put directly behind the FLEXtag, separated from it by 1 space, like this: FLEX DECIMAL, CURR, USD. So the TYPEtag itself does not show. And, for instance with CURR, the chosen currency value itself, also goes on that same line. Same for UNIT.
  • The only allowed combination of TYPEs as for now is with CURR or UNIT behind AMOUNT, DECIMAL, or INTEGER.
  • Parsers must treat the contents as an ordered list.
  • Use of TEXT as a TYPE is allowed only if no more precise type is applicable. For instance, do not use TEXT to represent "1944-06-06" or "12500.00"; use DATE and DECIMAL, respectively.
  • The PHRASE must reflect the exact label used on the source document to help users recognize the field's meaning.
    • This allows software to:
      • display fields using user-recognizable labels,
      • disambiguate similar fields (e.g., two different monetary amounts),
      • and support output of human-readable versions even without interpreting the underlying TYPE/CONTENTS.

$\color{Coral}\large{\textbf{Important! GEDCOM 8 changes:}}$

In this PR FLEX has been given a restriction:

  • It can only be used inside TEMPLATE, STICKY, ASSET, or GROUP.
    This way it does not interfere with current GEDCOM7.

If this PR would be accepted, it is always possible to extend the use of FLEX to other places in GEDCOM. So we maybe could already add this to GEDCOM 7.1

Example 1: Single typed value
1 FLEX DATE
2 PHRASE "Date of Transfer"
2 CONTENTS 1944-06-06

In this case "Date of Transfer" does NOT have its own GEDCOM tag, so a FLEX is used instead.

Example 2: Combined typed value (decimal amount with currency)
1 FLEX DECIMAL, CURR, USD
2 PHRASE "Property Value."
2 CONTENTS 12500.00
2 NOTE "Transferred to widow"

Value of the property on a will.

Example 3: Typed field in a STICKY from an inheritance template
0 @ST0043@ STICKY
1 TYPE FINANCE, ACCOUNTS "Inheritance Share: Savings Account at Miami Credit Union"
2 PHRASE "Savings Account at Miami Credit Union"
1 ROLE ASSET
1 FLEX DECIMAL, CURR, USD
2 PHRASE "Savings"            /* Text as on the original certificat */
2 CONTENTS 12500.00
1 NOTE "Savings inherited by Anna Harrison from George Harrison."

g8:enumset-FLEXTYPE

This enumset defines the type of the CONTENTS that follows the tag FLEX.
Each FLEX block includes a PHRASE and a CONTENTS line, optionally followed by one or more CONT lines. This table describes how CONTENTS is interpreted based on its TYPE.

TYPE Description Multiline NOTE-type CONTENTS Value
ACCOUNTNR An account number, such as for a bank account. Interpreted as a string. value
ADDRESS Structured address data. ADDRESS_STRUCTURE follows under CONTENTS. ADDR
ADDRPLUS Extended address structure. ADDRPLUS_STRUCTURE follows under CONTENTS. ADDR
AMOUNT Raw numeric quantity or size. value
ANNOTATION Annotated remark, such as in a census or bible. Treated like an inline NOTE. NOTE
ARRAY A tuple array. Only simple 2-column tuples allowed. Multiline required. ARRAY
BOOLEAN A truth value: TRUE or FALSE. value
CURR Currency code (ISO 4217), e.g., USD, EUR. value
DATETIME A DateValue, combined date and time using 1 DATE and 2 TIME. DATE + TIME
DATExx GEDCOM-compliant date where xx clarifies intent: DATEV, DATEE, DATEP, etc. DATE
DECIMAL Decimal number, e.g., 12500.00 value
DESCRIPT Short description. One-liner. For longer text, use NOTE. value
HEX Hexadecimal string. value
INTEGER Whole number without decimals. value
LANDSIZE Area or size of land or estate. May include units (e.g., "5 acres"). value
MATERIAL Material of an object (e.g., "wood", "linen"). value
NAME Full name without structure parsing. value
NOTE Free-text remark. Treated like an inline NOTE. NOTE
OBJECT Label or ID of a tangible item. Not a pointer. value
PERCENT Percent (0–100), can include decimals. value
PERCENTR Percent ratio, may exceed 100%. value
REGNUMBER Identifying registration or case number. May include alphanumerics. value
ROLE Functional role or designation (e.g., heir, witness). value
RESEARCH Special research type note. NOTE
TEXT Fallback free-text. Not for structured data. NOTE
TITLE Honorific or title (e.g., "Dr.", "Queen"). value
UNIT Unit of measurement (e.g., acre, meter, foot, pennyweight). value
URL Valid file path or web URL. value

🧾 Notes

  • The Multiline column indicates whether the type supports/encourages CONT lines after CONTENTS.
  • The NOTE-type column marks types that behave like inline NOTEs — they render and wrap identically and allow CONT.
  • The CONTENTS Value column shows what the CONTENTS line itself should contain:
    • value means raw content (e.g., number, string).
    • NOTE, ADDR, or ARRAY means that tag name appears literally in the CONTENTS line.
  • ⚠️ Parsers must distinguish between value and tagname in CONTENTS.
  • 🧠 DATExx supports disambiguation when the DATE's meaning (exact/approx/range/etc.) isn't clear from context, unlike regular GEDCOM event structures.

💬 Suffixes for DATExx

Suffix Meaning TAGS
DATE date [calendar D] [[day D] month D] year [D epoch]
DATEV General DateValue [ date / DatePeriod / dateRange / dateApprox ]
DATEE Exact date day D month D year
DATEA Approximate date (%s"ABT" / %s"CAL" / %s"EST") D date
DATEP Period (e.g., "BET 1890 AND 1900") [ %s"TO" D date ]
/ %s"FROM" D date [ D %s"TO" D date ]
DATER Date range %s"BET" D date D %s"AND" D date
/ %s"AFT" D date
/ %s"BEF" D date
DATERS Date restriction (e.g., "BEF 1860") %s"FROM" / %s"TO" / %s"BET" / %s"AND" / %s"BEF"
/ %s"AFT" / %s"ABT" / %s"CAL" / %s"EST"
  • This enumeration defines the list of valid types that can appear in a FLEX structure's TYPE line.
  • New types may be added over time. Unrecognized types must be ignored or flagged.
  • Each type adds meaning to the associated CONTENTS value(s). Parsers and tools must validate types against this list for interoperability.
  • 🧾 TEXT must not be used to encode structured values (like numbers, currency, or dates) in string form. Always use the appropriate type. TEXT is a fallback only.
  • (NOTE-like enum value), this means this FLEX-type is to be handled like an inline NOTE including the tag NOTE.
  • Multiline, this FLEX type is a multiline type, like NOTE or ARRAY, see the examples.

💬 Comments on FLEX Type Handling

:::example
These are examples for a NOTE, an ARRAY, and an ANNOTATION:

1 FLEX NOTE                   /* FLEX re4placement of a normal inline NOTE */
2 PHRASE description on form
2 CONTENTS NOTE
3 CONT First line of text
3 CONT another textline
1 FLEX ARRAY                  /* DNA values */
2 PHRASE DNA values
2 CONTENTS ARRAY
3 CONT (rs123456, A)
3 CONT (rs234567, T)
3 CONT (rs345678, G)
1 FLEX ANNOTATION             /* An annotation, which is always of type NOTE */
2 PHRASE Annotation in a Census
2 CONTENTS NOTE
3 CONT First line of annotation
3 CONT another annotated line

These are examples for DATEP, DATETIME and an ADDRESS:

1 FLEX DATEP                  /* A Dateperiod */
2 PHRASE Dateperiod of event
2 CONTENTS FROM 1850 TO 1880

1 FLEX DATETIME
2 PHRASE Birth Date and time
2 CONTENTS DATETIME
3 DATE 18 SEP 1832
3 TIME 12:45

1 FLEX ADDRESS
2 PHRASE Address of laboratory
2 CONTENTS ADDR 43 Mainstreet /* ADDR1, ADDR2, ADDR3 are deprecated so street and nr follow ADDR!! */
3 CITY Cristal Lake
~ ~ ~                         /* Other lines of the address structure */

:::

:::note
During draft there was also an ENUM:

  • ENUM: A value from a predefined list of allowed values. (Use cautiously.)
  • If used, CONTENTS must reference a known enum value, and we’d likely need a way to specify which enum set is being used (like PEDI, SEX, or a user-defined list).
  • 🚫 ENUM has been excluded for now due to the need for explicit reference to an enumeration list, which is not yet defined in the spec. It could be used/defined as 1 FLEX ENUM, PEDI, ADOPTED

$\color{Coral}{\textsf{ENUM might be too ambiguous. Might want to drop for now unless a specific use-case exists.}}$

:::

Some other FLEX-TYPE Specifications

  • Each FLEX-TYPE value defines the structure and interpretation of the associated CONTENTS. This section describes the expected format and usage rules for common FLEX-TYPE values.
  • Each value in a multi-part CONTENTS line must exactly match its corresponding type in the FLEX declaration, by position.
FLEX-TYPE Description Example
BOOLEAN Must be one of: TRUE, FALSE (uppercase). Example: 1 CONTENTS TRUE
CODE A short, predefined value from a controlled vocabulary or government list. Example: 1 CONTENTS "C-01" (case and format depend on the code system used)
CURR Currency code following ISO 4217. Always combined with DECIMAL or INTEGER Example: 1 CONTENTS INTEGER, USD or 1 CONTENTS DECIMAL, EUR
LANDSIZE Land size measurement. First value must be numeric (DECIMAL); second value is a unit label (TEXT). Example: 1 CONTENTS 3.75, ACRE
Non-SI or historical units (e.g., "BUNDER", "MORGEN", "MUD") are permitted as quoted text.
PERCENT A numeric value representing a percentage. Example: 1 CONTENTS 25.0 (meaning 25%)

Look in the examples file for many more FLEXes !

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions