-
Notifications
You must be signed in to change notification settings - Fork 6
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
ALS-7581: Implement multiple values per patient in CSV output #122
Changes from 4 commits
e588d65
6e8a1a6
5250867
65fbd00
efff3fd
1ae1adc
8a82ca6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,22 +13,21 @@ | |
import java.util.*; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
@Component | ||
public class PfbProcessor implements HpdsProcessor { | ||
public class MultiValueQueryProcessor implements HpdsProcessor { | ||
|
||
public static final String PATIENT_ID_FIELD_NAME = "patient_id"; | ||
private final int ID_BATCH_SIZE; | ||
private final AbstractProcessor abstractProcessor; | ||
|
||
private Logger log = LoggerFactory.getLogger(PfbProcessor.class); | ||
private Logger log = LoggerFactory.getLogger(MultiValueQueryProcessor.class); | ||
|
||
|
||
@Autowired | ||
public PfbProcessor(AbstractProcessor abstractProcessor) { | ||
public MultiValueQueryProcessor(AbstractProcessor abstractProcessor) { | ||
this.abstractProcessor = abstractProcessor; | ||
ID_BATCH_SIZE = Integer.parseInt(System.getProperty("ID_BATCH_SIZE", "0")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Undo this |
||
ID_BATCH_SIZE = Integer.parseInt(System.getProperty("ID_BATCH_SIZE", "1000")); | ||
} | ||
|
||
@Override | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package edu.harvard.hms.dbmi.avillach.hpds.service; | ||
|
||
import edu.harvard.hms.dbmi.avillach.hpds.data.query.Query; | ||
import edu.harvard.hms.dbmi.avillach.hpds.data.query.ResultType; | ||
import edu.harvard.hms.dbmi.avillach.hpds.processing.AsyncResult; | ||
import edu.harvard.hms.dbmi.avillach.hpds.test.util.BuildIntegrationTestEnvironment; | ||
import org.apache.commons.io.IOUtils; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
@ExtendWith(SpringExtension.class) | ||
@EnableAutoConfiguration | ||
@SpringBootTest(classes = edu.harvard.hms.dbmi.avillach.hpds.service.HpdsApplication.class) | ||
@ActiveProfiles("integration-test") | ||
class QueryServiceTest { | ||
|
||
@Autowired | ||
private QueryService queryService; | ||
|
||
@BeforeAll | ||
public static void beforeAll() { | ||
BuildIntegrationTestEnvironment instance = BuildIntegrationTestEnvironment.INSTANCE; | ||
} | ||
|
||
@Test | ||
public void dataframeMulti() throws IOException, InterruptedException { | ||
Query query = new Query(); | ||
List<Query.VariantInfoFilter> variantInfoFilters = new ArrayList<>(); | ||
Query.VariantInfoFilter variantInfoFilter = new Query.VariantInfoFilter(); | ||
variantInfoFilter.categoryVariantInfoFilters = Map.of("Gene_with_variant", new String[]{"LOC102723996", "LOC101928576"}); | ||
variantInfoFilters.add(variantInfoFilter); | ||
query.setVariantInfoFilters(variantInfoFilters); | ||
query.setFields(List.of("\\open_access-1000Genomes\\data\\SYNTHETIC_AGE\\")); | ||
query.setExpectedResultType(ResultType.DATAFRAME); | ||
|
||
AsyncResult asyncResult = queryService.runQuery(query); | ||
|
||
Thread.sleep(1000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. >:| |
||
|
||
System.out.println(asyncResult.getStatus()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add validation |
||
System.out.println(IOUtils.toString(new FileInputStream(asyncResult.getFile()), StandardCharsets.UTF_8)); | ||
; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value annotation