Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dhis2/dhis2-core into DHIS2-13334_2
Browse files Browse the repository at this point in the history
  • Loading branch information
netroms committed Dec 2, 2024
2 parents 607c910 + 39b5511 commit ae2f970
Show file tree
Hide file tree
Showing 123 changed files with 1,951 additions and 767 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void removeAllCategoryOptions() {

@Override
public boolean isDefault() {
return categoryCombo != null && DEFAULT_NAME.equals(categoryCombo.getName());
return DEFAULT_NAME.equals(name);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public enum ErrorCode {
E1120("Update cannot be applied as it would make existing data values inaccessible"),
E1121("Data element `{0}` value type cannot be changed as it has associated data values"),

E1122("Category option combo {0} cannot be associated with the default category combo"),
E1125("Category option combo {0} contains options not associated with category combo {1}"),
/* Org unit merge */
E1500("At least two source orgs unit must be specified"),
E1501("Target org unit must be specified"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import javax.annotation.Nonnull;
import org.hisp.dhis.common.UID;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.feedback.BadRequestException;
import org.hisp.dhis.hierarchy.HierarchyViolationException;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.user.User;
Expand Down Expand Up @@ -304,7 +305,7 @@ List<OrganisationUnit> getOrganisationUnitsAtLevels(
* @return the count of member OrganisationUnits.
*/
Long getOrganisationUnitHierarchyMemberCount(
OrganisationUnit parent, Object member, String collectionName);
OrganisationUnit parent, Object member, String collectionName) throws BadRequestException;

OrganisationUnitDataSetAssociationSet getOrganisationUnitDataSetAssociationSet(User user);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,35 +177,35 @@ public Date getBoundaryDate(Date reportingStartDate, Date reportingEndDate) {
return returnDate;
}

public Boolean isCohortDateBoundary() {
public boolean isCohortDateBoundary() {
return !isEventDateBoundary();
}

public Boolean isEnrollmentHavingEventDateCohortBoundary() {
public boolean isEnrollmentHavingEventDateCohortBoundary() {
return boundaryTarget.startsWith(COHORT_HAVING_PROGRAM_STAGE_PREFIX);
}

public Boolean isDataElementCohortBoundary() {
public boolean isDataElementCohortBoundary() {
return boundaryTarget.startsWith(COHORT_HAVING_DATA_ELEMENT_PREFIX);
}

public Boolean isAttributeCohortBoundary() {
public boolean isAttributeCohortBoundary() {
return boundaryTarget.startsWith(COHORT_HAVING_ATTRIBUTE_PREFIX);
}

public Boolean isEventDateBoundary() {
public boolean isEventDateBoundary() {
return boundaryTarget.equals(AnalyticsPeriodBoundary.EVENT_DATE);
}

public Boolean isEnrollmentDateBoundary() {
public boolean isEnrollmentDateBoundary() {
return boundaryTarget.equals(AnalyticsPeriodBoundary.ENROLLMENT_DATE);
}

public Boolean isIncidentDateBoundary() {
public boolean isIncidentDateBoundary() {
return boundaryTarget.equals(AnalyticsPeriodBoundary.INCIDENT_DATE);
}

public Boolean isScheduledDateBoundary() {
public boolean isScheduledDateBoundary() {
return boundaryTarget.equals(AnalyticsPeriodBoundary.SCHEDULED_DATE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ public String getValue() {
return value;
}

public Boolean isEndBoundary() {
public boolean isEndBoundary() {
return this == BEFORE_END_OF_REPORTING_PERIOD || this == BEFORE_START_OF_REPORTING_PERIOD;
}

public Boolean isStartBoundary() {
public boolean isStartBoundary() {
return this == AFTER_END_OF_REPORTING_PERIOD || this == AFTER_START_OF_REPORTING_PERIOD;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
* @author Chau Thu Tran
*/
public interface ProgramExpressionService {
String ID = ProgramExpressionService.class.getName();

String INVALID_CONDITION = "Expression is not well-formed";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
* @author Abyot Asalefew
*/
public interface ProgramService {
String ID = ProgramService.class.getName();

/**
* Adds an {@link Program}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
* @author Chau Thu Tran
*/
public interface ProgramStageSectionService {
String ID = ProgramStageSection.class.getName();

// -------------------------------------------------------------------------
// ProgramStageSection
// -------------------------------------------------------------------------

/**
* Adds an {@link ProgramStageSection}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@
* @author Chau Thu Tran
*/
public interface ProgramStageSectionStore extends IdentifiableObjectStore<ProgramStageSection> {

List<ProgramStageSection> getAllByDataElement(List<DataElement> dataElements);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
* @author Abyot Asalefew
*/
public interface ProgramStageService {
String ID = ProgramStageService.class.getName();

// -------------------------------------------------------------------------
// ProgramStage
// -------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* @author Chau Thu Tran
*/
public interface ProgramStageStore extends IdentifiableObjectStore<ProgramStage> {

/**
* Retrieve a program stage by name and a program
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
* @author Chau Thu Tran
*/
public interface ProgramStore extends IdentifiableObjectStore<Program> {
String ID = ProgramStore.class.getName();

/**
* Get {@link Program} by a type
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
* @author Ameen Mohamed <[email protected]>
*/
public interface ProgramTempOwnerService {

String ID = ProgramTempOwnerService.class.getName();

/**
* Adds program temp owner
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
* @author Ameen Mohamed <[email protected]>
*/
public interface ProgramTempOwnerStore {

String ID = ProgramTempOwnerStore.class.getName();

/**
* Adds program temp owner record
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void hasDefault() {

@Test
void testIsDefault() {
categoryComboA.setName(CategoryCombo.DEFAULT_CATEGORY_COMBO_NAME);
optionComboA.setName(CategoryOptionCombo.DEFAULT_NAME);
assertTrue(optionComboA.isDefault());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ checks:
- categories/category_option_combinations_no_names.yaml
- datasets/datasets_empty.yaml
- datasets/datasets_not_assigned_to_org_units.yaml
- datasets/datasets_custom_data_entry_forms_empty.yaml
- orgunits/compulsory_orgunit_groups.yaml
- orgunits/orgunit_open_date_gt_closed_date.yaml
- orgunits/orgunits_multiple_spaces.yaml
Expand All @@ -37,6 +38,7 @@ checks:
- option_sets/unused_option_sets.yaml
- option_sets/option_sets_wrong_sort_order.yaml
- option_sets/option_groups_empty.yaml
- programs/programs_custom_data_entry_form_empty.yaml
- program_indicators/program_indicators_without_expression.yaml
- program_rules/program_rules_no_action.yaml
- program_rules/program_rules_without_condition.yaml
Expand All @@ -49,7 +51,6 @@ checks:
- analytical_objects/push_analysis_no_recipients.yaml
- data_elements/aggregate_des_no_groups.yaml
- data_elements/aggregate_des_abandoned.yaml
- data_elements/aggregate_des_inconsistent_agg_operator.yaml
- data_elements/aggregate_des_excess_groupset_membership.yaml
- data_elements/aggregate_des_no_analysis.yaml
- data_elements/aggregate_des_datasets_different_period_types.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ section: Categories
section_order: 8
summary_sql: >-
WITH coc_no_names as (
SELECT uid,name FROM categoryoptioncombo WHERE name IS NULL OR name = ''
SELECT uid FROM categoryoptioncombo WHERE name IS NULL OR name = ''
)
SELECT COUNT(*) as value,
100 * COUNT(*) / NULLIF( (SELECT COUNT(*) FROM categoryoptioncombo), 0) as percent
100.0 * COUNT(*) / NULLIF( (SELECT COUNT(*) FROM categoryoptioncombo), 0) as percent
FROM coc_no_names;
details_sql: >-
SELECT uid,name FROM categoryoptioncombo WHERE name IS NULL OR name = '';
SELECT coc.uid,
array_to_string(array_agg(co.name),';') as name FROM categoryoptioncombo coc
INNER JOIN categoryoptioncombos_categoryoptions cocs_co on cocs_co.categoryoptioncomboid = coc.categoryoptioncomboid
INNER JOIN categoryoption co on co.categoryoptionid = cocs_co.categoryoptionid
WHERE coc.name IS NULL OR coc.name = ''
GROUP BY coc.uid;
details_id_type: categoryOptionCombos
severity: SEVERE
introduction: >
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright (c) 2004-2022, University of Oslo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# Neither the name of the HISP project nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
---
name: datasets_custom_data_entry_forms_empty
description: Datasets which have custom data entry forms which are empty.
section: Data sets
section_order: 3
summary_sql: >-
WITH rs as (
SELECT a.uid,a.name,b.name as comment from dataset a
INNER JOIN (
SELECT dataentryformid, name from dataentryform WHERE
length(replace(htmlcode, ' ', '')) = 0 OR htmlcode IS NULL) b
ON a.dataentryform = b.dataentryformid)
select count(*) as value,
100*count(*) / NULLIF( (select count(*) from dataset),0) as percent
from rs;
details_sql: >-
SELECT a.uid,a.name,b.name as comment from dataset a
INNER JOIN (
SELECT dataentryformid, name from dataentryform WHERE
length(replace(htmlcode, ' ', '')) = 0 OR htmlcode IS NULL) b
ON a.dataentryform = b.dataentryformid;
severity: WARNING
introduction: >
Custom data entry forms can be created with HTML code to provide
a richer data entry experience for users. This check identifies
datasets which have custom data entry forms that are empty. This
may cause issues during data entry.
details_id_type: dataSets
recommendation: >
If the dataset should have a custom data entry form, be sure to
populate the HTML code field in the data entry form. If the dataset
should not have a custom data entry form, you should assign delete
the form and create a section form instead.
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright (c) 2004-2022, University of Oslo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# Neither the name of the HISP project nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
---
name: programs_custom_data_entry_forms_empty
description: Programs which have custom data entry forms which are empty.
section: Programs
section_order: 1
summary_sql: >-
WITH rs as (
SELECT p.uid,p.name, a.name as comment
from programstage a
INNER JOIN program p ON a.programid = p.programid
INNER JOIN (
SELECT dataentryformid, name from dataentryform WHERE
length(replace(htmlcode, ' ', '')) = 0 OR htmlcode IS NULL) b
ON a.dataentryformid = b.dataentryformid
UNION
SELECT a.uid, a.name, 'Enrollment' as comment
from program a
INNER JOIN (
SELECT dataentryformid, name from dataentryform WHERE
length(replace(htmlcode, ' ', '')) = 0 OR htmlcode IS NULL) b
ON a.dataentryformid = b.dataentryformid
)
select count(*) as value,
100.0 * count(*) / NULLIF( (select count(*) from program),0) as percent
from rs;
details_sql: >-
SELECT p.uid,p.name, a.name as comment
from programstage a
INNER JOIN program p ON a.programid = p.programid
INNER JOIN (
SELECT dataentryformid, name from dataentryform WHERE
length(replace(htmlcode, ' ', '')) = 0 OR htmlcode IS NULL) b
ON a.dataentryformid = b.dataentryformid
UNION
SELECT a.uid, a.name, 'Enrollment' as comment
from program a
INNER JOIN (
SELECT dataentryformid, name from dataentryform WHERE
length(replace(htmlcode, ' ', '')) = 0 OR htmlcode IS NULL) b
ON a.dataentryformid = b.dataentryformid;
severity: WARNING
introduction: >
Custom data entry forms can be created with HTML code to provide
a richer data entry experience for users. This check identifies
any program stages which have custom data entry forms that are empty. This
may cause issues during data entry.
details_id_type: programs
recommendation: >
If the program stage, or event program, should have a custom data entry form, be sure to
populate the HTML code field in the data entry form. If the program stage or event program
should not have a custom data entry form, you should assign delete
the empty custom form and create an appropriate form instead.
Loading

0 comments on commit ae2f970

Please sign in to comment.