Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue #119. Add a formal interface in CohortProcessor class to get selectedUsers correctly #121

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.Getter;

/**
Expand Down Expand Up @@ -120,7 +121,8 @@ public CohortRet process(CubeRS cube) throws IOException {
}

/**
* Persist cohort file .cohort to output disk to the same level with the .dz file.
* Persist cohort file .cohort to output disk to the same level with the .dz
* file.
* E,g. ../CubeRepo/health_raw/v00000012.
*
* @param outputDir the output file path
Expand Down Expand Up @@ -166,7 +168,8 @@ public String persistCohort(String outputDir) throws IOException {
}

/**
* Persist cohort to output disk, cohort is named cohortName.cohort, e,g. "1980-1990.cohort".
* Persist cohort to output disk, cohort is named cohortName.cohort, e,g.
* "1980-1990.cohort".
* Where 1980-1990 is the cohortName in our cohort query for health-raw dataset.
*
* @param cohortPath the path to store the previous stored cohort.
Expand Down Expand Up @@ -249,8 +252,8 @@ private void processTuple(MetaChunkRS metaChunk) {
return;
}

LocalDateTime actionTime =
DateUtils.daysSinceEpoch((int) tuple.getValueBySchema(this.actionTimeSchema));
LocalDateTime actionTime = DateUtils.daysSinceEpoch(
(int) tuple.getValueBySchema(this.actionTimeSchema));
// check whether its birthEvent is selected
if (!this.birthSelector.isUserSelected(userId)) {
// if birthEvent is not selected
Expand Down Expand Up @@ -358,4 +361,13 @@ private void filterInit(MetaChunkRS metaChunkRS) {
}
}

}
/**
* the Interface to get selectedUser in CohortProcessing.
*
* @return a set of userId
*/
Set<String> getSelectedUser() {
return this.birthSelector.getAcceptedUsers();
}

}