Nutrient Mapping (Draft)

In the following chapters we describe the key data structures for querying and updating food-consumption to food-composition resolution.

Food Composition Resolution (Web API)

A design goal for the FoodCompositionResolutionService is, that it should be possible to implemented it as a Web API client, that queries another system.

An alternative solution: From Dita download a mapping-todo file (generated on a per Campaign basis), which can be imported into an external system.

Nutrition experts then process those todos resulting in an updated FCDB download, that is then used as a configuration resource for Dita. (perhaps use the BlobStore)

Aspects to consider:

  • Download - get the entire FoodCompositionRepository in serialized form, such that the caller can recreate it in memory.

  • Lookup - for a given QualifiedMapKey, that represents a food-consumption, return a FoodComposition. (Optional, since redundant with download.)

  • Update - for a given QualifiedMapKey, that represents a food-consumption, set a FoodComposition. (This invalidates any previous download.)

  • Search - for a given QualifiedMapKey, that represents a food-consumption, list some candidate FoodComposition(s). (Search can be realized against the downloaded FoodCompositionRepository.)

    • Could be hinted by already existing entries, based on some similarity metric.

    • Could be hinted by name-similarity search.

Food Composition Resolution
Figure 1. Food Composition Resolution

Food Composition Resolution (via Nutrient Mapping)

Food consumption data (typically originating from recall 24 interviews) is mapped to a food composition database, that provides (measured or estimated) chemical food component quantities for a given specific food.

In effect, consumed quantities of food X can be resolved to consumed quantities of nutrients A, B, C, etc..

Food Composition Resolution
Figure 2. Food Composition Resolution
1 respondentAlias: first part of the secondary object identifier
2 date: second part of the secondary object identifier

APPENDIX

Nutrient Mapping Example

qmap.yaml file using fully qualified identifiers, involving systems GD and BLS:

Qualified Map (Yaml)
# qmap.yaml example
qualifiedMapEntries:
- source: "SID[GD-AT20240507,00010]"
  qualifier:
  - "SID[GD-AT20240507,0200]"
  - "SID[GD-AT20240507,0310]"
  - "SID[GD-AT20240507,0400]"
  - "SID[GD-AT20240507,0801]"
  - "SID[GD-AT20240507,1009]"
  - "SID[GD-AT20240507,1200]"
  target: "SID[BLS-3.02,K130192]"
- source: "SID[GD-AT20240507,00010]"
  qualifier:
  - "SID[GD-AT20240507,0200]"
  - "SID[GD-AT20240507,0310]"
  - "SID[GD-AT20240507,0400]"
  - "SID[GD-AT20240507,0801]"
  - "SID[GD-AT20240507,1200]"
  target: "SID[BLS-3.02,K130192]"

Mapping Todo Example (Todo Reporter)

NutriDb is an external system that acts as FCDB and has a nutrient mapping process implemented. (Can create mapping-todo-tasks for humans to process.)

Mapping Todo
Figure 3. Mapping Todo
Dita GloboDiet (short format)
00010;0204,0301,0402,0801
00025
00100;0204,2800,0334,0400,0999
Todo data-transfer-format (QualifiedMap with empty targets)
# nutmap-todo.yaml example
qualifiedMapEntries:
- source: "SID[GD-AT20240507,00010]"
  qualifier:
  - "SID[GD-AT20240507,0204]"
  - "SID[GD-AT20240507,0301]"
  - "SID[GD-AT20240507,0402]"
  - "SID[GD-AT20240507,0801]"
  target: null
- source: "SID[GD-AT20240507,00025]"
  qualifier:
  target: null
- source: "SID[GD-AT20240507,00100]"
  qualifier:
  - "SID[GD-AT20240507,0204]"
  - "SID[GD-AT20240507,2800]"
  - "SID[GD-AT20240507,0334]"
  - "SID[GD-AT20240507,0400]"
  - "SID[GD-AT20240507,0999]"
  target: null
NutriDb internal format
gd:N10,gd:F2.04,gd:F3.01,gd:F4.02,gd:F8.01
gd:N25
gd:N100,gd:F2.04,gd:F28.00,gd:F3.34,gd:F4.00,gd:F9.99