Optionally output Fileman date fields in FHIR/ISO 8601 format as extra columns after each date field. The code takes care of the infamous Fileman .24 dates, described here: https://hardhats.org/fileman/date_problem.html.
Some refactoring was done to remove unused code, and replace parameters
that were not used with an .OPTIONS
array.
OPTIONS can have subscripts Debug
(does nothing right now) and
ExternalDates
(which emits external dates fields in addition to
existing date fields).
To create a DDL with Externally-formatted Dates, run this:
S DUZ=.5,DIQUIET=1,DUZ(0)="@",O("ExternalDates")=1 D DT^DICRW,MAPALL^%YDBOCTOVISTAM("vista_ext_dates.sql",.O)
Entrypoint $$FHIRDATE^%YDBOCTOVISTAM
created to convert Fileman dates
to FHIR dates. Sample conversions:
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712.182851)
2022-07-12T18:28:51-05:00
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712.1828)
2022-07-12T18:28:00-05:00
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712.182800)
2022-07-12T18:28:00-05:00
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712.18)
2022-07-12T18:00:00-05:00
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712.180000)
2022-07-12T18:00:00-05:00
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712.1800)
2022-07-12T18:00:00-05:00
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712.18)
2022-07-12T18:00:00-05:00
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712.1)
2022-07-12T10:00:00-05:00
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712)
2022-07-12
>W $$FHIRDATE^%YDBOCTOVISTAM(3220700)
2022-07
>W $$FHIRDATE^%YDBOCTOVISTAM(3220000)
2022
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712.00)
2022-07-12
>W $$FHIRDATE^%YDBOCTOVISTAM(3220712.24)
2022-07-13T00:00:00-05:00
The emitted DDL looks like this (see VISIT_ADMIT_DATE_TIME_E
and
DATE_VISIT_CREATED_E
):
DROP TABLE IF EXISTS `VISIT`;
CREATE TABLE `VISIT`(
`VISIT_ID` NUMERIC PRIMARY KEY START 0 ENDPOINT '$CHAR(0)',
`VISIT_ADMIT_DATE_TIME` NUMERIC NOT NULL GLOBAL "^AUPNVSIT(keys(""VISIT_ID""),0)" PIECE 1,
`VISIT_ADMIT_DATE_TIME_E` CHARACTER(25) EXTRACT "$$FHIRDATE^%YDBOCTOVISTAM($P($G(^AUPNVSIT(keys(""VISIT_ID""),0)),""^"",1))",
`DATE_VISIT_CREATED` NUMERIC GLOBAL "^AUPNVSIT(keys(""VISIT_ID""),0)" PIECE 2,
`DATE_VISIT_CREATED_E` CHARACTER(25) EXTRACT "$$FHIRDATE^%YDBOCTOVISTAM($P($G(^AUPNVSIT(keys(""VISIT_ID""),0)),""^"",2))",
Other clean-up:
- Remove unused Verify option. Talking with the original developer, it was originally used with PIP, and calls a routine not in this repo. Since we haven't used it in a couple of years nor did we need to use it, I would really just like to drop code that we won't use.
- New DDL variable. Without this, repeated invocations can double the output as the DDL variable contains the output.
- [#9 (closed)] Fix MAPONE Entrypoint. It now works without crashing. It's interactive unfortunately, but that's in the DMSQ code. I tried to lessen the pain by setting the default value using DIR("B") for the ^DIR call in the DMSQ code.
Edited by Sam Habiel