A patch for parsing 4 header rows of a CSV file.
When parsing csv into variables 4 headers lines can be present:
- 1st header- name (populates the label and name)
- 2nd header - variable definition;
- 3rd header- unit or date or code. Patterns expected are:
- For physical variables: unit:name_of_unit;max|value;min|value;precision|value For example - unit:gram;max|25.05;min|0.00;precision|4
- For coded variables: codes:key|value;key|value .... and so on for as many key|value pairs
- For date variables: date:date format
- 4th header - missing values pairs: code1|reason1; code2|reason2 ... and so on.
I have tested it but not enough to know if it will work for everyone.
Any comments on the pair separators are welcome. They can be easily changed.
On a side note I have discovered that one way of speeding up the editing of variables is to disable the Option Element module. This module adds a different display for "key|value" in a textarea. In testing I find that disabling the module will speed up adding a variable by ~ 3x. Not supper fast but much more responsive. My guess is that there are just too many jquery calls and they are repeated for every variable. So when you add the 10th variable all the 1st variable’s jquery calls are repeated 10x and so forth cascading until it just blows up.