Skip to content

getInputs

Chuck May edited this page Apr 14, 2015 · 8 revisions

API

public Set<String> getInputs(StagingSchema schema)
public Set<String> getInputs(StagingSchema schema, Map<String, String> context)

Description

Examine all tables involved in a schema and return a Set of input keys that could be used when staging. As each mapping is examined, any mapped inputs are taken into effect. In addition, the inputs from each mapping will only be included if it passes the inclusion/exclusion criteria based on the context. Note that if an input to a table was not a supplied input (i.e. it was created as an output of a previous table) it will not be included in the list of inputs. The inputs will also include any used in schema selection.

The most common use-case for this API is to determine the required inputs for a schema after performing schema selection. For example, depending on the histology range certain inputs may not be used in the staging process and therefore do not need to be supplied to the staging API. This helps in building intelligent data-entry screens that only collect information that is actually needed.

There are multiple versions of the API, however the two commonly used operate on a single schema and optionally supply a context to use for evaluation.

Examples

Staging staging = Staging.getInstance(CsDataProvider.getInstance(CsVersion.v020550));

Assert.assertEquals(Sets.newHashSet("extension", "site", "extension_eval", 
    "mets_eval", "nodes_eval", "nodes", "hist", "year_dx", 
    "cs_input_version_original", "mets"),
    staging.getInputs(staging.getSchema("adnexa_uterine_other")));

Assert.assertEquals(Sets.newHashSet("site", "nodes_pos", "mets_eval", 
    "nodes_eval", "ssf16", "ssf15", "ssf13", "cs_input_version_original", 
    "lvi", "extension", "extension_eval", "ssf1", "ssf2", "ssf3", "hist", 
    "ssf4", "nodes", "ssf5", "year_dx", "mets"),
    staging.getInputs(staging.getSchema("testis")));

// test without context
Assert.assertEquals(Sets.newHashSet("site", "nodes_eval", "mets_eval", 
    "ssf10", "cs_input_version_original", "ssf8", "extension", "extension_eval", 
    "ssf1", "ssf3","hist", "nodes", "year_dx", "grade", "mets"),
    staging.getInputs(staging.getSchema("prostate")));

// test with context
Map<String, String> context = new HashMap<String, String>();
context.put(StagingData.PRIMARY_SITE_KEY, "C619");
context.put(StagingData.HISTOLOGY_KEY, "8120");
context.put(StagingData.YEAR_DX_KEY, "2004");

// for this context, neither AJCC6 or 7 should be calculated so "grade" and "ssf1" 
// should not be in the set of inputs
Assert.assertEquals(Sets.newHashSet("site", "nodes_eval", "mets_eval", "ssf10", 
    "cs_input_version_original", "ssf8", "extension", "extension_eval", "ssf3", 
    "hist", "nodes", "year_dx", "mets"),
    staging.getInputs(staging.getSchema("prostate"), context));
Clone this wiki locally