Skip to content

Commit

Permalink
more javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
dehall committed Aug 1, 2023
1 parent d9eae1a commit e3f376e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/org/mitre/synthea/export/flexporter/Actions.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,12 @@ private static void keepResources(Bundle bundle, List<String> list) {
}
}

/**
* Shift all dates on all resources in the Bundle. Note this only modifies date/time-type fields
* on resources and cannot modify dates embedded within strings (for example, clinical notes).
* @param bundle FHIR Bundle to shift dates for
* @param amountString Amount to shift in ISO-8601 format, either Period or Duration
*/
private static void shiftDates(Bundle bundle, String amountString) {
if (amountString == null) {
return;

Check warning on line 462 in src/main/java/org/mitre/synthea/export/flexporter/Actions.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/flexporter/Actions.java#L462

Added line #L462 was not covered by tests
Expand Down Expand Up @@ -484,6 +490,14 @@ private static void shiftDates(Bundle bundle, String amountString) {
}
}

/**
* Filter the Bundle by date. If any resource has a date outside the provided range
* it will be filtered out.
* TODO: align this with export.years_of_history filter. "active" items outside range?
* @param bundle The Bundle to filter
* @param minDateStr Earliest/start value of the time range, in ISO-8601 format
* @param maxDateStr Latest/stop/end value of the time range, in ISO-8601 format
*/
private static void dateFilter(Bundle bundle, String minDateStr, String maxDateStr) {
if (minDateStr == null && maxDateStr == null) {
return;

Check warning on line 503 in src/main/java/org/mitre/synthea/export/flexporter/Actions.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/flexporter/Actions.java#L503

Added line #L503 was not covered by tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ public ReferenceFieldWrapper(Class<? extends Resource> clazz, String fieldName)
super(clazz, fieldName);
}

/**
* Get a single reference from the field this FieldWrapper represents on the given resource,
* as a string.
* @param resource Resource to get the value from
* @return Reference as string, ex. "Patient/123" or "urn:uuid:98d1c..."
*/
public String getReference(Resource resource) {
IBase referenceObject = getSingle(resource);

Check warning on line 389 in src/main/java/org/mitre/synthea/export/flexporter/FieldWrapper.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/flexporter/FieldWrapper.java#L389

Added line #L389 was not covered by tests
if (!(referenceObject instanceof Reference)) {
Expand All @@ -388,6 +394,12 @@ public String getReference(Resource resource) {
return ref.getReference();

Check warning on line 394 in src/main/java/org/mitre/synthea/export/flexporter/FieldWrapper.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/flexporter/FieldWrapper.java#L393-L394

Added lines #L393 - L394 were not covered by tests
}

/**
* Get all references from the field this FieldWrapper represents on the given resource,
* as a list of strings.
* @param resource Resource to get the value from
* @return References as strings, ex. "Patient/123" or "urn:uuid:98d1c..."
*/
public List<String> getReferences(Resource resource) {
List<IBase> referenceObjects = getAll(resource);

Expand Down

0 comments on commit e3f376e

Please sign in to comment.