Spaces:
Sleeping
Sleeping
device token
Browse files
api/services/synthea_integration.py
CHANGED
|
@@ -85,7 +85,9 @@ class SyntheaIntegrationService:
|
|
| 85 |
"exporter.fhir.include_observations": "true",
|
| 86 |
"exporter.fhir.include_procedures": "true",
|
| 87 |
"exporter.fhir.include_immunizations": "true",
|
| 88 |
-
"exporter.fhir.include_allergies": "true"
|
|
|
|
|
|
|
| 89 |
}
|
| 90 |
|
| 91 |
async def download_synthea(self) -> bool:
|
|
@@ -157,13 +159,20 @@ class SyntheaIntegrationService:
|
|
| 157 |
for file in self.output_dir.glob("*.json"):
|
| 158 |
file.unlink()
|
| 159 |
|
| 160 |
-
# Run Synthea with more
|
| 161 |
cmd = [
|
| 162 |
"java", "-jar", str(self.synthea_jar_path),
|
| 163 |
-
"-
|
| 164 |
-
"-o", str(self.output_dir.absolute()),
|
| 165 |
-
"
|
| 166 |
-
"--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
]
|
| 168 |
|
| 169 |
logger.info(f"Running command: {' '.join(cmd)}")
|
|
@@ -213,6 +222,15 @@ class SyntheaIntegrationService:
|
|
| 213 |
for subdir in subdirs:
|
| 214 |
json_files = list(subdir.glob("*.json"))
|
| 215 |
logger.info(f"📁 JSON files in {subdir.name}: {[f.name for f in json_files]}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
else:
|
| 217 |
logger.warning(f"⚠️ Output directory does not exist: {self.output_dir}")
|
| 218 |
|
|
|
|
| 85 |
"exporter.fhir.include_observations": "true",
|
| 86 |
"exporter.fhir.include_procedures": "true",
|
| 87 |
"exporter.fhir.include_immunizations": "true",
|
| 88 |
+
"exporter.fhir.include_allergies": "true",
|
| 89 |
+
"exporter.fhir.include_organizations": "false",
|
| 90 |
+
"exporter.fhir.include_practitioners": "false"
|
| 91 |
}
|
| 92 |
|
| 93 |
async def download_synthea(self) -> bool:
|
|
|
|
| 159 |
for file in self.output_dir.glob("*.json"):
|
| 160 |
file.unlink()
|
| 161 |
|
| 162 |
+
# Run Synthea with command line arguments (more reliable)
|
| 163 |
cmd = [
|
| 164 |
"java", "-jar", str(self.synthea_jar_path),
|
| 165 |
+
"-p", str(population),
|
| 166 |
+
"-o", str(self.output_dir.absolute()),
|
| 167 |
+
"--seed", str(int(datetime.now().timestamp())),
|
| 168 |
+
"--exporter.fhir.transaction_bundle=true",
|
| 169 |
+
"--exporter.fhir.include_patient_summary=true",
|
| 170 |
+
"--exporter.fhir.include_encounters=true",
|
| 171 |
+
"--exporter.fhir.include_medications=true",
|
| 172 |
+
"--exporter.fhir.include_conditions=true",
|
| 173 |
+
"--exporter.fhir.include_observations=true",
|
| 174 |
+
"--exporter.fhir.include_organizations=false",
|
| 175 |
+
"--exporter.fhir.include_practitioners=false"
|
| 176 |
]
|
| 177 |
|
| 178 |
logger.info(f"Running command: {' '.join(cmd)}")
|
|
|
|
| 222 |
for subdir in subdirs:
|
| 223 |
json_files = list(subdir.glob("*.json"))
|
| 224 |
logger.info(f"📁 JSON files in {subdir.name}: {[f.name for f in json_files]}")
|
| 225 |
+
|
| 226 |
+
# Also check if files were created in the working directory
|
| 227 |
+
working_dir_files = list(Path.cwd().glob("*.json"))
|
| 228 |
+
logger.info(f"📁 JSON files in current working directory: {[f.name for f in working_dir_files]}")
|
| 229 |
+
|
| 230 |
+
# Check if files were created in the synthea directory
|
| 231 |
+
synthea_dir_files = list(self.synthea_dir.glob("*.json"))
|
| 232 |
+
logger.info(f"📁 JSON files in synthea directory: {[f.name for f in synthea_dir_files]}")
|
| 233 |
+
|
| 234 |
else:
|
| 235 |
logger.warning(f"⚠️ Output directory does not exist: {self.output_dir}")
|
| 236 |
|