How does one insert a past date that a incident happened

What is the easiest, fastest way to insert a date with Day - Month - Year (not the current date).

Let's say a patient had a procedure on a specific date and this had to documented and then a follow-up had to be calculated for exactly 6 weeks later or 3 months or 5 years later. Or the patient's age had to be calculated given his date of birth and date in the future or he past (not the present). Is this possible?

George

So this isn't possible currently, but it's something that makes sense. Let's think through the syntax a bit here.

The best approach would probably be to add another attribute to the {time} command that lets you specify the base date. Maybe that attribute could be called at.

So if you wanted to get the date at Jan 1, 2000, you would use something like:

{time: MM Do, YYYY; at=2000-01-01}

Shifts would apply relative to that date, so if you wanted to get the date 10 days after Jan 1, 2000 you would use:

{time: MM Do, YYYY; at=2000-01-01; shift=10D}

The one problematic point here is how to define the format for date/time passed to the at? Text Blaze needs to know how to interpret the date (and time) you specify here. Of course this can change between different locales. E.g. American dates transpose the day/month compared to European dates.

So let's also add a pattern attribute that tells Text Blaze how to interpret the at date. For example the following tells Text Blaze that thee date is a long year followed by a two digit month and day:

{time: MM Do, YYYY; at=2000-01-01; pattern=YYYY-MM-DD}

Now that should work well, but needing to specify pattern all the time is a pain and rather verbose. Let's make pattern optional and when it is missing default to a "best effort" parsing of the data.

If pattern is ommited Text Blaze will try to use ISO 8601 https://en.wikipedia.org/wiki/ISO_8601 falling back to locale specific date parsing if that fails. So something like this would work in an english locale:

{time: MM Do, YYYY; at=Jan 1, 2000}

What do you think about that?

Tried it but the attribute "at" was not recognised.

Not sure how to apply the snippet.

Can you format it in the Metric system ie DD-MM-YYYY

What you want to do isn't currently possible. The above post in proposing one way it could be implemented and added to Text Blaze.

I've posted this proposal to get your feedback on the proposed approach. So what do you think?

Yes, you would be able to set the pattern to 'DD-MM-YYYY'.

Unfortunately Scott I am a mere medico and your advanced IT logic is way above my pay grade.

What you are proposing is a pre-formatted input fields? so that the first 2 digits correspond the the day and are between 00-31 the next 2 digits are the months fields and are between 00-12 and the next 4 digit the YYYY input between 2000-

Is that correct? and from this input further calculations can be derived such as age etc

This isn't an input field. It's an extension of the {time} command so rather than always defaulting to the current date (and applying and shifts from there) you can have the {time} command default to a date you specify (and then apply any shifts from there).

You could combine it with an {formtext} command if you wanted to allow the user to type in a date, but that would be optional. How you would do that is something like the following:

Type in a date: {formtext: name=date}
Ten days after your date is: {time: MM Do, YYYY; at={=date}; shift=10D}

(again this won't work now because at is just an idea)

A bit more about the pattern:

When you use the {time} command currently, you specify the output format using things like 'YYYY' for a four-digit year, or 'MM' for a two digit month.

The pattern that is proposed here tells Text Blaze how to read in the date you specified in at and it does that using the exact same formatting strings you used to format the {time} output. So 'DD-MM-YYYY' means the first two digits of at should be the day, followed by a hyphen followed by a two digit month, followed by a hyphen, followed by a four digit year.

Anyways, I think something like this would address your needs.

Look forward to it soon (I hope)

Thanks
George

Hi @George_Marinos,

Here's a little snippet I cooked up just for you. It should serve your purposes perfectly. If you want it to spit out a different format, let me know and I can sort it out for you.

{note}
Day: {formtext: name=day; default={time: DD}}
Month: {formtext: name=month; default={time: MM}}
Year: {formtext: name=year; default={time: YYYY}}
{format="dddd, MMMM Do, YYYY"}{endnote}

{time: {=format}; shift=<Y<M<D-{={time: YYYY}}Y{=year if year <> "" else {time: YYYY}}Y{=month-1 if month <> "" else {time: MM; shift=-1M}}M{=day-1 if day <> "" else {time: DD; shift=-1D}}D}

Or if you wanna change the date formatting yourself, you can do so in the part where it says {format=etc}

Thanks Cedric,

Any thoughts as to how to add a calculation to this date.

Lets say this is named operation_date and a recall is scheduled for say 12 weeks or 6 months or 3 years, any ideas?

Again many thanks.

George

Hi,

Yes, there is a way. I've built a snippet but I'm hitting a snag. I'm running it by @scott so he can troubleshoot it for me. Once he's done, I'll post it here.

Ok, so here's the updated snippet:

{note}
Patient appointment:

Day: {formtext: name=setDay; default={time: DD}} << Sets the custom day
Month: {formtext: name=setMonth; default={time: MM}} << Sets the custom month
Year: {formtext: name=setYear; default={time: YYYY}} << Sets the custom year

{format="dddd, MMMM Do, YYYY"}
Recall in: {formtext: name=recallYears; width=2; default=0} years, {formtext: name=recallMonths; width=2; default=0} months, {formtext: name=recallDays; width=2; default=0} days << This is to set the recall day for the patient.

{setTime={=concat("<Y<M<D-",{={time: YYYY}},"Y",{=setYear if setYear <> "" else {time: YYYY}},"Y",{=setMonth-1 if setMonth <> "" else {time: MM; shift=-1M}},"M",{=setDay-1 if setDay <> "" else {time: DD; shift=-1D}},"D")}}

{recallShift={=concat(((recallYears&"Y") if recallYears > 0 else ""),((recallMonths&"M") if recallMonths > 0 else ""),((recallDays&"D") if recallDays > 0 else ""))}}
{endnote}

Patient appointment: {time: {=format}; shift={=setTime}}
Patient to be recalled on: {time: {=format}; shift={=concat(setTime,recallShift)}}

Scott helped me iron out the last kink. Should work perfectly now :slight_smile:

Thanks for all the hard work Cedric & Scott.

This is very helpful

Thanks
George

Hi Scott & Cedric

The Recall snippet is almost working perfectly!

There is one small gliche.

Recalls are usually set in years / months / weeks (nots days).

Is it possible to exchange the day parameter for week (only in the recall function)?

Thanks
GeorgeM

Sorted
Thx

Just an update on this. The new at and pattern support in the {time} command make things like this much easier to do.

You can learn more about this here:

@George_Marinos - The time feature just got a MAJOR upgrade where you can now set the specific time much more easily.

See here: February Development Update