Thanks Stephen, We will update the documentation, it should definitely have a full example in addition to the minimal example that is there currently.
Knut On Mon, Feb 13, 2017 at 4:16 PM, Stephen Macauley < [email protected]> wrote: > Thanks Ant for your input! > > > > So in debugging this further using the mapping from the Java source file > (see below snippet from organisationUnitsFromCsv method in > https://github.com/dhis2/dhis2-core/blob/fb50a8c3c34ba5a27f30c9268bab92 > 41aef3f15d/dhis-2/dhis-services/dhis-service-dxf2/ > src/main/java/org/hisp/dhis/dxf2/csv/DefaultCsvImportService.java), it > turns out that UUID is not a valid column (as stated in the Developer > Guide) and was causing the out of order problem. > > > > I have attached a sample of a working file including Feature Type and > Coordinates as I am sure someone else will encounter this problem. > > > > if ( values != null && values.length > 0 ) > > { > > OrganisationUnit object = new OrganisationUnit(); > > setIdentifiableObject( object, values ); > > String parentUid = getSafe( values, 3, null, 230 ); // > Could be UID, code, name > > object.setShortName( getSafe( values, 4, object.getName(), > 50 ) ); > > object.setDescription( getSafe( values, 5, null, null ) ); > > object.setOpeningDate( getMediumDate( getSafe( values, 6, > "1970-01-01", null ) ) ); > > object.setClosedDate( getMediumDate( getSafe( values, 7, > null, null ) ) ); > > object.setComment( getSafe( values, 8, null, null ) ); > > object.setFeatureType( FeatureType.valueOf( getSafe( > values, 9, "NONE", 50 ) ) ); > > object.setCoordinates( getSafe( values, 10, null, null ) > ); > > object.setUrl( getSafe( values, 11, null, 255 ) ); > > object.setContactPerson( getSafe( values, 12, null, 255 ) > ); > > object.setAddress( getSafe( values, 13, null, 255 ) ); > > object.setEmail( getSafe( values, 14, null, 150 ) ); > > object.setPhoneNumber( getSafe( values, 15, null, 150 ) ); > > object.setAutoFields(); > > > > -Stephen > > > > > > > > *From:* Ant Snyman [mailto:[email protected]] > *Sent:* Monday, February 13, 2017 12:37 AM > *To:* Stephen Macauley <[email protected]> > *Cc:* [email protected]; [email protected] > *Subject:* Re: [Dhis2-users] Import of Organisation Units using CSV / > working example with Features Type and Coordinates? > > > > Hi Stephen, > > > > The one thing that caught my attention was that another column "Closed > Date" should come after "Opening Date". Since you do not have an extra "," > after 1970-01-01, the subsequent columns might be misaligned with the > coordinates actually trying to import into the url column. > > > > The GIS experts out there might comment on the format of the co-ordinates, > but I would expect it to be in the format "[7.495005,9.074908]" > > > > Good luck > > > > Regards > > > > Ant > > > > > > > > > > > > > > On 13 February 2017 at 06:07, Stephen Macauley <Stephen.Macauley@ > inductivehealth.com> wrote: > > Greetings All, > > > > Does anyone have a working example, *that includes Features Type and > Coordinates,* for the import of Organisation Units using CSV for 2.2.5 > (currently using Build Revision 8dd81e6)? > > > > I have tried numerous approaches using the available documentation, but > always encounter a challenge when the import files contains Features Type > and Coordinates (as defined here https://docs.dhis2.org/2.25/ > en/developer/html/webapi_csv_metadata_import.html#webapi_csv_org_units). > > > > > > *Sample excerpt from my import file:* > > > > Name,UID,Code,Parent UID,Short name,Description,UUID,Opening > date,Comment,Feature type,Coordinates,URL,Contact > person,Address,Email,Phone number > > Bacta One,thzLERyqmDe,thzLERyqmDe,YtReWq54321,Bacta One,Bacta > One,,1970-01-01,test,Point,"7.495005,9.074908",,,,, > > Bacta Two,ms1BoduOt0I,ms1BoduOt0I,YtReWq54321,Bacta Two,Bacta > Two,,1970-01-01,test,Point,"7.476555,9.04081",,,,, > > > > I have tried various combinations of the Feature Type (Point, POINT, > POLYGON, leaving it blank) and have also tried putting the Coordinates in > brackets ([7.495005,9.074908]). > > > > A common response I get back during dry run is the below, which makes me > believe I have fields out of position or something else is happening with > the Feature type field based on a few different “enum” exceptions in the > dhis.log file. > > > > OrganisationUnit > > String > > Property `url` requires a valid URL, was given `7.02149,4.76539`. > > > > > > Many Thanks in Advance, > > > > -Stephen > > > _______________________________________________ > Mailing list: https://launchpad.net/~dhis2-users > Post to : [email protected] > Unsubscribe : https://launchpad.net/~dhis2-users > More help : https://help.launchpad.net/ListHelp > > > > > > -- > > > > *Ant Snyman* > > *Cell: 0824910449* > > *Landline: 028 2713242* > > > > Health Information Systems Program - SA > > > > *This message and any attachments are subject to a disclaimer published at > http://www.hisp.org/policies.html#comms_disclaimer > <http://www.hisp.org/policies.html#comms_disclaimer>. Please read the > disclaimer before opening any attachment or taking any other action in > terms of this electronic transmission. If you cannot access the > disclaimer, kindly send an email to [email protected] > <[email protected]> and a copy will be provided to you. By replying to > this e-mail or opening any attachment you agree to be bound by the > provisions of the disclaimer.* > > _______________________________________________ > Mailing list: https://launchpad.net/~dhis2-devs > Post to : [email protected] > Unsubscribe : https://launchpad.net/~dhis2-devs > More help : https://help.launchpad.net/ListHelp > > -- Knut Staring Dept. of Informatics, University of Oslo Norway: +4791880522 Skype: knutstar http://dhis2.org
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : [email protected] Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp

