Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: dynamic unit #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions sourcedocs/docs/variable/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,48 @@ The instance variable includes both:
</l:VariableRepresentation>
</l:Variable>
```

## Dynamic unit

The unit of a numeric variable can be dynamically computed (for instance: currency in function of country).

Then, the computation expression is defined in the `MeasurementUnit`. The element must have the `controlledVocabularyName` attribute with the value `"personalizedUnit"` to mark the unit as a dynamic (_personalized_) unit.
The `¤` character is used as a delimiter around variable references.

The following example contains a dynamic unit, whose expression is another variable:

```xml
<l:Variable>
<r:Agency>fr.insee</r:Agency>
<r:ID>m4k4z3gv</r:ID>
<r:Version>1</r:Version>
<l:VariableName>
<r:String xml:lang="fr-FR">NUMBER_DYNAMIC_UNIT</r:String>
</l:VariableName>
<r:Label>
<r:Content xml:lang="fr-FR">NUMBER_DYNAMIC_UNIT label </r:Content>
</r:Label>
<r:SourceParameterReference>
<r:Agency>fr.insee</r:Agency>
<r:ID>m4k17d1t-QOP-m4k14nmx</r:ID>
<r:Version>1</r:Version>
<r:TypeOfObject>OutParameter</r:TypeOfObject>
</r:SourceParameterReference>
<r:QuestionReference>
<r:Agency>fr.insee</r:Agency>
<r:ID>m4k17d1t</r:ID>
<r:Version>1</r:Version>
<r:TypeOfObject>QuestionItem</r:TypeOfObject>
</r:QuestionReference>
<l:VariableRepresentation>
<r:NumericRepresentation>
<r:MeasurementUnit controlledVocabularyName="personalizedUnit">¤m4k4zcl6-QOP-m4k5disb¤ </r:MeasurementUnit>
<r:NumberRange>
<r:Low isInclusive="true">1</r:Low>
<r:High isInclusive="true">10</r:High>
</r:NumberRange>
<r:NumericTypeCode controlledVocabularyID="INSEE-CIS-NTC-CV">Decimal</r:NumericTypeCode>
</r:NumericRepresentation>
</l:VariableRepresentation>
</l:Variable>
```