Giter Site home page Giter Site logo

googlecloudplatform / mllp Goto Github PK

View Code? Open in Web Editor NEW
64.0 28.0 29.0 131 KB

The MLLP (Short for "Minimal Lower Layer Protocol") adapter is a component that runs on GKE (https://cloud.google.com/kubernetes-engine/), receives HL7v2 messages via MLLP/TCP, and forwards messages received to Cloud HL7v2 API.

License: Apache License 2.0

Go 80.15% Starlark 19.85%

mllp's People

Contributors

joycezhou47 avatar lastomato avatar midjones avatar noerog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mllp's Issues

Logs not found in GCP Logging

Is there any way to save logs in GCP Log Explorer? I only can see logs via kubectl logs command for a current running pod. Are they not being saved in GCP logs?

`mllp.ReadMsg` may drop data

Currently, the ReadMsg function from the mllp package takes an io.Reader argument and wraps it into a bufio.Reader in order to read until the message end delimiter. When doing this, data beyond the end delimiter may have been read from the argument reader and be left in the created reader buffer, resulting in the remaining messages being dropped or truncated:

func TestReadTwoMessages(t *testing.T) {
	reader := strings.NewReader("\x0bFOO\x1c\x0d\x0bBAR\x1c\x0d")

	msg, err := mllp.ReadMsg(reader)
	if err != nil {
		t.Fatalf("Expected FOO, got %v", err)
	}

	if string(msg) != "FOO" {
		t.Fatalf("Expected FOO, got %s", string(msg))
	}

	msg, err = mllp.ReadMsg(reader)
	if err != nil {
		t.Fatalf("Expected BAR, got %v", err) // <- Expected BAR, got EOF
	}

	if string(msg) != "BAR" {
		t.Fatalf("Expected BAR, got %s", string(msg))
	}

	_, err = mllp.ReadMsg(reader)
	if err != io.EOF {
		t.Fatalf("Expected EOF, got %v", err)
	}
}

The previous test succeeds if we wrap the argument beforehand, because bufio.NewReader returns the passed reader if it is already a bufio.Reader with enough size (preventing mllp.ReadMsg from creating a new buffer):

reader := bufio.NewReader(strings.NewReader("\x0bFOO\x1c\x0d\x0bBAR\x1c\x0d"))

Apart from this simple example, I have also seen this happening in a more realistic situation when reading messages from net.Conns accepted from a TCP net.Listener.

Should mllp.ReadMsg take a bufio.Reader rather than creating one in order to prevent this issue? If that is not possible for some reason (I understand that it would be a breaking change), is this already documented somewhere to let the users of this package know how to safely use this function? (I failed to find it if that's the case!).

Security Question

More of a question for on premise setup. Does this send HL7 via HTTPS to the GCP cloud? Do we need to use a VPN if its already sending via HTTPS?
Thanks

Why PubSub subscription?

The MLLP adapter receives HL7v2 messages via MLLP/TCP, and forwards messages received to Cloud HL7v2 API

How is PubSub is related to any of this?

Unable to run mllp_adapter as container in GCP

I created a new VM and used the feature to pull in the latest docker image. The VM starts up fine but there are no log messages that indicate that the container is ready for HL7 messages. When I SSH into the container I cannot find /usr/mllp_adapter folder. Is the container image built ONLY to be used in GKE?

Authorization Error on Run

When testing locally the docker image for MLLP HL7 I get a could not find default credentials. I tried both windows and Linux with same results. I have tried the below resolution but still have same issue. Do we need to add authorization in the docker image ?

Important: If you're using Mac OS and the previous command fails with a Connection refused error, see Connection refused error when running locally. If the previous command fails with a healthapiclient.NewHL7V2Client: oauth2google.DefaultTokenSource: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information. error, see could not find default credentials error when running locally.

 1 mllp_adapter.go:58] failed to connect to HL7v2 API: oauth2google.DefaultTokenSource: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

Google MLLP adapter doen't back NACK on both invalid file format and invalid message

echo -n -e "\x0b$(cat file.txt )\x1c\x0d" | nc xxx.xxx.xxx.xxx 2575
No NACK but on kubernete logs

kubectl logs -f pod_name

o:182] Sending message of size 3042.
E1205 18:41:32.620325 1 mllpreceiver.go:118] handleMessage: Send: request failed: 400
{
"error": {
"code": 400,
"message": "unsupported encoding in message, only ASCII and UTF-8 are supported",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.cloud.healthcare.v1beta1.hl7v2.IngestMessageErrorDetail",
"hl7Nack": "TVNIfF5+XCZ8fHxFRUh8RUhTfDIwMTkxMjA1MTg0MTMyfHxBQ0t8MTZlMWU1NjUtMmJlOS00ODk1LWEyYTMtZWM0MzJjMGUwMmRkfFB8Mi4zDU1TQXxBRXwxMDI2Mjk1fHVuc3VwcG9ydGVkIGVuY29kaW5nIGluIG1lc3NhZ2UsIG9ubHkgQVNDSUkgYW5kIFVURi04IGFyZSBzdXBwb3J0ZWQ="
}
]
}
}
I1205 18:41:32.620344 1 mllpreceiver.go:119] Closed connection from 10.8.0.1:62723
I1205 18:41:34.709448 1 mllpreceiver.go:107] Accepted connection from 10.8.0.1:62784
I1205 18:41:35.697632 1 healthapiclient.go:182] Sending message of size 3042.
E1205 18:41:35.756086 1 mllpreceiver.go:118] handleMessage: Send: request failed: 400
{
"error": {
"code": 400,
"message": "unsupported encoding in message, only ASCII and UTF-8 are supported",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.cloud.healthcare.v1beta1.hl7v2.IngestMessageErrorDetail",
"hl7Nack": "TVNIfF5+XCZ8fHxFRUh8RUhTfDIwMTkxMjA1MTg0MTM1fHxBQ0t8Y2NkZmIxN2YtOGMyZC00Mjg0LTgyMmMtZDQ3N2I0YTk0NWVlfFB8Mi4zDU1TQXxBRXwxMDI2Mjk1fHVuc3VwcG9ydGVkIGVuY29kaW5nIGluIG1lc3NhZ2UsIG9ubHkgQVNDSUkgYW5kIFVURi04IGFyZSBzdXBwb3J0ZWQ="
}
]
}
}
I1205 18:41:35.756106 1 mllpreceiver.go:119] Closed connection from 10.8.0.1:62784

