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

BlueButton 2 RIF Exporter #770

Merged
merged 131 commits into from
Dec 21, 2021
Merged

BlueButton 2 RIF Exporter #770

merged 131 commits into from
Dec 21, 2021

Conversation

hadleynet
Copy link
Collaborator

@hadleynet hadleynet commented Aug 19, 2020

This pull request features a number changes in order to support the RIF data dictionary required for the CMS BFD project.

Related pull requests:

@codecov
Copy link

codecov bot commented Aug 19, 2020

Codecov Report

Merging #770 (a74506b) into master (e801d58) will increase coverage by 1%.
The diff coverage is 93%.

Impacted file tree graph

@@            Coverage Diff             @@
##             master    #770     +/-   ##
==========================================
+ Coverage        80%     81%     +1%     
- Complexity     2886    3145    +259     
==========================================
  Files           113     116      +3     
  Lines         17459   21105   +3646     
  Branches       2474    2800    +326     
==========================================
+ Hits          14077   17279   +3202     
- Misses         2593    2985    +392     
- Partials        789     841     +52     
Impacted Files Coverage Δ
.../java/org/mitre/synthea/export/BB2RIFExporter.java 59% <ø> (ø)
...tre/synthea/world/concepts/ClinicianSpecialty.java 3% <1%> (-64%) ⬇️
...java/org/mitre/synthea/world/agents/Clinician.java 79% <40%> (-5%) ⬇️
...in/java/org/mitre/synthea/world/agents/Person.java 85% <50%> (+<1%) ⬆️
.../world/agents/behaviors/ProviderFinderNearest.java 95% <50%> (ø)
src/main/java/org/mitre/synthea/engine/State.java 87% <66%> (+<1%) ⬆️
...rc/main/java/org/mitre/synthea/helpers/Config.java 69% <66%> (-2%) ⬇️
...c/main/java/org/mitre/synthea/export/Exporter.java 65% <70%> (+5%) ⬆️
.../java/org/mitre/synthea/world/agents/Provider.java 87% <87%> (+<1%) ⬆️
...n/java/org/mitre/synthea/world/concepts/Claim.java 93% <87%> (+6%) ⬆️
... and 43 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e801d58...a74506b. Read the comment docs.

Copy link
Collaborator

@eedrummer eedrummer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments on the Java side of things. Still need to run things locally and check the GMF.

src/main/java/org/mitre/synthea/export/BB2RIFExporter.java Outdated Show resolved Hide resolved
src/main/java/org/mitre/synthea/export/BB2RIFExporter.java Outdated Show resolved Hide resolved
src/main/java/org/mitre/synthea/export/BB2RIFExporter.java Outdated Show resolved Hide resolved
src/main/java/org/mitre/synthea/export/BB2RIFExporter.java Outdated Show resolved Hide resolved
src/main/java/org/mitre/synthea/export/BB2RIFExporter.java Outdated Show resolved Hide resolved
src/main/java/org/mitre/synthea/export/BB2RIFExporter.java Outdated Show resolved Hide resolved
src/main/java/org/mitre/synthea/export/BB2RIFExporter.java Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
src/main/java/org/mitre/synthea/engine/State.java Outdated Show resolved Hide resolved
}
}

private String trimToLength(String str, int maxLength) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is equivalent to org.apache.commons.lang3.StringUtils.truncate(str, maxLength) -- StringUtils is already in the repo via one or more existing dependencies so we don't have to add anything new

src/main/java/org/mitre/synthea/export/BB2RIFExporter.java Outdated Show resolved Hide resolved
@eedrummer
Copy link
Collaborator

Is there a file that is missing? I'm getting errors when I run Synthea with BFD export turned on:

