Skip to content

Commit a7878ea

Browse files
authored
Merge pull request #13 from imsweb/mph
Add support for MPH
2 parents 2957b4b + e47c363 commit a7878ea

10 files changed

Lines changed: 306 additions & 12 deletions

File tree

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = 'com.imsweb'
11-
version = '3.3'
11+
version = '3.4'
1212
description = 'Java client library for SEER*API'
1313

1414
println "Starting build using ${Jvm.current()}"
@@ -63,7 +63,7 @@ findbugs {
6363

6464
// Gradle wrapper, this allows to build the project without having to install Gradle!
6565
task wrapper(type: Wrapper) {
66-
gradleVersion = '3.1'
66+
gradleVersion = '3.2.1'
6767
}
6868

6969
modifyPom {

gradle/wrapper/gradle-wrapper.jar

1.27 KB
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Oct 03 09:46:00 EDT 2016
1+
#Wed Dec 07 11:32:53 EST 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-all.zip

gradlew

Lines changed: 11 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/com/imsweb/seerapi/client/SeerApi.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import com.imsweb.seerapi.client.disease.DiseaseService;
2525
import com.imsweb.seerapi.client.glossary.GlossaryService;
26+
import com.imsweb.seerapi.client.mph.MphService;
2627
import com.imsweb.seerapi.client.naaccr.NaaccrService;
2728
import com.imsweb.seerapi.client.ndc.NdcService;
2829
import com.imsweb.seerapi.client.rx.RxService;
@@ -37,6 +38,7 @@ public final class SeerApi {
3738

3839
private DiseaseService _diseaseService;
3940
private GlossaryService _glossaryService;
41+
private MphService _mphService;
4042
private NaaccrService _naaccrService;
4143
private NdcService _ndcService;
4244
private RxService _rxService;
@@ -78,6 +80,7 @@ private SeerApi(String baseUrl, final String apiKey) {
7880
// create cached service entities
7981
_diseaseService = retrofit.create(DiseaseService.class);
8082
_glossaryService = retrofit.create(GlossaryService.class);
83+
_mphService = retrofit.create(MphService.class);
8184
_naaccrService = retrofit.create(NaaccrService.class);
8285
_ndcService = retrofit.create(NdcService.class);
8386
_rxService = retrofit.create(RxService.class);
@@ -125,6 +128,14 @@ public GlossaryService glossary() {
125128
return _glossaryService;
126129
}
127130

131+
/**
132+
* Return the multiple primary service
133+
* @return an interface to the multiple APIs
134+
*/
135+
public MphService mph() {
136+
return _mphService;
137+
}
138+
128139
/**
129140
* Return the NAACCR service
130141
* @return an inteface to all the NAACCR APIs
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
package com.imsweb.seerapi.client.mph;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
public class MphInput {
6+
7+
@JsonProperty("primary_site")
8+
private String _primarySite;
9+
@JsonProperty("histology_icd_o3")
10+
private String _histologyIcdO3;
11+
@JsonProperty("histology_icd_o2")
12+
private String _histologyIcdO2;
13+
@JsonProperty("behavior_icd_o3")
14+
private String _behaviorIcdO3;
15+
@JsonProperty("behavior_icd_o2")
16+
private String _behaviorIcdO2;
17+
@JsonProperty("laterality")
18+
private String _laterality;
19+
@JsonProperty("date_of_diagnosis_year")
20+
private String _dateOfDiagnosisYear;
21+
@JsonProperty("date_of_diagnosis_month")
22+
private String _dateOfDiagnosisMonth;
23+
@JsonProperty("date_of_diagnosis_day")
24+
private String _dateOfDiagnosisDay;
25+
@JsonProperty("tx_status")
26+
private String _txStatus;
27+
28+
public String getPrimarySite() {
29+
return _primarySite;
30+
}
31+
32+
public void setPrimarySite(String primarySite) {
33+
_primarySite = primarySite;
34+
}
35+
36+
public String getHistologyIcdO3() {
37+
return _histologyIcdO3;
38+
}
39+
40+
public void setHistologyIcdO3(String histologyIcdO3) {
41+
_histologyIcdO3 = histologyIcdO3;
42+
}
43+
44+
public String getHistologyIcdO2() {
45+
return _histologyIcdO2;
46+
}
47+
48+
public void setHistologyIcdO2(String histologyIcdO2) {
49+
_histologyIcdO2 = histologyIcdO2;
50+
}
51+
52+
public String getBehaviorIcdO3() {
53+
return _behaviorIcdO3;
54+
}
55+
56+
public void setBehaviorIcdO3(String behaviorIcdO3) {
57+
_behaviorIcdO3 = behaviorIcdO3;
58+
}
59+
60+
public String getBehaviorIcdO2() {
61+
return _behaviorIcdO2;
62+
}
63+
64+
public void setBehaviorIcdO2(String behaviorIcdO2) {
65+
_behaviorIcdO2 = behaviorIcdO2;
66+
}
67+
68+
public String getLaterality() {
69+
return _laterality;
70+
}
71+
72+
public void setLaterality(String laterality) {
73+
_laterality = laterality;
74+
}
75+
76+
public String getDateOfDiagnosisYear() {
77+
return _dateOfDiagnosisYear;
78+
}
79+
80+
public void setDateOfDiagnosisYear(String dateOfDiagnosisYear) {
81+
_dateOfDiagnosisYear = dateOfDiagnosisYear;
82+
}
83+
84+
public String getDateOfDiagnosisMonth() {
85+
return _dateOfDiagnosisMonth;
86+
}
87+
88+
public void setDateOfDiagnosisMonth(String dateOfDiagnosisMonth) {
89+
_dateOfDiagnosisMonth = dateOfDiagnosisMonth;
90+
}
91+
92+
public String getDateOfDiagnosisDay() {
93+
return _dateOfDiagnosisDay;
94+
}
95+
96+
public void setDateOfDiagnosisDay(String dateOfDiagnosisDay) {
97+
_dateOfDiagnosisDay = dateOfDiagnosisDay;
98+
}
99+
100+
public String getTxStatus() {
101+
return _txStatus;
102+
}
103+
104+
public void setTxStatus(String txStatus) {
105+
_txStatus = txStatus;
106+
}
107+
108+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.imsweb.seerapi.client.mph;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
public class MphInputPair {
6+
7+
public MphInputPair() {
8+
}
9+
10+
public MphInputPair(MphInput input1, MphInput input2) {
11+
_input1 = input1;
12+
_input2 = input2;
13+
}
14+
15+
@JsonProperty("input1")
16+
private MphInput _input1;
17+
18+
@JsonProperty("input2")
19+
private MphInput _input2;
20+
21+
public MphInput getInput1() {
22+
return _input1;
23+
}
24+
25+
public void setInput1(MphInput input1) {
26+
_input1 = input1;
27+
}
28+
29+
public MphInput getInput2() {
30+
return _input2;
31+
}
32+
33+
public void setInput2(MphInput input2) {
34+
_input2 = input2;
35+
}
36+
37+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.imsweb.seerapi.client.mph;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
public class MphResult {
6+
7+
/**
8+
* The possible result of determining if two tumors are single or multiple primaries.
9+
*/
10+
public enum Result {
11+
// indicates the two tumors are the same primary
12+
SINGLE_PRIMARY,
13+
// indicates the two tumors are different primaries
14+
MULTIPLE_PRIMARIES,
15+
// indicates there is not enough information to make a proper determination
16+
QUESTIONABLE
17+
}
18+
19+
@JsonProperty("result")
20+
private Result _result;
21+
22+
public Result getResult() {
23+
return _result;
24+
}
25+
26+
public void setResult(Result result) {
27+
_result = result;
28+
}
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (C) 2016 Information Management Services, Inc.
3+
*/
4+
package com.imsweb.seerapi.client.mph;
5+
6+
import retrofit2.Call;
7+
import retrofit2.http.Body;
8+
import retrofit2.http.POST;
9+
10+
public interface MphService {
11+
12+
/**
13+
* Uses multiple primary rules to compare two diseases
14+
* @param pair a pair of diseases
15+
* @return a result indicating whether the two diseases are the same primary
16+
*/
17+
@POST("mph")
18+
Call<MphResult> mph(@Body MphInputPair pair);
19+
20+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package com.imsweb.seerapi.client.mph;
2+
3+
import java.io.IOException;
4+
5+
import org.junit.BeforeClass;
6+
import org.junit.Test;
7+
8+
import com.imsweb.seerapi.client.BadRequestException;
9+
import com.imsweb.seerapi.client.SeerApi;
10+
11+
import static org.junit.Assert.assertEquals;
12+
13+
public class MphTest {
14+
15+
private static MphService _MPH;
16+
17+
@BeforeClass
18+
public static void setup() {
19+
_MPH = new SeerApi.Builder().connect().mph();
20+
}
21+
22+
@Test(expected = BadRequestException.class)
23+
public void testMissingAllInput() throws IOException {
24+
_MPH.mph(new MphInputPair()).execute();
25+
}
26+
27+
@Test(expected = BadRequestException.class)
28+
public void testMissingSite() throws IOException {
29+
MphInput input1 = new MphInput();
30+
// site is missing
31+
input1.setHistologyIcdO3("8000");
32+
input1.setBehaviorIcdO3("3");
33+
input1.setDateOfDiagnosisYear("2016");
34+
input1.setLaterality("1");
35+
36+
MphInput input2 = new MphInput();
37+
input2.setPrimarySite("C501");
38+
input2.setHistologyIcdO3("8000");
39+
input2.setBehaviorIcdO3("3");
40+
input2.setDateOfDiagnosisYear("2016");
41+
input2.setLaterality("1");
42+
43+
_MPH.mph(new MphInputPair(input1, input2)).execute();
44+
}
45+
46+
@Test
47+
public void testResults() throws IOException {
48+
MphInput input1 = new MphInput();
49+
input1.setPrimarySite("C509");
50+
input1.setHistologyIcdO3("8000");
51+
input1.setBehaviorIcdO3("3");
52+
input1.setDateOfDiagnosisYear("2016");
53+
input1.setLaterality("1");
54+
55+
MphInput input2 = new MphInput();
56+
input2.setPrimarySite("C501");
57+
input2.setHistologyIcdO3("8000");
58+
input2.setBehaviorIcdO3("3");
59+
input2.setDateOfDiagnosisYear("2016");
60+
input2.setLaterality("1");
61+
62+
// first test single primary (only differs by site code)
63+
MphResult result = _MPH.mph(new MphInputPair(input1, input2)).execute().body();
64+
assertEquals(MphResult.Result.SINGLE_PRIMARY, result.getResult());
65+
66+
// next test questionable (setting laterality to unknown for one of the diseases)
67+
input2.setLaterality("9");
68+
result = _MPH.mph(new MphInputPair(input1, input2)).execute().body();
69+
assertEquals(MphResult.Result.QUESTIONABLE, result.getResult());
70+
71+
// finally test difffernt diseases; set everything the same except for the DX year
72+
input1.setPrimarySite("C501");
73+
input1.setHistologyIcdO3("8000");
74+
input1.setBehaviorIcdO3("3");
75+
input1.setDateOfDiagnosisYear("2016");
76+
input1.setLaterality("1");
77+
input2.setPrimarySite("C501");
78+
input2.setHistologyIcdO3("8000");
79+
input2.setBehaviorIcdO3("3");
80+
input2.setDateOfDiagnosisYear("1998");
81+
input2.setLaterality("1");
82+
result = _MPH.mph(new MphInputPair(input1, input2)).execute().body();
83+
assertEquals(MphResult.Result.MULTIPLE_PRIMARIES, result.getResult());
84+
}
85+
86+
}

0 commit comments

Comments
 (0)