connection timed out

we are getting many connection timed out errors,
what can be the cause,

the device we uses say, its sending data.

Screen Shot 2020-08-20 at 2 07 57 PM
Screen Shot 2020-08-20 at 2 07 43 PM

any insights will be really helpful.

GKE --- Faild toFetch message ---critical

After rolling update of container image with latest tag, GKE mllp conteainer cant complete the process -- no cloud pubsub notification

W0227 02:40:29.220849 1 handler.go:76] Error fetching message projects/XXXX/locations/us-central1/datasets/XXX/hl7V2Stores/XXXX/messages/XXXX: failed to fetch message:
I0227 02:40:47.346644 1 healthapiclient.go:190] Sending message of size 2145.
I0227 02:40:47.465420 1 healthapiclient.go:223] Message was successfully sent.

Inbound and Outbound Configuration

Hey,

Is it possible for a single mllp adapter to be configured for both inbound and outbound flow?

I have been able to set up an instance of the mllp-adapter for client -> hl7v2 API traffic, and vice versa, but I haven't quite been able to both flows working on a single instance of the mllp-adapter.

Just want to confirm that it's possible before spending more time on it.

Thanks

MLLP Adapter crashing when running on GKE and export_stats is enabled

Hi,

I have spotted that whenever MLLP has export_stats enabled and is running on GKE, it is crashing with below error:

failed to configure monitoring: metadata: GCE metadata "instance/name" not defined

I have narrowed it to this line:

	cl.labels["instance"], err = metadata.InstanceName()
	if err != nil {
		return err
	}

The underlying library is querying this Metadata endpoint http://metadata.google.internal/computeMetadata/v1/instance/name

/ InstanceName returns the current VM's instance ID string.
func (c *Client) InstanceName() (string, error) {
	return c.getTrimmed("instance/name")
}

If I query the parent endpoint, I don't see name property there (the same applies to http://metadata/computeMetadata/v1/instance/):

root@mllp-adapter-7fdbd8d7c6-vlbcb:/# curl "http://metadata.google.internal/computeMetadata/v1/instance/" -H "Metadata-Flavor: Google"
attributes/
hostname
id
service-accounts/
zone

I would suggest using either metadata.InstanceID or metadata.Hostname (both are available on GKE).

HL7 ingest error message

Hi

How can we get the payload data for hl7 ingest error message. Sometimes the care system get NACK with AE and the error message. How to get that payload to check what is the problem. Below given a sample NACK received by the care system.

MSA|AE|Q2827650752T3305190973|unsupported encoding in message, only ASCII and UTF-8 are supported

Thanks & Regards
Dileep. O

It is always showing pubsub problem

E0512 07:20:24.084838 1 mllp_adapter.go:98] MLLP Adapter: failed to connect to PubSub channel: rpc error: code = PermissionDenied desc = Request had insufficient authentication scopes.

do I have any to solve ?

INVALID_ARGUMENT when testing mllp on GKE

We have been testing out the Google Healthcare API specifically with HL7 and as I've run through the tutorials I've hit a roadblock. I should mention that I have a fair bit of experience with Kubernetes and AWS, but not so much Google Cloud.

This step here is what is giving me trouble:

https://cloud.google.com/healthcare/docs/how-tos/mllp-adapter#creating_a_compute_engine_vm_and_sending_messages

When I attempt to send the message from the VM I do not see a response, and the logs in the pod show me the following error:

I0411 17:27:33.756432       1 healthapiclient.go:163] Dialing connection to https://healthcare.googleapis.com:443/v1beta1
I0411 17:27:58.809932       1 mllpreceiver.go:107] Accepted connection from 10.128.0.5:58698
I0411 17:27:58.810140       1 healthapiclient.go:182] Sending message of size 319.
E0411 17:27:58.880369       1 mllpreceiver.go:118] handleMessage: Send: request failed: 400
{
  "error": {
    "code": 400,
    "message": "location ID invalid, expected us-central1",
    "status": "INVALID_ARGUMENT"
  }
}
I0411 17:27:58.880691       1 mllpreceiver.go:119] Closed connection from 10.128.0.5:58698

This error is perplexing because the GKE cluster and the VM are in the same region/zone. Is this an issue with PubSub or the mllp adapter?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.