Skip to content

Commit

Permalink
Merge branch 'master' into wearables-rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
awatson1978 committed Dec 1, 2023
2 parents 9aa01e4 + e8a047a commit 412d17b
Show file tree
Hide file tree
Showing 60 changed files with 34,934 additions and 520 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: Create Artifacts
run: |
./generate_samples.sh
# delete uncompressed output, sample zips are in ./samples/
rm -rf output/
./gradlew uberJar javadoc graphviz
mkdir -p output/build/javadoc
mv build/docs/javadoc/* output/build/javadoc
Expand Down Expand Up @@ -85,6 +88,17 @@ jobs:
commit_message: rebuild graphs, javadoc and binary distribution at
# note the commit SHA is appended automatically

- name: Push samples to sample repo
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.PUSH_SAMPLE_DATA_SSH_KEY }}
with:
source-directory: 'samples'
destination-github-username: 'synthetichealth'
destination-repository-name: 'synthea-sample-data'
target-directory: 'downloads/latest'
target-branch: main

- name: Slack Notification on Failure
uses: 8398a7/action-slack@v3
if: failure()
Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

Synthea<sup>TM</sup> is a Synthetic Patient Population Simulator. The goal is to output synthetic, realistic (but not real), patient data and associated health records in a variety of formats.

Read our [wiki](https://github.com/synthetichealth/synthea/wiki) for more information.

:wave::information_source:
**May-June 2023 - We're interested in hearing how you use Synthea and what features are most useful to you! Please consider helping direct future effort by filling out our brief user survey: https://share.hsforms.com/1PDnYPuS6Ql6TVkUOohNqOw4m7ji**
Read our [wiki](https://github.com/synthetichealth/synthea/wiki) and [Frequently Asked Questions](https://github.com/synthetichealth/synthea/wiki/Frequently-Asked-Questions) for more information.

Currently, Synthea<sup>TM</sup> features include:
- Birth to Death Lifecycle
Expand All @@ -30,7 +27,7 @@ These instructions are intended for those wishing to examine the Synthea source
### Installation

**System Requirements:**
Synthea<sup>TM</sup> requires Java 11 or newer.
Synthea<sup>TM</sup> requires Java JDK 11 or newer. We strongly recommend using a Long-Term Support (LTS) release of Java, 11 or 17, as issues may occur with more recent non-LTS versions.

To clone the Synthea<sup>TM</sup> repo, then build and run the test suite:
```
Expand All @@ -45,7 +42,7 @@ cd synthea
The default properties file values can be found at `src/main/resources/synthea.properties`.
By default, synthea does not generate CCDA, CPCDA, CSV, or Bulk FHIR (ndjson). You'll need to
adjust this file to activate these features. See the [wiki](https://github.com/synthetichealth/synthea/wiki)
for more details.
for more details, or use our [guided customizer tool](https://synthetichealth.github.io/spt/#/customizer).



Expand Down Expand Up @@ -114,7 +111,7 @@ Generate a list of concepts (used in the records) or attributes (variables on ea

# License

Copyright 2017-2022 The MITRE Corporation
Copyright 2017-2023 The MITRE Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
38 changes: 29 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ dependencies {
implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2:6.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-r4:6.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-client:6.1.0'

implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation:6.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:6.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-dstu3:6.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-dstu2:6.1.0'
// C-CDA export uses Apache FreeMarker templates
implementation 'org.freemarker:freemarker:2.3.31'

Expand All @@ -66,11 +71,14 @@ dependencies {
implementation 'guru.nidi:graphviz-java:0.18.1'
// JavaScript engine included for graphviz. It gets used
// if someone does not have graphviz installed in their environment
implementation 'org.graalvm.js:js:22.2.0'
implementation 'org.graalvm.js:js:22.3.3'
implementation 'org.graalvm.js:js-scriptengine:22.3.3'
implementation 'org.graalvm.sdk:graal-sdk:22.3.3'

// CSV Stuff
implementation 'org.apache.commons:commons-csv:1.9.0'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.13.4'
implementation 'org.yaml:snakeyaml:1.32'
implementation 'org.yaml:snakeyaml:1.33'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'org.apache.commons:commons-text:1.9'
implementation 'commons-validator:commons-validator:1.7'
Expand Down Expand Up @@ -113,6 +121,8 @@ dependencies {
// JfreeChart for drawing physiology charts
implementation 'org.jfree:jfreechart:1.5.3'

implementation fileTree(dir: 'lib/custom', include: '*.jar')

// Use JUnit test framework
testImplementation('junit:junit') {
version {
Expand All @@ -123,10 +133,6 @@ dependencies {
testImplementation 'org.powermock:powermock-module-junit4:2.0.9'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.9'
testImplementation 'com.github.tomakehurst:wiremock-jre8:2.33.2'
testImplementation 'ca.uhn.hapi.fhir:hapi-fhir-validation:6.1.0'
testImplementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:6.1.0'
testImplementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-dstu3:6.1.0'
testImplementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-dstu2:6.1.0'
testImplementation 'com.helger:ph-schematron:5.6.5'
testImplementation 'com.helger:ph-commons:9.5.5'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0'
Expand Down Expand Up @@ -178,6 +184,7 @@ task graphviz(type: JavaExec) {
mainClass = "Graphviz"
}


task rifMinimize(type: JavaExec) {
group 'Application'
description 'Filter exported RIF files to produce minimal set that covers all claim types'
Expand Down Expand Up @@ -229,6 +236,19 @@ shadowJar {
task uberJar() {
}

task flexporter(type: JavaExec) {
group 'Application'
description 'Apply transformations to FHIR'
classpath sourceSets.main.runtimeClasspath
mainClass = "RunFlexporter"
// args are called "arams" because they are called with -P,
// ex. gradle run -Params="['arg1', 'args2']"
// see https://stackoverflow.com/questions/27604283/gradle-task-pass-arguments-to-java-application
if (project.hasProperty("arams")) {
args Eval.me(arams)
}
}

task concepts(type: JavaExec) {
group 'Application'
description 'Create a list of simulated concepts'
Expand Down Expand Up @@ -325,12 +345,12 @@ run {
}

task sourceJar(type: Jar) {
classifier "sources"
archiveClassifier = "sources"
from sourceSets.main.allJava
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
archiveClassifier = "javadoc"
from javadoc.destinationDir
}

Expand All @@ -341,7 +361,7 @@ artifacts {
}

def mavenGroup = 'org.mitre.synthea'
def mavenVersion = '3.2.1-SNAPSHOT'
def mavenVersion = '3.2.2-SNAPSHOT'

publishing {
publications {
Expand Down
161 changes: 161 additions & 0 deletions config/aws/CloudFormation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
AWSTemplateFormatVersion: 2010-09-09

Description: Sets up an Synthea on Amazon EC2 Instance

Parameters:
InstanceType:
Type: String
Description: Instance type for Synth. Default is t2.micro.
AllowedValues:
- t3.small
- t3.medium
- t3.large
- t3.xlarge
- t3.2xlarge
- m4.large
- m4.xlarge
- m4.2xlarge
- m4.4xlarge
- m4.10xlarge
- m4.16xlarge
- c4.large
- c4.xlarge
- c4.2xlarge
- c4.4xlarge
- c4.8xlarge
- r4.large
- r4.xlarge
- r4.2xlarge
- r4.4xlarge
- r4.8xlarge
- r4.16xlarge
- g2.2xlarge
- g2.8xlarge
- p2.xlarge
- p2.8xlarge
- p2.16xlarge
- g3.4xlarge
- g3.8xlarge
- g3.16xlarge
ConstraintDescription: Valid instance type in the t23 m4, c4, r4, g2, p2, and g3 families
Default: t3.large
LatestAmiId:
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
Default: '/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64'
VpcId:
Type: AWS::EC2::VPC::Id
Description: VPC this server will reside in
MyIp:
Type: String
Description: Provide your Public IP (you can find your ip address by visiting - https://whatismyipaddress.com/)
Default: 0.0.0.0/0
KeyPair:
Type: "AWS::EC2::KeyPair::KeyName"
Description: Amazon EC2 Key Pair
SubnetId:
Type: "AWS::EC2::Subnet::Id"
Description: Subnet ID your instance will launch in.

Resources:
SyntheOutPutS3Bucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: !Join
- '-'
- - synthea-output
- !Ref 'AWS::AccountId'
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true

SyntheaInstanceProfile:
Type: AWS::IAM::InstanceProfile
Properties:
Path: /
Roles:
- !Ref SyntheaRole

SyntheaRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- "ec2.amazonaws.com"
Action:
- "sts:AssumeRole"
Policies:
- PolicyName: "S3InlinePolicy"
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action: ["s3:ListBucket","s3:GetObject","s3:PutObject","s3:DeleteObject"]
Resource:
- "arn:aws:s3:::synthea-output*"
ManagedPolicyArns:
- "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"


SyntheaEC2SecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Synthea Security Group
VpcId: !Ref VpcId

SecurityGroupIngressMySSH:
Type: AWS::EC2::SecurityGroupIngress
Properties:
Description: "Allow SSH connections from MyIp"
GroupId: !Ref SyntheaEC2SecurityGroup
CidrIp: !Sub "${MyIp}"
IpProtocol: tcp
FromPort: 22
ToPort: 22

SyntheaNetworkInterface:
Type: AWS::EC2::NetworkInterface
Properties:
SubnetId: !Ref SubnetId
Description: Interface for the Connection
GroupSet:
- !Ref SyntheaEC2SecurityGroup
SourceDestCheck: true

SyntheaEC2Instance:
Type: AWS::EC2::Instance
Metadata:
'AWS::CloudFormation::Init':
config:
files:
/tmp/test.txt:
content: Hello world!
mode: '000755'
owner: root
group: root
Properties:
ImageId: !Ref LatestAmiId
InstanceType: !Ref InstanceType
KeyName: !Ref KeyPair
IamInstanceProfile: !Ref SyntheaInstanceProfile
NetworkInterfaces:
- NetworkInterfaceId: !Ref SyntheaNetworkInterface
DeviceIndex: 0
Tags:
- Key: Name
Value: Synthea
UserData:
Fn::Base64: |
#!/bin/bash
cd /home/ec2-user/
sudo yum -y install java-17-amazon-corretto-headless
wget https://github.com/synthetichealth/synthea/releases/download/master-branch-latest/synthea-with-dependencies.jar

Outputs:
PublicIp:
Value: !GetAtt SyntheaEC2Instance.PublicIp
17 changes: 17 additions & 0 deletions generate_samples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# This script generates 100 sample patients in the most common output formats
# and zips them up by type in the ./samples/ subdirectory

./run_synthea -p 100 \
--exporter.ccda.export=true \
--exporter.fhir.export=true \
--exporter.fhir_stu3.export=true \
--exporter.fhir_dstu2.export=true \
--exporter.csv.export=true \

mkdir samples

for type in ccda fhir fhir_stu3 fhir_dstu2 csv
do
zip -jr samples/synthea_sample_data_${type}_latest.zip output/${type}/
done
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Empty file added lib/custom/.keep
Empty file.
18 changes: 18 additions & 0 deletions run_flexporter
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env sh

##############################################################################
##
## Flexporter launcher for UN*X
##
##############################################################################

ARGS=

for arg in "$@"
do
ARGS=$ARGS\'$arg\',
# Trailing comma ok, don't need to remove it
done

./gradlew flexporter -Params="[$ARGS]"

Loading

0 comments on commit 412d17b

Please sign in to comment.