java.lang.NoClassDefFoundError: Could not initialize class org.mitre.synthea.export.BB2RIFExporter$SingletonHolder
        at org.mitre.synthea.export.BB2RIFExporter.getInstance(BB2RIFExporter.java:4096)
        at org.mitre.synthea.export.Exporter.exportRecord(Exporter.java:259)
        at org.mitre.synthea.export.Exporter.export(Exporter.java:159)
        at org.mitre.synthea.engine.Generator.generatePerson(Generator.java:530)
        at org.mitre.synthea.engine.Generator.lambda$run$3(Generator.java:357)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.ExceptionInInitializerError
        at org.mitre.synthea.export.BB2RIFExporter.getInstance(BB2RIFExporter.java:4096)
        at org.mitre.synthea.export.Exporter.exportRecord(Exporter.java:259)
        at org.mitre.synthea.export.Exporter.export(Exporter.java:159)
        at org.mitre.synthea.engine.Generator.generatePerson(Generator.java:530)
        at org.mitre.synthea.engine.Generator.lambda$run$3(Generator.java:357)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.util.MissingResourceException: Unable to read code map file: export/condition_code_map.json
        at org.mitre.synthea.export.BB2RIFExporter$CodeMapper.<init>(BB2RIFExporter.java:4130)
        at org.mitre.synthea.export.BB2RIFExporter.<init>(BB2RIFExporter.java:147)
        at org.mitre.synthea.export.BB2RIFExporter.<init>(BB2RIFExporter.java:84)
        at org.mitre.synthea.export.BB2RIFExporter$SingletonHolder.<clinit>(BB2RIFExporter.java:4087)
        ... 9 more

@hadleynet
Copy link
Collaborator Author

Set exporter.bfd.require_code_maps to false in your src/main/resources/synthea.properties file. Its set to true by default so that folks will see an error if they haven't installed the code mapping files. We can't check in the code mapping files because they contain codes from proprietary code systems.

@eedrummer
Copy link
Collaborator

@hadleynet - That worked. Thanks.

hadleynet and others added 22 commits December 9, 2021 17:07
…% of benes change their current plan each Jan.
…F IDs (BENE_ID, MBI etc) that increment per patient or claim. This allows a subsequent run of Synthea to pick up where the previous one finished by using the -c flag to import the new starting point.
…or UPDATES. This avoids an issue in the RifLoader related to batching where an UPDATE could precede an INSERT.
…r the final (chronologically) updates (1 per bene) and one for all interim updates between the initial insert and the final update. Also includes some refactoring and renaming with the aim of aligning with BFD type names.
…ounter skip criteria for outpatient and inpatient files to include encounters with coded reasons even if no diagnoses or procedures are recorded for that encounter.
…d to ensure fields are supported across all appropriate file types.
Copy link
Contributor

@dehall dehall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor comments that I want to submit before I lose them. Will finish reviewing tomorrow

src/main/java/org/mitre/synthea/world/agents/Provider.java Outdated Show resolved Hide resolved
src/main/resources/modules/home_health_treatment.json Outdated Show resolved Hide resolved
* @param stopTime end time of simulation
* @throws IOException if something goes wrong
*/
private void exportSNF(Person person, long stopTime) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generated a sample 100 patient population, and in the output I had a snf.csv file that was totally empty. Is that the intended functionality? (ie, should the file be blank instead of just a header row?) I did confirm the file gets written to correctly if there are rows in it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you recall what params you used? In my testing I don't see a snf.csv file being created if there are no rows (vs creating an empty file).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it again a couple times and I haven't see any instances where the file is empty at the end of generation. Maybe I jumped the gun and looked at the file in the editor before generation was complete one time.

One other thing I do notice though is that if you generate one population where a file such as snf.csv is present, then a second population where nothing gets written to the file, the original file stays there. This is ok (the manifest doesn't refer to the file, and the same thing can happen with the CSV exporter if you change the included/excluded files) but it might be nice to document somehow. (Though I'm not sure where such a note would best fit)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BB RIF exporter is designed so that you can run Synthea multiple times to build up a population. We have a script that runs Synthea for each of the states and the resulting single sets of files then contain a national population.

Copy link
Contributor

@dehall dehall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks really good. I focused less on the new exporter itself (as I don't expect the broader userbase to make heavy use of that) and more on the surrounding changes. Of which there are a surprising number.
There is only one change which I think is necessary, which is the default setting for the few new config items. Anything else is a suggestion/recommendation not a requirement.

Comment on lines +150 to +161
"distributed_transition": [
{
"distribution": 0.74,
"transition": "Physical_Therapy"
},
{
"distribution": 0.18,
"transition": "Occupational_Therapy"
},
{
"distribution": 0.08,
"transition": "Speech_Language_Therapy"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be too big to easily fix, but this randomized approach could lead to weird results, for example a patient could come from knee replacement but then get speech language therapy.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fixed, I think we should create an issue to revisit this module in a separate PR after merge.

src/main/java/org/mitre/synthea/world/concepts/Costs.java Outdated Show resolved Hide resolved
@hadleynet hadleynet merged commit af4a81e into master Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants