← Back to team overview

dhis2-devs team mailing list archive

Re: Exception when importing metadata dataelements

 

Hi

 

I am importing dataelements. See screen shot below.

The summary shows the import is successful but the server shows the exception and the dataelement is not in the db.

 

 



 

Regards

Pooben

 

 

From: Jason Pickering [mailto:jason.p.pickering@xxxxxxxxx] 
Sent: Tuesday, March 31, 2015 9:42 PM
To: Calle Hedberg Gmail
Cc: dhis2-devs; Pooben Dass
Subject: Re: [Dhis2-devs] Exception when importing metadata dataelements

 

Are you sure you imported this file as data elements and not organization units? 

Regards, 
Jason 

On Mar 31, 2015 9:39 PM, "Calle Hedberg" <calle.hedberg@xxxxxxxxx> wrote:

Pooben,

 

I see that you csv file is actually correct in the sense that all the fields except the last two (Option set and Comment option set) are included. There's been some recent changes to the csv import of option set, but as far as I know that did not include making the option set UID here compulsory.

 

Looks like a bug, then

 

Regards

Calle

 

On 31 March 2015 at 21:33, Calle Hedberg <calle.hedberg@xxxxxxxxx> wrote:

Pooben,

 

There is NO field called "Active" in the data element meta-data CSV import - see table 1.11 in the developer manual (below)

 

There used to be a field called "Active" in the Organisationunit table, but that was dropped in from version 2.17 or 2.18 onwards. There's never been any "active" field in the data element or indicator tables - not even in version 1.x

 

The only issue to be aware of is that the "name" column, which in the description below is defined as Unique, actually is NOT unique. Only the UID and Code columns are unique - if you import a data element with a name that already exists in your DHIS2 instance (but where the UID is different), it will import it and create a duplicate with no warning.

 

Regards

Calle

 

Table 1.11. Data Element CSV Format


Column

Required

Value (default first)

Description


Name

Yes

 

Name. Max 230 char. Unique.


UID

No

UID

Stable identifier. Max 11 char. Will be generated by system if not specified.


Code

No

 

Stable code. Max 50 char.


Short name

No

50 first char of name

Will fall back to first 50 characters of name if unspecified. Max 50 char. Unique.


Description

No

 

Free text description.


Form name

No

 

Max 230 char.


Domain type

No

aggregate | tracker

Domain type for data element, can be aggregate or tracker. Max 16 char.


Value type

No

int | string | bool | trueOnly | date | unitInterval

Value type. Max 16 char.


Number type

No

int | posInt | negInt | number | zeroPositiveInt

Only relevant if type is int. Max 16 char.


Text type

No

text | longText

Only relevant if type is string. Max 16 char.


Aggregation operator

No

sum | average | count | stddev | variance

Operator indicating how to aggregate data in the time dimension. Max 16 char.


Category combination UID

No

UID

UID of category combination. Will default to default category combination if not specified.


Url

No

 

URL to data element resource. Max 255 char.


Zero is significant

No

false | true

Indicates whether zero values will be stored for this data element.


Option set

No

UID

UID of option set to use for data.


Comment option set

No

UID

UID of option set to use for comments.

 

 

On 31 March 2015 at 20:26, Pooben Dass <pooben@xxxxxxxx> wrote:

Hi Devs

 

I am receiving this exception:-

 

Caused by: org.postgresql.util.PSQLException: ERROR: null value in column "active" violates not-null constraint

  Detail: Failing row contains (10248, X9TfdT6JLNJ, null, 2015-03-31 19:43:09.306, 2015-03-31 19:43:12.352, Sub-dermal implant inserted, Sub-dermal implant insert, Sub-dermal contraceptive implant inserted just under the skin of..., null, null, int, number, null, AGGREGATE, sum, 14, null, null, t, null, --------, null, null, null).

        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

        at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)

        ... 31 more

 

What position in the csv file must the active field be in or is this a bug?

Attached is my csv file.

 

Regards

Pooben

 

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp





 

-- 

*******************************************

Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA 

Tel/fax (home): +27-21-685-6472 <tel:%2B27-21-685-6472> 

Cell: +27-82-853-5352 <tel:%2B27-82-853-5352> 

Iridium SatPhone: +8816-315-19274 <tel:%2B8816-315-19274> 

Email: calle.hedberg@xxxxxxxxx

Skype: calle_hedberg

*******************************************

 





 

-- 

*******************************************

Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA 

Tel/fax (home): +27-21-685-6472 <tel:%2B27-21-685-6472> 

Cell: +27-82-853-5352 <tel:%2B27-82-853-5352> 

Iridium SatPhone: +8816-315-19274 <tel:%2B8816-315-19274> 

Email: calle.hedberg@xxxxxxxxx

Skype: calle_hedberg

*******************************************

 


_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

PNG image


References