This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
dm.message_id, status,connector_name , | |
to_char(received_date AT TIME ZONE 'US/Eastern', 'YYYY-MM-DD hh24:mi') || ' US/Eastern' as message_date, | |
(regexp_matches(mc.content, 'PID\|(?:.*?\|){2}(.*?)\|'))[1] as pid_3_mrns, | |
(regexp_matches(mc.content, 'PV1\|(?:.*?\|){18}(.*?)\|'))[1] as pv1_19_visit_id, | |
(regexp_matches(mc_error.content, '.*ERROR MESSAGE:\s+(.*?)', 'n'))[1] as error_message, | |
(regexp_matches(mc_error.content, '.*DETAILS:\s+(.*?)', 'n'))[1] as detail_message | |
from mirth.public.d_mm76 dm | |
inner join d_mc76 mc on mc.message_id = dm.message_id and mc.metadata_id = 0 and mc.content_type = 1 | |
inner join d_mc76 mc_error on mc_error.message_id = dm.message_id and mc_error.metadata_id = dm.id and mc_error.content_type = 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//can use this to get the message content and check state and send attempts | |
// we have channelId and messageId | |
// pass metadataIds as null -> the connector message returned will then have one or many connector messages. #0 is the source, and source has connectorMessage.getDestinationIdMap(); which we can iterate to turn our connector name into the numeric metadata id | |
var shouldAlert = true; | |
var metaDataIds = null; | |
var alertedChannelId = msg['channelId']; | |
var messageId = parseInt(msg['messageId']); | |
var messageController = Packages.com.mirth.connect.server.controllers.messageController.getInstance(); | |
var message = messageController.getMessageContent(alertedChannelId, messageId, metaDataIds); | |
var sourceMessage = message.getConnectorMessages().get(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with channel_xml as ( | |
select | |
name, | |
xmlparse(document channel) as channel_xml | |
from channel c | |
) | |
, destination_connector_xml as ( | |
SELECT | |
name as channel_name, | |
unnest(xpath('//destinationConnectors/connector/name/text()', channel_xml))::TEXT as connector_name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nextgenhealthcare/connect:4.3.0 as connect | |
#clone some boilerplate from MC image | |
ENV LANG en_US.UTF-8 | |
ENV LANGUAGE en_US:en | |
ENV LC_ALL en_US.UTF-8 | |
#TODO using a tarball and ADD also sets us up to get these artifacts from artifactory instead of from git | |
#TODO the parent entrypoint.sh does something with a custom-extensions directory, review it and see if it does this unpacking for us | |
#TODO I still think ADD is best here since it can fetch from remote URLs, it sets us up to use artifactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH attribute_rows AS (select e.name, | |
e.date_created, | |
xml_element.* | |
from "event" e, | |
xmltable('//linked-hash-map/entry' | |
passing (e."attributes"::xml) | |
columns "key" text PATH 'string[1]', | |
"value" text PATH 'string[2]' | |
) as xml_element | |
where e.name like '%Deploy%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with channel_xml as ( | |
select | |
name, | |
xmlparse(document channel) as channel_xml | |
from channel c | |
) | |
, destination_connector_xml as ( | |
SELECT | |
name as channel_name, | |
unnest(xpath('//destinationConnectors/connector/name/text()', channel_xml))::TEXT as connector_name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dump = {}; | |
var factory = new org.quartz.impl.StdSchedulerFactory(); | |
var allSchedulers = factory.getAllSchedulers(); | |
dump.schedulerCount = allSchedulers.size(); | |
dump.schedulers = []; | |
var iter = allSchedulers.iterator(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH channel_query AS ( | |
SELECT dc.local_channel_id, | |
c.name, | |
format('SELECT ' || | |
'%L::TEXT as channel_name, ' || | |
'date_trunc(''day'', received_date)::TEXT as day, ' || | |
'count(*)::BIGINT as cnt FROM d_m%s' || | |
' WHERE received_date >= now() - INTERVAL ''%s DAYS'' GROUP BY 1, 2', c.name, | |
dc.local_channel_id, 90) as query | |
FROM d_channels dc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--see https://github.com/nextgenhealthcare/connect/issues/4320 | |
-- this generates create index statements for the metadata columns in MC excluding the default columns | |
-- the user SHOULD NOT BLINDLY CREATE ALL INDEXES | |
-- MC is update/insert heavy and having indexes can slow that performance. | |
-- These indexes should be used only on metadata colums which are searched frequently, on large tables, and where constraining by other indexed columns is not practical | |
-- Further, if you're searching on large tables you should run the damn pruner. see https://gist.github.com/MichaelLeeHobbs/40b4b7cf70ecbe30b73eed763367e626 | |
SELECT t.table_name, c.column_name, format('CREATE INDEX CONCURRENTLY metadata_hax_%1$s_%2$s ON %1$s("%2$s");', t.table_name, c.column_name) as create_stmt | |
FROM information_schema.tables t | |
INNER JOIN information_schema.columns c ON c.table_name = t.table_name AND c.table_schema = c.table_schema | |
WHERE t.table_schema='public' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
I did a thing. | |
I wrote a channel that reads the current config map and then writes it to the Mirth DB so that you can switch from file backed config maps to DB backed config maps. | |
Just let the code run in a JS Reader and then flip the mirth.properties entry whenever you’re ready to change over. | |
*/ | |
// read mirth.properties and check the configurationmap.location property | |
var classpathResource = com.mirth.connect.server.tools.ClassPathResource.getResourceURI('mirth.properties'); | |
var propsInputStream; | |
var configmapLocation = 'Could not read!'; | |
try { |
NewerOlder