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

FHIR Resource Type Filter #1104

Closed
jawalonoski opened this issue Jun 28, 2022 · 3 comments
Closed

FHIR Resource Type Filter #1104

jawalonoski opened this issue Jun 28, 2022 · 3 comments

Comments

@jawalonoski
Copy link
Member

Requested Feature

Modify the FHIR exporters to only export specific resources, similar to how the CSV exporter can include/exclude specific files:

# included_files and excluded_files list out the files to include/exclude in the csv exporter
# only one of these may be set at a time, if both are set then both will be ignored
# if neither is set, then all files will be included
# see list of files at: https://github.com/synthetichealth/synthea/wiki/CSV-File-Data-Dictionary
# include filenames separated with a comma, ex: patients.csv,procedures.csv,medications.csv
# NOTE: the csv exporter does not actively delete files, so if Run 1 you included a file, then Run 2 you exclude that file, the version from Run 1 will still be present
exporter.csv.included_files =
exporter.csv.excluded_files =

@willdalh
Copy link

Any update on this?

I have found that I can hack a solution for this by commenting out certain parts in org.mitre.synthea.export.FhirR4.java. In my case the lines for Claim and ExplanationOfBenefit.

for (Encounter encounter : person.record.encounters) {
BundleEntryComponent encounterEntry = encounter(person, personEntry, bundle, encounter);
for (HealthRecord.Entry condition : encounter.conditions) {
condition(person, personEntry, bundle, encounterEntry, condition);
}
for (HealthRecord.Allergy allergy : encounter.allergies) {
allergy(person, personEntry, bundle, encounterEntry, allergy);
}
for (Observation observation : encounter.observations) {
// If the Observation contains an attachment, use a Media resource, since
// Observation resources in v4 don't support Attachments
if (observation.value instanceof Attachment) {
media(person, personEntry, bundle, encounterEntry, observation);
} else {
observation(person, personEntry, bundle, encounterEntry, observation);
}
}
for (Procedure procedure : encounter.procedures) {
procedure(person, personEntry, bundle, encounterEntry, procedure);
}
for (HealthRecord.Device device : encounter.devices) {
device(person, personEntry, bundle, device);
}
for (HealthRecord.Supply supply : encounter.supplies) {
supplyDelivery(person, personEntry, bundle, supply, encounter);
}
for (Medication medication : encounter.medications) {
medicationRequest(person, personEntry, bundle, encounterEntry, encounter, medication);
}
for (HealthRecord.Entry immunization : encounter.immunizations) {
immunization(person, personEntry, bundle, encounterEntry, immunization);
}
for (Report report : encounter.reports) {
report(person, personEntry, bundle, encounterEntry, report);
}
for (CarePlan careplan : encounter.careplans) {
BundleEntryComponent careTeamEntry =
careTeam(person, personEntry, bundle, encounterEntry, careplan);
carePlan(person, personEntry, bundle, encounterEntry, encounter.provider, careTeamEntry,
careplan);
}
for (ImagingStudy imagingStudy : encounter.imagingStudies) {
imagingStudy(person, personEntry, bundle, encounterEntry, imagingStudy);
}
if (USE_US_CORE_IG) {
String clinicalNoteText = ClinicalNoteExporter.export(person, encounter);
boolean lastNote =
(encounter == person.record.encounters.get(person.record.encounters.size() - 1));
clinicalNote(person, personEntry, bundle, encounterEntry, clinicalNoteText, lastNote);
}
// one claim per encounter
BundleEntryComponent encounterClaim =
encounterClaim(person, personEntry, bundle, encounterEntry, encounter);
explanationOfBenefit(personEntry, bundle, encounterEntry, person,
encounterClaim, encounter, encounter.claim);
}

Would you recommend any other way? Ideally the resources I want to omit should not be generated at all, but I guess there are some dependencies between these.

@jawalonoski
Copy link
Member Author

I don't believe anyone is actively working on this yet. If you are motivated enough to issue a Pull Request, we'd happily consider it.

The hack you are using is fine for a quick local change, but you are correct that there are dependencies... or at least, references between the resources. Ideally each time a reference is created, it would instead be conditionally created based on what resources are being included/exported. This would need some pretty good test cases though to validate the results (broken references would be invalid).

@dehall
Copy link
Contributor

dehall commented Dec 15, 2022

Implemented in #1178

@dehall dehall closed this as completed Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants