-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#29 | Vivek, Suhas | Checklist table creation WIP
- Loading branch information
Suhas Vishwanath
committed
Jul 12, 2023
1 parent
00e3137
commit 1ca4386
Showing
5 changed files
with
68 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/org/avniproject/etl/repository/rowMappers/tableMappers/ChecklistTable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.avniproject.etl.repository.rowMappers.tableMappers; | ||
|
||
import org.avniproject.etl.domain.metadata.Column; | ||
import org.avniproject.etl.domain.metadata.ColumnMetadata; | ||
import org.avniproject.etl.repository.rowMappers.ColumnMetadataMapper; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
import static java.lang.String.format; | ||
|
||
public class ChecklistTable extends Table { | ||
private final List<Map<String, Object>> checklistTypes; | ||
|
||
public ChecklistTable(List<Map<String, Object>> checklistTypes) { | ||
this.checklistTypes = checklistTypes; | ||
} | ||
|
||
@Override | ||
public String name(Map<String, Object> tableDetails) { | ||
return generateTableName("checklist", "", tableDetails, "name"); | ||
} | ||
|
||
@Override | ||
public List<Column> columns() { | ||
return new Columns() | ||
.withIdColumn() | ||
.withColumn(new Column("program_enrolment_id", Column.Type.integer, Column.ColumnType.index)) | ||
.withColumn(new Column("base_date", Column.Type.date)) | ||
.withCommonColumns() | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
select cd.name name, | ||
program.name program_name, | ||
st.name subject_type_name | ||
from checklist_detail cd | ||
join program on program.name = 'Child' | ||
join form_mapping fm on fm.entity_id = program.id | ||
join form f on fm.form_id = f.id | ||
join subject_type st on st.id = fm.subject_type_id | ||
where f.form_type = 'ProgramEnrolment'; |