Re: [Dhis2-users] Has metadata import stopped working?

2018-04-11 Thread Morten Olav Hansen
Hi Olav

I see that you include sharing in these payloads, are you sure all user
groups and users are included? did you try with skipSharing=true ?
skipValidation is not really recommended, as it will not validate
anything.. but still requires things to be correct (if its not, it will
result in lots of hibernate exceptions..)


-- 
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Wed, Apr 11, 2018 at 7:52 PM, Olav Poppe  wrote:

> Thanks, JM. This is an event progrmame, so it’s not the TE.
>
> BUT I just managed to identify the culprit: One optionset was shared with
> a group not included in the export…
>
> Morten, is valudation of sharing not skipped even with
> skipValidation=true? Would be nice with some feedback on *what* fails..
>
> Olav
>
>
> 11. apr. 2018 kl. 13:42 skrev JM Alcantara :
>
> Hi Olav
> I didn’t check the dates on the thread, I thought Knut was still waiting
> for an answer.
> Have you been able to determine which dependencies are affecting the
> import? Also, if this is a tracker program did you check if the UID of the
> TE is the same you have in the system?
> Best regards,
> JM
>
>
> El 07/04/2018, a las 11:00, Olav Poppe  escribió:
>
> Hi, I might be creating some confusion by reviving Knut’s old thread.
>
> I heared from Knut that he resolved it by importing via the API, using the
> skipValidation=true option to get around dependency issues.
>
> I’m getting the same error, but in this case importing a tracker
> programme. And in my case, skipValidation=true does not help. I initially
> tried with a metadata file which I had manually put together based on a
> couple of different exports, but even with a "vanilla" programme dependency
> export file I get this error, even with skipValidation=true.
>
> Isaiah, thanks for the suggestion of doing this object by object - that
> might work, but I need to share this metadata file with different people
> and asking each one to import 10-15 files in order is not a good solutiom.
>
> Any other suggestions?
>
> Regards
>
>
>
>
>
>
> 7. apr. 2018 kl. 10:47 skrev JM Alcantara :
>
> Hi Knut
> Try splitting your import by org unit levels and do the import in order,
> starting with the lowest level (1, 2, 3...)
> The problem happens because the import creates the objects out of order in
> regards to dependencies, in your case an org unit before its parent.
> Best regards,
> JM
>
> On Fri, 6 Apr 2018, 15:57 Olav Poppe,  wrote:
>
>> I’m having the same issue and error importing into an empty 2.27
>> database. Though in this case a slightly modified dependency export of a
>> tracker programme, not orgunits.
>>
>> Knut, did you find a solution?
>>
>> Sending you the payload, Morten.
>>
>> Olav
>>
>>
>> 12. jan. 2018 kl. 08:39 skrev Morten Olav Hansen :
>>
>> That sounds weird Knut, would you mind sharing the org unit payload?
>>
>> --
>> Morten Olav Hansen
>> Senior Engineer, DHIS 2
>> University of Oslo
>> http://www.dhis2.org
>>
>> On Fri, Jan 12, 2018 at 2:19 AM, Knut Staring  wrote:
>>
>>> I have tried doing metadata export without sharing from 2.27 and
>>> importing into 2.27, just the OU hierarchy and levels.
>>>
>>> Importing into a clean instance gives this:
>>>
>>>  INFO  2018-01-11 20:16:06,750 [Level: INFO, category: METADATA_IMPORT,
>>> time: Thu Jan 11 20:16:06 CET 2018, message: (admin) Creating 8 object(s)
>>> of type OrganisationUnitLevel] (InMemoryNotifier.java [taskScheduler-4])
>>> * ERROR 2018-01-11 20:16:07,764 Unexpected error occurred in scheduled
>>> task. (TaskUtils.java [taskScheduler-4])
>>> org.hibernate.TransientObjectException: object references an unsaved
>>> transient instance - save the transient instance before flushing:
>>> org.hisp.dhis.organisationunit.OrganisationUnit
>>> at org.hibernate.engine.internal.ForeignKeys.
>>> getEntityIdentifierIfNotUnsaved(ForeignKeys.java:279)
>>> at org.hibernate.type.EntityType.getIdentifier(EntityType.java:
>>> 462)
>>> at org.hibernate.type.ManyToOneType.isDirty(
>>> ManyToOneType.java:281)
>>> at org.hibernate.type.ManyToOneType.isDirty(
>>> ManyToOneType.java:291)
>>> at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:322)
>>> at org.hibernate.persister.entity.AbstractEntityPersister.
>>> findDirty(AbstractEntityPersister.java:4204)
>>> at org.hibernate.event.internal.DefaultFlushEntityEventListene
>>> r.dirtyCheck(DefaultFlushEntityEventListener.java:528)
>>> at org.hibernate.event.internal.DefaultFlushEntityEventListene
>>> r.isUpdateNecessary(DefaultFlushEntityEventListener.java:215)
>>> at org.hibernate.event.internal.DefaultFlushEntityEventListene
>>> r.onFlushEntity(DefaultFlushEntityEventListener.java:142)
>>> at org.hibernate.event.internal.AbstractFlushingEventListener.
>>> 

