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

Update Doc for Filters #365

Merged
merged 9 commits into from
Apr 6, 2022
Merged

Conversation

sowu880
Copy link
Contributor

@sowu880 sowu880 commented Mar 22, 2022

Give more detailed descriptions and examples for our date and datetime related filters

sowu880 and others added 6 commits October 27, 2021 21:07
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update Filters-and-Tags.md

* Update README.md

* Update README.md

* Update README.md
@sowu880 sowu880 requested review from BoyaWu10 and qiwjin March 22, 2022 07:50
| add_hyphens_date | Adds hyphens to a date without hyphens | `{{ PID.7.Value \| add_hyphens_date }}` |
| format_as_date_time | Converts an YYYYMMDDHHmmssSSS string (e.g. 20040629175400000) to a dateTime format (e.g. 2004-06-29T17:54:00.000z). Provides parameters to handle time zone: `preserve`, `utc`, `local`. The default method is `local`. | `{{ PID.29.Value \| format_as_date_time: 'utc' }}` |
| add_hyphens_date | Adds hyphens to a date or partial date without hyphens. The input date format is YYYY, YYYYMM, or YYYYMMDD. The output format is valid FHIR date or partial date format: YYYY, YYYY-MM, or YYYY-MM-DD. | `{{ PID.7.Value \| add_hyphens_date }}` |
| format_as_date_time | Converts valid [HL7v2 and C-CDA datetime](https://hl7-definition.caristix.com/v2/HL7v2.8/DataTypes/DTM) (datetime or partial datetime without hyphens, e.g. 20040629175400000) to valid [FHIR datetime format](http://hl7.org/fhir/R4/datatypes.html) (e.g. 2004-06-29T17:54:00.000Z). Provides parameters to handle time zone: `preserve`, `utc`, `local`. The default method is `preserve`. | `{{ PID.29.Value \| format_as_date_time: 'utc' }}` |
Copy link
Contributor

Choose a reason for hiding this comment

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

It is mentioned in previous discussion that we may not able to quote references of this website directly. We can put the format here instead of adding a link.

```

> [Note] : If the input is a partial datetime without time zone, it will be set to the first day of the year and 00:00:00 clock time with local time zone as suffix. e.g. In the location with +08:00 time zone, the input string "201101031434" will be filled to "20110103143400+0800",
the template `{{ "201101031434"| format_as_date_time: 'utc'}}` will output 2011-01-03T06:34:00Z at +08:00 location.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: the template {{ "201101031434" | format_as_date_time: 'utc'}} will output 2011-01-03T06:34:00Z when running at +08:00 location.

ginalee-dotcom
ginalee-dotcom previously approved these changes Mar 29, 2022
@@ -55,10 +55,43 @@ If these filters do not meet your needs, you can also write your own filters.
### DateTime filters
| Filter | Description | Syntax |
|-|-|-|
| add_hyphens_date | Adds hyphens to a date without hyphens | `{{ PID.7.Value \| add_hyphens_date }}` |
| format_as_date_time | Converts an YYYYMMDDHHmmssSSS string (e.g. 20040629175400000) to a dateTime format (e.g. 2004-06-29T17:54:00.000z). Provides parameters to handle time zone: `preserve`, `utc`, `local`. The default method is `local`. | `{{ PID.29.Value \| format_as_date_time: 'utc' }}` |
| add_hyphens_date | Adds hyphens to a date or partial date without hyphens. The input date format is YYYY, YYYYMM, or YYYYMMDD. The output format is valid FHIR date or partial date format: YYYY, YYYY-MM, or YYYY-MM-DD. | `{{ PID.7.Value \| add_hyphens_date }}` |
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Adds hyphens to a date or a partial date that does not have hyphens to make it into a valid FHIR format. The input date format is YYYY, YYYYMM, or YYYYMMDD. The output format is a valid FHIR date or a partial date format: YYYY, YYYY-MM, or YYYY-MM-DD.

| add_hyphens_date | Adds hyphens to a date without hyphens | `{{ PID.7.Value \| add_hyphens_date }}` |
| format_as_date_time | Converts an YYYYMMDDHHmmssSSS string (e.g. 20040629175400000) to a dateTime format (e.g. 2004-06-29T17:54:00.000z). Provides parameters to handle time zone: `preserve`, `utc`, `local`. The default method is `local`. | `{{ PID.29.Value \| format_as_date_time: 'utc' }}` |
| add_hyphens_date | Adds hyphens to a date or partial date without hyphens. The input date format is YYYY, YYYYMM, or YYYYMMDD. The output format is valid FHIR date or partial date format: YYYY, YYYY-MM, or YYYY-MM-DD. | `{{ PID.7.Value \| add_hyphens_date }}` |
| format_as_date_time | Converts valid HL7v2 and C-CDA datetime (datetime or partial datetime without hyphens :YYYY[MM[DD[HH[MM[SS[.S[S[S[S]]]]]]]]][+/-ZZZZ] , e.g. 20040629175400000) to valid [FHIR datetime format](http://hl7.org/fhir/R4/datatypes.html) (e.g. 2004-06-29T17:54:00.000Z). Provides parameters to handle time zone: `preserve`, `utc`, `local`. The default method is `preserve`. | `{{ PID.29.Value \| format_as_date_time: 'utc' }}` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Converts valid HL7v2 and C-CDA datetime to a valid FHIR datetime format. The input datetime format is datetime or partial datetime without hyphens: YYYY[MM[DD[HH[MM[SS[.S[S[S[S]]]]]]]]][+/-ZZZZ]. For example, the input 20040629175400000 will have the output 2004-06-29T17:54:00.000Z. Provides parameters to handle different time zones: preserve, utc, local. The default method is preserve.

| add_hyphens_date | Adds hyphens to a date without hyphens | `{{ PID.7.Value \| add_hyphens_date }}` |
| format_as_date_time | Converts an YYYYMMDDHHmmssSSS string (e.g. 20040629175400000) to a dateTime format (e.g. 2004-06-29T17:54:00.000z). Provides parameters to handle time zone: `preserve`, `utc`, `local`. The default method is `local`. | `{{ PID.29.Value \| format_as_date_time: 'utc' }}` |
| add_hyphens_date | Adds hyphens to a date or partial date without hyphens. The input date format is YYYY, YYYYMM, or YYYYMMDD. The output format is valid FHIR date or partial date format: YYYY, YYYY-MM, or YYYY-MM-DD. | `{{ PID.7.Value \| add_hyphens_date }}` |
| format_as_date_time | Converts valid HL7v2 and C-CDA datetime (datetime or partial datetime without hyphens :YYYY[MM[DD[HH[MM[SS[.S[S[S[S]]]]]]]]][+/-ZZZZ] , e.g. 20040629175400000) to valid [FHIR datetime format](http://hl7.org/fhir/R4/datatypes.html) (e.g. 2004-06-29T17:54:00.000Z). Provides parameters to handle time zone: `preserve`, `utc`, `local`. The default method is `preserve`. | `{{ PID.29.Value \| format_as_date_time: 'utc' }}` |
| now | Provides current time in a specific format. The default format is "yyyy-MM-ddTHH:mm:ss.FFFZ". | `{{ '' \| now: 'dddd, dd MMMM yyyy HH:mm:ss' }}` |
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Provides the current time in a specific format. The default format is yyyy-MM-ddTHH:mm:ss.FFFZ.

| now | Provides current time in a specific format. The default format is "yyyy-MM-ddTHH:mm:ss.FFFZ". | `{{ '' \| now: 'dddd, dd MMMM yyyy HH:mm:ss' }}` |
| add_seconds | Adds double seconds on datetime in FHIR format. Provides parameters to set time zones: `preserve`, `utc`, `local`. The default is set to the parameter `preserve`. | `{{ "2021-01-01T00:00:00Z" \| add_seconds:100.1 }}` |
| add_seconds | Adds double seconds on valid [FHIR datetime](http://hl7.org/fhir/R4/datatypes.html) as input (e.g.2021-01-01T00:00:00Z ) and output a valid FHIR datetime. Provides parameters of double seconds to add and settings of time zones: `preserve`, `utc`, `local`. The default set of time zone parameter is `preserve`. | `{{ "2021-01-01T00:00:00Z" \| add_seconds:100.1, 'utc' }}` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Adds double seconds on a valid FHIR datetime (e.g. 2021-01-01T00:00:00Z). Provides parameters to handle different time zones: preserve, utc, local. The default method is preserve.

| add_seconds | Adds double seconds on datetime in FHIR format. Provides parameters to set time zones: `preserve`, `utc`, `local`. The default is set to the parameter `preserve`. | `{{ "2021-01-01T00:00:00Z" \| add_seconds:100.1 }}` |
| add_seconds | Adds double seconds on valid [FHIR datetime](http://hl7.org/fhir/R4/datatypes.html) as input (e.g.2021-01-01T00:00:00Z ) and output a valid FHIR datetime. Provides parameters of double seconds to add and settings of time zones: `preserve`, `utc`, `local`. The default set of time zone parameter is `preserve`. | `{{ "2021-01-01T00:00:00Z" \| add_seconds:100.1, 'utc' }}` |

Examples:
Copy link
Contributor

Choose a reason for hiding this comment

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

DateTime filter usage examples:

@sowu880 sowu880 changed the base branch from main to dotliquid March 30, 2022 10:57
@yankunhuang-pku
Copy link
Contributor

yankunhuang-pku commented Apr 6, 2022

@ginalee-dotcom @sowu880 Are we ready to merge this PR?

@sowu880 sowu880 merged commit 2a490b2 into dotliquid Apr 6, 2022
@sowu880 sowu880 deleted the personal/sowu/update-filters-doc branch April 6, 2022 06:54
jakiefermsft added a commit to jasonheld-msft/FHIR-Converter that referenced this pull request Apr 26, 2022
…fer/pgcritiques-merge

* 'main' of github.com:microsoft/FHIR-Converter:
  Global Readiness Manifest file GeoPol.xml
  Update version (microsoft#375)
  Remove blank lines (microsoft#374)
  Update Doc for Filters  (microsoft#365)
  Switch FormatAsDateTime timezone handling to preserve to maintain consistency (microsoft#358)
  Revert "reset to local (microsoft#368)"
  reset to local (microsoft#368)
  Phase -2, Milestone-3 Mapping (microsoft#366)
  Change Default Time Zone Handling (microsoft#363)
  Turn on mac functional test check (microsoft#367)
  Fix warnings (microsoft#364)
  Fix Time Zone Bug (microsoft#353)
  Phase2 - Milestone 1&2 Mapping (microsoft#354)
  Add check for large for loops (microsoft#361)
  Updated the logic of checking the number of default templates
  Update pipeline win host version (microsoft#359)
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.

5 participants