khaeru / sdmx

SDMX information model and client in Python
https://sdmx1.readthedocs.io
Apache License 2.0
23 stars 17 forks source link

Extend `.parse_item_description` #138

Open khaeru opened 11 months ago

khaeru commented 11 months ago

After the initial version added in #137 (per #133), looking at the Codelist=IMF:CL_AREA(1.15) specimen reveals some nuanced uses.

For each of these either improve the parser (if not too complex) or add an explicit statement in the docs (+ test) that such usage is not supported.

Also check:

Maybe support:

  1. Multiple lines. Search for matching lines among all those in the description, last-to-first; assert there is only one parseable line.
  2. Parenthetical comments:
    A1 - CA - CL (from 2010) - CO (from 2020) - MX - US

    These could be separated and returned as a third item in each tuple, e.g. (sub, "CL", "from 2010")

  3. Expressions following a more narrative description and a ";" on the same line:
    W12=sum of (ISO 3166-1 alpha-2) partner countries; W12=W1-1A-W19

Probably too complex:

  1. Parentheses:
    D5A = D5 - (BR + CA + CN + IN + JP + RU + CH +US)
  2. Ellipses:
    5AA+5B+…+5Z+7A+…7M
  3. Expressions in parentheses following text:
    Reference / counterpart area (W2.W0+W1.W2)