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

Using modified demographics files with synthea-with-dependencies.jar #1224

Closed
m-goggins opened this issue Dec 19, 2022 · 3 comments
Closed
Labels

Comments

@m-goggins
Copy link

What happened?

Hello!

I am trying to use the downloaded synthea jar file (v3.1.1) on Windows 11 Pro with Java version 11.0.16.1 and modifying the following demographic files:

demographics.default_file
geography.zipcodes.default_file
geography.timezones.default_file
geography.sdoh.default_file
When I try passing in params like:
java -jar synthea-with-dependencies.jar -p 10 --generate.demographics.default_file="C:\test\modified_demographics.csv"

I get the following errors:

ERROR: unable to load demographics
java.lang.IllegalArgumentException: resource C:\test\modified_demographics.csv not found.
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:220)
        at com.google.common.io.Resources.getResource(Resources.java:198)
        at org.mitre.synthea.engine.Generator.init(Generator.java:226)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:208)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:184)
        at App.main(App.java:229)
Caused by: java.lang.IllegalArgumentException: resource C:\test\modified_demographics.csv not found.
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:220)
        at com.google.common.io.Resources.getResource(Resources.java:198)
        at org.mitre.synthea.helpers.Utilities.readResource(Utilities.java:410)
        at org.mitre.synthea.world.geography.Demographics.load(Demographics.java:388)
        at org.mitre.synthea.world.geography.Location.<init>(Location.java:64)
        at org.mitre.synthea.engine.Generator.init(Generator.java:226)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:208)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:184)
        at App.main(App.java:229)
Exception in thread "main" java.lang.ExceptionInInitializerError
        at org.mitre.synthea.world.geography.Location.<init>(Location.java:102)
        at org.mitre.synthea.engine.Generator.init(Generator.java:226)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:208)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:184)
        at App.main(App.java:229)
Caused by: java.lang.IllegalArgumentException: resource C:\test\modified_demographics.csv not found.
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:220)
        at com.google.common.io.Resources.getResource(Resources.java:198)
        at org.mitre.synthea.helpers.Utilities.readResource(Utilities.java:410)
        at org.mitre.synthea.world.geography.Demographics.load(Demographics.java:388)
        at org.mitre.synthea.world.geography.Location.<init>(Location.java:64)
        ... 4 more

I have tried adding the modified demographics files to the same folder as the jar file, switch the direction of the slashes, with and without quotes around the file path, etc. The wiki for common configurations doesn't include non-boolean examples and the examples for other geographic areas assume you have cloned the repo rather than use the jar file.

I am able to generate the correct files when I clone the full repo and modify the synthea.properties file.

Has anyone able to use modified demographic files with the jar download successfully?

Environment

- OS: Windows 11 Pro
- Java: 11.0.16.1

Relevant log output

ERROR: unable to load demographics
java.lang.IllegalArgumentException: resource C:\test\modified_demographics.csv not found.
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:220)
        at com.google.common.io.Resources.getResource(Resources.java:198)
        at org.mitre.synthea.engine.Generator.init(Generator.java:226)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:208)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:184)
        at App.main(App.java:229)
Caused by: java.lang.IllegalArgumentException: resource C:\test\modified_demographics.csv not found.
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:220)
        at com.google.common.io.Resources.getResource(Resources.java:198)
        at org.mitre.synthea.helpers.Utilities.readResource(Utilities.java:410)
        at org.mitre.synthea.world.geography.Demographics.load(Demographics.java:388)
        at org.mitre.synthea.world.geography.Location.<init>(Location.java:64)
        at org.mitre.synthea.engine.Generator.init(Generator.java:226)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:208)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:184)
        at App.main(App.java:229)
Exception in thread "main" java.lang.ExceptionInInitializerError
        at org.mitre.synthea.world.geography.Location.<init>(Location.java:102)
        at org.mitre.synthea.engine.Generator.init(Generator.java:226)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:208)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:184)
        at App.main(App.java:229)
Caused by: java.lang.IllegalArgumentException: resource C:\test\modified_demographics.csv not found.
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:220)
        at com.google.common.io.Resources.getResource(Resources.java:198)
        at org.mitre.synthea.helpers.Utilities.readResource(Utilities.java:410)
        at org.mitre.synthea.world.geography.Demographics.load(Demographics.java:388)
        at org.mitre.synthea.world.geography.Location.<init>(Location.java:64)
        ... 4 more
@m-goggins m-goggins added the bug label Dec 19, 2022
@dehall
Copy link
Contributor

dehall commented Dec 19, 2022

Thanks for reporting this -- as I look at it now we do have different types of configuration options referring to files. Some like this one, are "resources" which are required to be under the src/main/resources folder, others can be anywhere on the file system, and that difference isn't apparent to a user. I'll take a look and see if there's any reason we can't make any configuration file able to be located anywhere

@dehall
Copy link
Contributor

dehall commented Jan 31, 2023

Hi @m-goggins , apologies for the delay here. We merged #1226 recently which should allow all files pointed to in config settings to either be relative to src/main/resources or an absolute path to anywhere on the file system. Let us know if you encounter any issues

@m-goggins
Copy link
Author

Incredible! I saw that merge and started using it last week; no issues so far. I appreciate the work you and the rest of the dev team have done on it @dehall

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

No branches or pull requests

2 participants