Re: [Dhis2-users] VALIDATION RULES

2018-04-11 Thread Jim Grace
Hi Alex,

At the moment the only way to compare the data between different months in
validation rules is to use predictors -- define a predictor to pull the
data into a different data element in the current period from the past
period (like 3 months ago if you want -- use a predictor sequential sample
count of 3 and a skip count of 2.) Then use a validation rule to compare
the two data elements in the same period. For more about predictors, see
https://docs.dhis2.org/master/en/user/html/manage_predictor.html

The downsides of this are you have to define extra data elements and
predictors, and run the predictors before you do the validation, and store
extra data in the database.

For the future, we are looking at possible extensions to expressions that
would let you process past period data and current period data in the same
expression. If you would like this to apply to validation rules, please
submit a Jira issue to this effect, and preferably tell us more about the
application -- like what kind of data you have and why you want to compare
it between months. This will help us to prioritize the work if we know more
about the use case. :) Then let me know and I will link the issue to the
Jira Epic at https://jira.dhis2.org/browse/DHIS2-3187 where we are
gathering these requirements.

Thanks!

Cheers,
Jim


On Wed, Apr 11, 2018 at 1:03 PM, arungatom65  wrote:

> That is true Mr Akumba validation rules work on defined periods
>
>
>
> Sent from my Samsung Galaxy smartphone.
>  Original message 
> From: Barnabas Akumba 
> Date: 11/04/2018 19:09 (GMT+03:00)
> To: Alex Macharia 
> Cc: dhis2-users@lists.launchpad.net
> Subject: Re: [Dhis2-users] VALIDATION RULES
>
> Hello Alex Macharia,
>
> The validation rule analysis page gives you the ability to select a
> range of dates (Start Date and End Date). This means if you want to
> validate data for last three months, you'll have to select the First
> date of the First Month i.e. 1st January, 2018 and Last date of March,
> i.e. 31st March, 2018.
> This will validate all the data that falls between the dates selected
> and give you the corresponding output.
>
> I don't know if this addresses your concern?
>
> Regards
>
> On 4/11/18, Alex Macharia  wrote:
> > Hi,
> >
> > I there a way of creating a VALIDATION RULE that checks into other
> periods?
> >
> > I wish to validate current month in reference to data entered 3 months
> ago.
> >
> > Thanks
> >
> > --
> > ALEX MACHARIA
> >
>
>
> --
>
> Barnabas AKUMBA
>
> *Mobile:* +2348036195778
> *Skype:* barnabas.akumba
>
> ___
> Mailing list: https://launchpad.net/~dhis2-users
> Post to : dhis2-users@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
> ___
> Mailing list: https://launchpad.net/~dhis2-users
> Post to : dhis2-users@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Jim Grace
Core developer, DHIS 2
HISP US Inc.
http://www.dhis2.org 
___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-users] VALIDATION RULES

2018-04-11 Thread arungatom65
That is true Mr Akumba validation rules work on defined periods


Sent from my Samsung Galaxy smartphone. Original message From: 
Barnabas Akumba  Date: 11/04/2018  19:09  (GMT+03:00) 
To: Alex Macharia  Cc: dhis2-users@lists.launchpad.net 
Subject: Re: [Dhis2-users] VALIDATION RULES 
Hello Alex Macharia,

The validation rule analysis page gives you the ability to select a
range of dates (Start Date and End Date). This means if you want to
validate data for last three months, you'll have to select the First
date of the First Month i.e. 1st January, 2018 and Last date of March,
i.e. 31st March, 2018.
This will validate all the data that falls between the dates selected
and give you the corresponding output.

I don't know if this addresses your concern?

Regards

