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

WIP: Diabetic retinopathy #1483

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
54 changes: 54 additions & 0 deletions keep_diabetes_no_dr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "keep_diabetes_no_dr",
"remarks": [
"A blank module"
],
"states": {
"Initial": {
"type": "Initial",
"conditional_transition": [
{
"transition": "Keep",
"condition": {
"condition_type": "And",
"conditions": [
{
"condition_type": "Active Condition",
"codes": [
{
"system": "SNOMED-CT",
"code": 44054006,
"display": "Diabetes mellitus type 2 (disorder)"
}
]
},
{
"condition_type": "Not",
"condition": {
"condition_type": "Active Condition",
"codes": [
{
"system": "SNOMED-CT",
"code": "1551000119108",
"display": "Nonproliferative diabetic retinopathy due to type 2 diabetes mellitus (disorder)"
}
]
}
}
]
}
},
{
"transition": "Terminal"
}
]
},
"Terminal": {
"type": "Terminal"
},
"Keep": {
"type": "Terminal"
}
},
"gmf_version": 2
}
36 changes: 36 additions & 0 deletions keep_npdr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "Generated Keep Module",
"states": {
"Initial": {
"type": "Initial",
"name": "Initial",
"conditional_transition": [
{
"transition": "Keep",
"condition": {
"condition_type": "Active Condition",
"codes": [
{
"system": "SNOMED-CT",
"code": "1551000119108",
"display": "Nonproliferative diabetic retinopathy due to type 2 diabetes mellitus (disorder)"
}
]
}
},
{
"transition": "Terminal"
}
]
},
"Terminal": {
"type": "Terminal",
"name": "Terminal"
},
"Keep": {
"type": "Terminal",
"name": "Keep"
}
},
"gmf_version": 2
}
54 changes: 54 additions & 0 deletions keep_npdr_no_pdr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "keep_npdr_no_pdr",
"remarks": [
"A blank module"
],
"states": {
"Initial": {
"type": "Initial",
"conditional_transition": [
{
"transition": "Keep",
"condition": {
"condition_type": "And",
"conditions": [
{
"condition_type": "Active Condition",
"codes": [
{
"system": "SNOMED-CT",
"code": "1551000119108",
"display": "Nonproliferative diabetic retinopathy due to type 2 diabetes mellitus (disorder)"
}
]
},
{
"condition_type": "Not",
"condition": {
"condition_type": "Active Condition",
"codes": [
{
"system": "SNOMED-CT",
"code": "1501000119109",
"display": "Proliferative diabetic retinopathy due to type II diabetes mellitus (disorder)"
}
]
}
}
]
}
},
{
"transition": "Terminal"
}
]
},
"Terminal": {
"type": "Terminal"
},
"Keep": {
"type": "Terminal"
}
},
"gmf_version": 2
}
36 changes: 36 additions & 0 deletions keep_pdr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "Generated Keep Module",
"states": {
"Initial": {
"type": "Initial",
"name": "Initial",
"conditional_transition": [
{
"transition": "Keep",
"condition": {
"condition_type": "Active Condition",
"codes": [
{
"system": "SNOMED-CT",
"code": "1501000119109",
"display": "Proliferative diabetic retinopathy due to type II diabetes mellitus (disorder)"
}
]
}
},
{
"transition": "Terminal"
}
]
},
"Terminal": {
"type": "Terminal",
"name": "Terminal"
},
"Keep": {
"type": "Terminal",
"name": "Keep"
}
},
"gmf_version": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ public static String export(Person person, Encounter encounter) {
person.attributes.put("ehr_medications", encounter.medications);
person.attributes.put("ehr_careplans", encounter.careplans);
person.attributes.put("ehr_imaging_studies", encounter.imagingStudies);
if (encounter.note == null) {
person.attributes.remove("ehr_note");
} else {
person.attributes.put("ehr_note", encounter.note);
}
person.attributes.put("time", encounter.start);
if (person.attributes.containsKey(LifecycleModule.QUIT_SMOKING_AGE)) {
person.attributes.put("quit_smoking_age",
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/org/mitre/synthea/export/flexporter/Actions.java
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,9 @@ private static void dateFilter(Bundle bundle, String minDateStr, String maxDateS
* Cascade (current), Delete reference field but leave object, Do nothing
*
* @param bundle FHIR Bundle to filter
* @param list List of resource types to delete, other types not listed will be kept
* @param list List of resource types or FHIRPath to delete, other types not listed will be kept
*/
public static void deleteResources(Bundle bundle, List<String> list) {
// TODO: make this FHIRPath instead of just straight resource types

Set<String> resourceTypesToDelete = new HashSet<>(list);

Set<String> deletedResourceIDs = new HashSet<>();

Iterator<BundleEntryComponent> itr = bundle.getEntry().iterator();
Expand All @@ -665,9 +661,12 @@ public static void deleteResources(Bundle bundle, List<String> list) {

Resource resource = entry.getResource();
String resourceType = resource.getResourceType().toString();
if (resourceTypesToDelete.contains(resourceType)) {
deletedResourceIDs.add(resource.getId());
itr.remove();
for (String applicability : list) {
if (applicability.equals(resourceType) || FhirPathUtils.appliesToResource(resource, applicability)) {
deletedResourceIDs.add(resource.getId());
itr.remove();
break;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public class Entry implements Serializable {
public String type;
public List<Code> codes;
private BigDecimal cost;
public String note;

/**
* Constructor for Entry.
Expand Down
Loading
Loading