dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02861
Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 938: Made the uniqueness constraint on CategoryOption back in. Will maintain it in a transition period.
2009/10/30 Jason Pickering <jason.p.pickering@xxxxxxxxx>
> Could some one remind me once again what the point of having a
> category option in two separate categories is? is there a use case
> here? It does not seem totally obvious, but maybe I am missing
> something.
>
>
I'll give it a try:
Here are two categorycombos and their options:
CategoryCombo EPI Age Group + Gender
Category1: EPI Age Group
Options: (<1, >1)
Category2: Gender
Options (Female, Male)
CategoryCombo Morbidity Age Group + Gender
Category1: Morbidity Age Group
Options: (<1, 1-5, 5-15, >15)
Category2: Gender
Options (Female, Male)
The categoryoption name '<1' is used in two different categories.
That said, I am not sure how useful it is to programatically know that <1 in
Morbidity is the same as <1 in EPI (in the sense that you will use it in
data analysis), even though they share the same name.
I find it useful to be able to do analysis on a random set of data elements
across multiple dimensions (cetegories) independent of their categorycombos,
e.g. in this example look at the gender dimenion across data elements from
EPI and Morbidity. (although gender in EPI might not be a good real life
example of something useful)
BUT I am not sure we need to support analysing data elements across a random
set of categoryoptions independent of their categories, as in looking at the
categoryoption '<1' across EPI and Morbidity data elements. I find this to
complex and far fetched to support.
As stated in that multidimensional datamart blueprint, we need to support
e.g. report tables where the user can pick categoryoptions to use as
columns, but I guess then we need to restrict it to a selection of
categoryoptions within 1 categorycombo.
What I am saying is that although the same name is used in for options in
two different categories it might not be necessary to actually link these
two categoryoptions to the same master object or whatever you would call it.
This means that the name is not the unique identifier for categoryoptions,
but rather the name + the category it belongs to.
Does this make sense?
Ola
-----------
>
> On Fri, Oct 30, 2009 at 3:24 PM, <noreply@xxxxxxxxxxxxx> wrote:
> > ------------------------------------------------------------
> > revno: 938
> > committer: Lars Helge Oeverland larshelge@xxxxxxxxx
> > branch nick: trunk
> > timestamp: Fri 2009-10-30 14:22:00 +0100
> > message:
> > Made the uniqueness constraint on CategoryOption back in. Will maintain
> it in a transition period.
> > modified:
> >
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
> >
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
> >
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/OptionsCategoriesDefaultSortOrderPopulator.java
> >
> dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml
> >
> >
> > --
> > lp:dhis2
> > https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk<https://code.launchpad.net/%7Edhis2-devs-core/dhis2/trunk>
> >
> > Your team DHIS 2 developers is subscribed to branch lp:dhis2.
> > To unsubscribe from this branch go to
> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription<https://code.launchpad.net/%7Edhis2-devs-core/dhis2/trunk/+edit-subscription>
> .
> >
> > === modified file
> 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java'
> > ---
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
> 2009-10-29 11:27:49 +0000
> > +++
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
> 2009-10-30 13:22:00 +0000
> > @@ -141,11 +141,11 @@
> > Collection<DataElementCategoryOption> getDataElementCategoryOptions(
> Collection<Integer> identifiers );
> >
> > /**
> > - * Retrieves the DataElementCategoryOptions with the given name.
> > + * Retrieves the DataElementCategoryOption with the given name.
> > * @param name the name.
> > - * @return the DataElementCategoryOptions with the given name.
> > + * @return the DataElementCategoryOption with the given name.
> > */
> > - Collection<DataElementCategoryOption>
> getDataElementCategoryOptionsByName( String name );
> > + DataElementCategoryOption getDataElementCategoryOptionByName( String
> name );
> >
> > /**
> > * Returns all DataElementCategoryOptions.
> >
> > === modified file
> 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
> > ---
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
> 2009-10-29 11:27:49 +0000
> > +++
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
> 2009-10-30 13:22:00 +0000
> > @@ -62,9 +62,9 @@
> > this.dataElementCategoryStore = dataElementCategoryStore;
> > }
> >
> > - private GenericStore<DataElementCategoryOption>
> dataElementCategoryOptionStore;
> > + private GenericIdentifiableObjectStore<DataElementCategoryOption>
> dataElementCategoryOptionStore;
> >
> > - public void setDataElementCategoryOptionStore(
> GenericStore<DataElementCategoryOption> dataElementCategoryOptionStore )
> > + public void setDataElementCategoryOptionStore(
> GenericIdentifiableObjectStore<DataElementCategoryOption>
> dataElementCategoryOptionStore )
> > {
> > this.dataElementCategoryOptionStore =
> dataElementCategoryOptionStore;
> > }
> > @@ -194,19 +194,9 @@
> > return dataElementCategoryOptionStore.get( id );
> > }
> >
> > - public Collection<DataElementCategoryOption>
> getDataElementCategoryOptionsByName( String name )
> > + public DataElementCategoryOption getDataElementCategoryOptionByName(
> String name )
> > {
> > - Collection<DataElementCategoryOption> categoryOptions = new
> ArrayList<DataElementCategoryOption>();
> > -
> > - for ( DataElementCategoryOption categoryOption :
> getAllDataElementCategoryOptions() )
> > - {
> > - if ( categoryOption.getName().equals( name ) )
> > - {
> > - categoryOptions.add( categoryOption );
> > - }
> > - }
> > -
> > - return categoryOptions;
> > + return dataElementCategoryOptionStore.getByName( name );
> > }
> >
> > public Collection<DataElementCategoryOption>
> getDataElementCategoryOptions( Collection<Integer> identifiers )
> >
> > === modified file
> 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/OptionsCategoriesDefaultSortOrderPopulator.java'
> > ---
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/OptionsCategoriesDefaultSortOrderPopulator.java
> 2009-10-20 10:51:16 +0000
> > +++
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/OptionsCategoriesDefaultSortOrderPopulator.java
> 2009-10-30 13:22:00 +0000
> > @@ -106,7 +106,7 @@
> > //dataelementcategoryoption
> > executeSql( "ALTER TABLE dataelementcategoryoption DROP COLUMN
> shortname" );
> > executeSql( "ALTER TABLE dataelementcategoryoption DROP
> CONSTRAINT fk_dataelement_categoryid" );
> > - executeSql( "ALTER TABLE dataelementcategoryoption DROP
> CONSTRAINT dataelementcategoryoption_name_key" );
> > + //executeSql( "ALTER TABLE dataelementcategoryoption DROP
> CONSTRAINT dataelementcategoryoption_name_key" ); will be maintained in
> transition period
> > executeSql( "ALTER TABLE dataelementcategoryoption DROP
> CONSTRAINT dataelementcategoryoption_shortname_key" );
> >
> > log.info( "Updated Category sort order and primary keys" );
> >
> > === modified file
> 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml'
> > ---
> dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml
> 2009-10-21 18:41:33 +0000
> > +++
> dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml
> 2009-10-30 13:22:00 +0000
> > @@ -13,7 +13,7 @@
> > <property name="uuid" length="40"/>
> >
> > <property name="name">
> > - <column name="name" not-null="true" length="160"/>
> > + <column name="name" not-null="true" unique="true" length="160"/>
> > </property>
> >
> > <list name="categoryOptionCombos"
> table="categoryoptioncombos_categoryoptions" inverse="true">
> >
> >
> > _______________________________________________
> > 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
> >
> >
>
> _______________________________________________
> 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
>
Follow ups
References