On 4/11/18, Alex Macharia  wrote:
> Hi,
>
> I there a way of creating a VALIDATION RULE that checks into other periods?
>
> I wish to validate current month in reference to data entered 3 months ago.
>
> Thanks
>
> --
> ALEX MACHARIA
>


-- 

Barnabas AKUMBA

*Mobile:* +2348036195778
*Skype:* barnabas.akumba

___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp
___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-users] VALIDATION RULES

2018-04-11 Thread Barnabas Akumba
Hello Alex Macharia,

The validation rule analysis page gives you the ability to select a
range of dates (Start Date and End Date). This means if you want to
validate data for last three months, you'll have to select the First
date of the First Month i.e. 1st January, 2018 and Last date of March,
i.e. 31st March, 2018.
This will validate all the data that falls between the dates selected
and give you the corresponding output.

I don't know if this addresses your concern?

Regards

On 4/11/18, Alex Macharia  wrote:
> Hi,
>
> I there a way of creating a VALIDATION RULE that checks into other periods?
>
> I wish to validate current month in reference to data entered 3 months ago.
>
> Thanks
>
> --
> ALEX MACHARIA
>


-- 

Barnabas AKUMBA

*Mobile:* +2348036195778
*Skype:* barnabas.akumba

___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


[Dhis2-users] VALIDATION RULES

2018-04-11 Thread Alex Macharia
Hi,

I there a way of creating a VALIDATION RULE that checks into other periods?

I wish to validate current month in reference to data entered 3 months ago.

Thanks

-- 
ALEX MACHARIA
___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


[Dhis2-users] Employment Opportunity for Organizational Metrics Position

2018-04-11 Thread Karen Levin
Dear DHIS2 User Community -

I wanted to share this job opportunity with you all in the event one of you is 
interested, or knows someone who might be.

EngenderHealth is seeking a Program Associate for Organizational Metrics - the 
job description is cut and pasted below, and can also be found online, for 
application, at: 
https://chk.tbe.taleo.net/chk01/ats/careers/requisition.jsp?org=ENGENDERHEALTH=1=1205

Description

EngenderHealth's vision is a world where sexual and reproductive health rights 
are respected as human rights, and women and girls have the freedom to reach 
their full potential. To achieve transformational change leading to true social 
and economic progress, EngenderHealth partners with diverse organizations 
across sectors with the shared goals of highlighting women's value to 
sustainable development.
JOB SUMMARY:
The Program Associate, Organizational Metrics is responsible for developing and 
strengthening EngenderHealth's effectiveness measurements with a focus on data 
management systems and data quality assurance processes.
This is an associate level union position under EngenderHealth's collective 
bargaining agreement with the Office and Professional Employees International 
Union (OPEIU) Local 153, AFL-CIO and subject to union dues.
REQUIREMENTS:
Must possess the following requirements with or without a reasonable 
accommodation.

  *   Master's degree in public health (MPH) or a related discipline.
  *   Five (5) years of experience with sexual, reproductive, adolescent health 
and/or maternal, newborn, child health including abortion.
  *   Trained in health management information systems and database management, 
for example, DHIS2 or another similar database platform.
  *   Administered user training in database platform usage including tailoring 
methods for a non-technical audience.
  *   Developed and implemented database management systems including user 
interfaces.
  *   Developing and implementing systems for program monitoring.
  *   Work-related experience in data management, data quality analytics, and 
data visualization.
  *   Analytical skills to conduct univariate and simple multivariate 
statistical analysis.
  *   Technical skills:
 *   PowerPoint to create presentations including the ability to 
import/export content from other sources.
 *   Word and Adobe to create .pdf files, hyperlinks, tables, communication 
materials, format layout, and configure print functionality.
 *   Spreadsheets (e.g. Excel) for detailed statistical analysis, e.g. 
multi-variate analysis, application of formulas for cross-program analysis.
 *   Use SPSS, Stata, or EpiInfo for statistical analysis and validation 
for large sets of data.
 *   Use of common data visualization software to present data and trends 
to deepen programmatic insights and drive strategy decisions at project and 
country program levels (e.g. Excel, Tableau, JMP, or Microsoft BI).
 *   Use of survey development applications (e.g. SurveyMonkey, Qualtrics, 
Google forms, CSPro) for conducting surveys of a small and large scale within 
EH and outside to gain insights on specific issues (e.g. staff capacity needs 
on metrics and analysis, health care provider training needs).
  *   Fluency in English, which includes the use of accurate grammar.
  *   Able to travel to program countries based on business need approximately 
25% to 40% or the equivalent to 13 to 21 weeks annually.
ESSENTIAL SOFT SKILLS:

  *   Leadership skills to work with autonomy and prioritizing tasks.
  *   Understand and demonstrate problem-solving skills.
  *   Organized, high level of accuracy, and meticulous attention-to-detail.
  *   Collaboratively shares information and supports colleagues.
  *   Able to learn the business and fully understand how and why tasks satisfy 
business needs.
  *   Ability to synthesize information from multiple sources.
  *   Adaptable to changing priorities and deadlines seamlessly.
PREFERRED SKILLS, ABILITIES, AND FUNCTIONS:

  *   Organizational metrics experience.
  *   Familiarity with impact estimation in reproductive health, family 
planning, maternal, newborn and/or child health.
  *   Qualitative data analysis skills.
  *   Developed and maintained databases in the DHIS2 development environment.
  *   SQL programming or similar.
  *   Ability to communicate in French using business and healthcare 
terminology.
Disclaimer
The above statements describe the general nature and level of work being 
performed by the person(s) assigned to this job. They are not to be construed 
as an exhaustive list of all responsibilities, duties, and skills required of 
personnel so classified. All personnel may be required to perform duties 
outside of their normal responsibilities as needed and assigned.
EngenderHealth provides equal employment opportunities (EEO) to all employees 
and applicants for employment, without regard to race, creed, ancestry, 
citizenship, religion, color, gender, 

Re: [Dhis2-users] Has metadata import stopped working?

2018-04-11 Thread Olav Poppe
Thanks, JM. This is an event progrmame, so it’s not the TE.

BUT I just managed to identify the culprit: One optionset was shared with a 
group not included in the export…

Morten, is valudation of sharing not skipped even with skipValidation=true? 
Would be nice with some feedback on what fails..

Olav


11. apr. 2018 kl. 13:42 skrev JM Alcantara 
>:

Hi Olav
I didn’t check the dates on the thread, I thought Knut was still waiting for an 
answer.
Have you been able to determine which dependencies are affecting the import? 
Also, if this is a tracker program did you check if the UID of the TE is the 
same you have in the system?
Best regards,
JM


El 07/04/2018, a las 11:00, Olav Poppe 
> escribió:

Hi, I might be creating some confusion by reviving Knut’s old thread.

I heared from Knut that he resolved it by importing via the API, using the 
skipValidation=true option to get around dependency issues.

I’m getting the same error, but in this case importing a tracker programme. And 
in my case, skipValidation=true does not help. I initially tried with a 
metadata file which I had manually put together based on a couple of different 
exports, but even with a "vanilla" programme dependency export file I get this 
error, even with skipValidation=true.

Isaiah, thanks for the suggestion of doing this object by object - that might 
work, but I need to share this metadata file with different people and asking 
each one to import 10-15 files in order is not a good solutiom.

Any other suggestions?

Regards






7. apr. 2018 kl. 10:47 skrev JM Alcantara 
>:

Hi Knut
Try splitting your import by org unit levels and do the import in order, 
starting with the lowest level (1, 2, 3...)
The problem happens because the import creates the objects out of order in 
regards to dependencies, in your case an org unit before its parent.
Best regards,
JM

On Fri, 6 Apr 2018, 15:57 Olav Poppe, 
> wrote:
I’m having the same issue and error importing into an empty 2.27 database. 
Though in this case a slightly modified dependency export of a tracker 
programme, not orgunits.

Knut, did you find a solution?

Sending you the payload, Morten.

Olav


12. jan. 2018 kl. 08:39 skrev Morten Olav Hansen 
>:

That sounds weird Knut, would you mind sharing the org unit payload?

--
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Fri, Jan 12, 2018 at 2:19 AM, Knut Staring 
> wrote:
I have tried doing metadata export without sharing from 2.27 and importing into 
2.27, just the OU hierarchy and levels.

Importing into a clean instance gives this:

 INFO  2018-01-11 20:16:06,750 [Level: INFO, category: METADATA_IMPORT, time: 
Thu Jan 11 20:16:06 CET 2018, message: (admin) Creating 8 object(s) of type 
OrganisationUnitLevel] (InMemoryNotifier.java [taskScheduler-4])
* ERROR 2018-01-11 20:16:07,764 Unexpected error occurred in scheduled task. 
(TaskUtils.java [taskScheduler-4])
org.hibernate.TransientObjectException: object references an unsaved transient 
instance - save the transient instance before flushing: 
org.hisp.dhis.organisationunit.OrganisationUnit
at 
org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:279)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:462)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:281)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:291)
at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:322)
at 
org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:4204)
at 
org.hibernate.event.internal.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:528)
at 
org.hibernate.event.internal.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:215)
at 
org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:142)
at 
org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:216)
at 
org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:85)
at 
org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:38)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1295)
at 
org.hisp.dhis.dbms.HibernateDbmsManager.clearSession(HibernateDbmsManager.java:339)
at 
org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundleService.commit(DefaultObjectBundleService.java:180)
 

Re: [Dhis2-users] Option sets in program indicators

2018-04-11 Thread Aaron C White
Natalie,

I don't think your proposed formula would work if the data are stored as
text; however, if you convert your option sets to an INTEGER value type, it
would.  You could update the metadata configuration in place using a PATCH
request to the /api/optionSets/id endpoint to update the value type without
having to change them in the UI.  You'd also need to update the associated
data element or tracked entity attribute value type using the same method.
Then you could remove the quotes around your number codes.

I haven't tried with d2:hasValue, but I imagine this would work as well.

Aaron


--
Aaron C. White
919.522.5585

On Tue, Apr 10, 2018 at 12:15 PM, Natalie Tibbels  wrote:

> Hi all,
>
> For program indicators, do option set codes count as number values in an
> expression/filter? I want to create a program indicator that captures
> whether ANY response was given to a particular data element in a tracker
> program stage (with response type text using an option set with 11 options,
> codes: 01, 02, 03…11). I want to sum all of the cases where the user
> selected ANY option for that data element.
>
>
>
> Does this make sense?
>
> Program expression: Enrollment count. [or TEI count?]
>
> Program filter: {#uidofdataelement} >='01' and
> #{CDbxAsttXzY.mFhpwpIv7ci}<='11'
>
>
>
> Is there a better way to do this? Am I right that d2:hasValue cannot be
> used if the response type is an option set?
>
>
>
> Thanks,
>
> Natalie
>
> ___
> Mailing list: https://launchpad.net/~dhis2-users
> Post to : dhis2-users@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>
___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


[Dhis2-users] Cohort and referrals

2018-04-11 Thread Sakibou Alassani
 Hi
Please I would like to understand well how referral is managed in DHIS2
database management wise. In case of referral the enrollment organisation
unit change in the database right?
 If yes how is cohort going to be managed in the health facility where the
patient has been referred from before the transfer.
For instance if a patient is enrolled in January 2016 in health Facility A.
In the calculation of the cohort this patient should be alright counted.
If in 2017 the patient is referred to Facility B, when testing the program
indicators for 2016.This patient is no more counted for facility A.

-- 

**Sakibou
___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-users] Has metadata import stopped working?

2018-04-11 Thread JM Alcantara
Hi Olav
I didn’t check the dates on the thread, I thought Knut was still waiting for an 
answer.
Have you been able to determine which dependencies are affecting the import? 
Also, if this is a tracker program did you check if the UID of the TE is the 
same you have in the system?
Best regards,
JM


