← Back to team overview

dhis2-devs team mailing list archive

Re: [Bug 483096] Re: Orgunit shortname field should be as long as name field in db

 

Hi Lars, Knut

The problem happens frequently when trying to import data (actually
metadata), for example from a spreadsheet.  Typically there will be just
names.  Importing the name (and leaving the short name blank) fails because
of the uniqueness constraint.  So the next logical approach is to try import
the short name the same as the "long" name.  This also can fail because the
name is too long and if it becomes truncated it frequently fails the
uniqueness constraint.  (This seems to particularly happen with attempts to
import questionnaires where it seems we have whole sentences which people
want to assign to dataelement name.  This approach is wrong.  It is better
to have dataelements q1, q2, q3 etc with the text added as description.)

As you know I would like to see the uniqueness of names being used as little
as possible but I know the uniqueness is relied upon currently at various
points in the program.  We might weed these out but that is probably not the
job of 2009.

The best workaround I can come up with is, during import, to simply generate
a random string of the required length (eg a uuid) to use where (i) there is
no shortname provided and (ii) the long name is too long to be used as
shortname.  The other approach we might want to consider is name mangling
"smart" truncation as was done with the old dos 8.3 filenames.  Mind you the
result will be nonsensical anyway.  As these short names are most useful in
HCI contexts both the above approaches imply a certain amount of manual
fixup is required after the import.

Cheers
Bob

2009/11/16 Knut Staring <knutst@xxxxxxxxx>

> 2009/11/16 Lars Helge Øverland <larshelge@xxxxxxxxx>
>
>>
>>
>> On Mon, Nov 16, 2009 at 10:20 AM, Knut Staring <knutst@xxxxxxxxx> wrote:
>>
>>> 2009/11/16 Lars Helge Øverland <larshelge@xxxxxxxxx>
>>>
>>> > So your proposed solution is to keep the length but remove the
>>>> > uniqueness?
>>>> >
>>>> >
>>>> Nope that constraint is also relied upon. I guess people who are doing
>>>> manual imports can change the length constraint in the database at their
>>>> own
>>>> risk.
>>>>
>>>
>>> The issue is the same if we use the import routine: How do we deal with
>>> thousands of orgunit imports? What do you currently do with long names?
>>>
>>>
>> Which import routine are you referring to..?
>>
>
> I was thinking of the DXF import. We had discussions during the
> Connectathon about being able to import metadata (and data) from a
> predefined Excel template,
> https://blueprints.launchpad.net/dhis2/+spec/import-data, which would be
> transformed to DXF2.
>
> Knut
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs<https://launchpad.net/%7Edhis2-devs>
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs<https://launchpad.net/%7Edhis2-devs>
> More help   : https://help.launchpad.net/ListHelp
>
>

References