> El 07/04/2018, a las 11:00, Olav Poppe  escribió:
> 
> Hi, I might be creating some confusion by reviving Knut’s old thread. 
> 
> I heared from Knut that he resolved it by importing via the API, using the 
> skipValidation=true option to get around dependency issues. 
> 
> I’m getting the same error, but in this case importing a tracker programme. 
> And in my case, skipValidation=true does not help. I initially tried with a 
> metadata file which I had manually put together based on a couple of 
> different exports, but even with a "vanilla" programme dependency export file 
> I get this error, even with skipValidation=true.
> 
> Isaiah, thanks for the suggestion of doing this object by object - that might 
> work, but I need to share this metadata file with different people and asking 
> each one to import 10-15 files in order is not a good solutiom.
> 
> Any other suggestions?
> 
> Regards
> 
> 
> 
> 
> 
> 
>> 7. apr. 2018 kl. 10:47 skrev JM Alcantara > >:
>> 
>> Hi Knut
>> Try splitting your import by org unit levels and do the import in order, 
>> starting with the lowest level (1, 2, 3...)
>> The problem happens because the import creates the objects out of order in 
>> regards to dependencies, in your case an org unit before its parent.
>> Best regards,
>> JM
>> 
>> On Fri, 6 Apr 2018, 15:57 Olav Poppe, > > wrote:
>> I’m having the same issue and error importing into an empty 2.27 database. 
>> Though in this case a slightly modified dependency export of a tracker 
>> programme, not orgunits.
>> 
>> Knut, did you find a solution?
>> 
>> Sending you the payload, Morten.
>> 
>> Olav
>> 
>> 
>>> 12. jan. 2018 kl. 08:39 skrev Morten Olav Hansen >> >:
>>> 
>>> That sounds weird Knut, would you mind sharing the org unit payload?
>>> 
>>> -- 
>>> Morten Olav Hansen
>>> Senior Engineer, DHIS 2
>>> University of Oslo
>>> http://www.dhis2.org 
>>> On Fri, Jan 12, 2018 at 2:19 AM, Knut Staring >> > wrote:
>>> I have tried doing metadata export without sharing from 2.27 and importing 
>>> into 2.27, just the OU hierarchy and levels.
>>> 
>>> Importing into a clean instance gives this:
>>> 
>>>  INFO  2018-01-11 20:16:06,750 [Level: INFO, category: METADATA_IMPORT, 
>>> time: Thu Jan 11 20:16:06 CET 2018, message: (admin) Creating 8 object(s) 
>>> of type OrganisationUnitLevel] (InMemoryNotifier.java [taskScheduler-4])
>>> * ERROR 2018-01-11 20:16:07,764 Unexpected error occurred in scheduled 
>>> task. (TaskUtils.java [taskScheduler-4])
>>> org.hibernate.TransientObjectException: object references an unsaved 
>>> transient instance - save the transient instance before flushing: 
>>> org.hisp.dhis.organisationunit.OrganisationUnit
>>> at 
>>> org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:279)
>>> at org.hibernate.type.EntityType.getIdentifier(EntityType.java:462)
>>> at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:281)
>>> at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:291)
>>> at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:322)
>>> at 
>>> org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:4204)
>>> at 
>>> org.hibernate.event.internal.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:528)
>>> at 
>>> org.hibernate.event.internal.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:215)
>>> at 
>>> org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:142)
>>> at 
>>> org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:216)
>>> at 
>>> org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:85)
>>> at 
>>> org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:38)
>>> at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1295)
>>> at 
>>> org.hisp.dhis.dbms.HibernateDbmsManager.clearSession(HibernateDbmsManager.java:339)
>>> at 
>>> org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundleService.commit(DefaultObjectBundleService.java:180)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at 

Re: [Dhis2-users] [Dhis2-devs] Program rule for Age value type

2018-04-11 Thread Edouard Lavaud
Hi Em Le Hong,

If I well understand:
You capture the age at a different moment than you would like the
program rule to be executed?

If no, program rule executed on the same stage as you capture the age:

To be checked (never used the age value type so far), but age should
be an integer. So you could just do: #{age_value_type} < 5

If yes, program rule executed later on a different program stage:

Well, first you would be better off taking a date rather than the
age. The d2 functions you mentioned are only for comparing dates, but
age is not a date.

If you really want to use the age type, you have to convert it first
in a date following the DHIS2 date pattern: -MM-DD

For that, you need to choose how to approximate a date of birth. Will
you use the first day of the year? the last day? the 30 of June? The
day you collected the information?
Then you have to use the diverse d2 functions to create your date of 
birth.

As an example, in an enrollment form of a program I calculate the
date of birth automatically (note that the age here is just a value
type integer, and here all the program rules are performed in the same
event: the enrollment):

Program rule, priority 1, I calculate the age in days:
A{Age at enrollment} * 365.25
Program rule, priority 2, I calculate the date of birth according to
the day of data capture
d2:addDays(V{enrollment_date}, -#{Age at enrollment in days})
Program rule, priority 3, I round the date of birth to the 15 of June
d2:concatenate(d2:substring(#{Date of birth calculated}, 0, 4), 
'-06-15')


After that I obtain an approximate date of birth I can use in the d2
date functions.

Best,

Edouard

2018-04-11 11:59 UTC+02:00, Em Le Hong :
> Dear all,
>
> I create a tracker data element value type: Age
>
> For event program, I want to use program to check and show error if Age is
> under 5
> I tried 2 functions d2:yearsBetween; d2:daysBetween with the expression as
> below but it doesn't work:
>
> d2:daysBetween(#{age_value_type}, V{event_date})
> d2:yearsBetween(#{age_value_type}, V{event_date})
>
> I check the manual Table 21.13. Custom functions to use in a program rule
> expression
> https://docs.dhis2.org/2.29/en/user/html/configure_program_rule.html#create_program_rule
>  and don't see any functions for Age value type.
>
> I created a ticket on DHIS2 Jira https://jira.dhis2.org/browse/DHIS2-3381
>
>
> I'm really appreciated if anyone has experience on this can share.
>
>
> Regards,
>
>
>
> --
> *Em Le Hong*
> DHIS2 Implementation| *HISP Vietnam *
> em.hispviet...@gmail.com | *Skype:* em.hispviet...@gmail.com
>


-- 
*Edouard Lavaud, *



*MSc in Health Policy, Planning & FinancingMEng in
TelecommunicationUniversity Diploma in ICT for Health*
*Email:* edouard.lav...@gmail.com
*Mobile:* 0033 6 7210 23 59

___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


[Dhis2-users] Program rule for Age value type

2018-04-11 Thread Em Le Hong
Dear all,

I create a tracker data element value type: Age

For event program, I want to use program to check and show error if Age is
under 5
I tried 2 functions d2:yearsBetween; d2:daysBetween with the expression as
below but it doesn't work:

d2:daysBetween(#{age_value_type}, V{event_date})
d2:yearsBetween(#{age_value_type}, V{event_date})

I check the manual Table 21.13. Custom functions to use in a program rule
expression
https://docs.dhis2.org/2.29/en/user/html/configure_program_rule.html#create_program_rule
 and don't see any functions for Age value type.

I created a ticket on DHIS2 Jira https://jira.dhis2.org/browse/DHIS2-3381


I'm really appreciated if anyone has experience on this can share.


Regards,



-- 
*Em Le Hong*
DHIS2 Implementation| *HISP Vietnam *
em.hispviet...@gmail.com | *Skype:* em.hispviet...@gmail.com
___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-users] [Dhis2-devs] Get number of days between two event dates in different program stages

2018-04-11 Thread Rady
Hello Edouard,

Many thanks for your guidance. It works fine to me.

Best,
Rady

On Wed, Apr 11, 2018 at 1:54 PM, Edouard Lavaud 
wrote:

> Hi Rady,
>
> I used a kind of hack for doing that:
>
> I first used a program rule to copy the event_date into a new data
> element of the program stage (so, yup, the date is kind of duplicated
> in the stage).
>
> However then I could create a program rule variable to fetch this date
> I wanted, and compare it with another one.
>
> Hope this could help.
>
> Best,
>
> Edouard
>
> 2018-04-11 6:39 UTC+02:00, Rady :
> > Hello DHIS2 community,
> >
> > I have a doubt how to get number of days between two event dates in
> > different program stages. For example,
> > *d2:daysBetween(programstage1.V{event_date},programstage2.V{
> event_date})*.
> >
> > Anybody used to have experience on this? please help.
> >
> > Thanks,
> > Rady
> >
>
>
> --
> *Edouard Lavaud, *
>
>
>
> *MSc in Health Policy, Planning & FinancingMEng in
> TelecommunicationUniversity Diploma in ICT for Health*
> *Email:* edouard.lav...@gmail.com
> *Mobile:* 0033 6 7210 23 59
>
___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-users] [Dhis2-devs] Get number of days between two event dates in different program stages

2018-04-11 Thread Edouard Lavaud
Hi Rady,

I used a kind of hack for doing that:

I first used a program rule to copy the event_date into a new data
element of the program stage (so, yup, the date is kind of duplicated
in the stage).

However then I could create a program rule variable to fetch this date
I wanted, and compare it with another one.

Hope this could help.

Best,

Edouard

2018-04-11 6:39 UTC+02:00, Rady :
> Hello DHIS2 community,
>
> I have a doubt how to get number of days between two event dates in
> different program stages. For example,
> *d2:daysBetween(programstage1.V{event_date},programstage2.V{event_date})*.
>
> Anybody used to have experience on this? please help.
>
> Thanks,
> Rady
>


-- 
*Edouard Lavaud, *



*MSc in Health Policy, Planning & FinancingMEng in
TelecommunicationUniversity Diploma in ICT for Health*
*Email:* edouard.lav...@gmail.com
*Mobile:* 0033 6 7210 23 59

___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp