Skip to content

Commit

Permalink
Recreate version 7.1.x to include updated roadmap
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrichton committed Mar 31, 2023
1 parent 584489c commit 1f2ae7a
Show file tree
Hide file tree
Showing 123 changed files with 11,753 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# generated files
.docusaurus
.cache-loader
versioned*

# misc
.DS_Store
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React, { Component } from 'react'
import axios from 'axios'
import Highlight, { defaultProps } from "prism-react-renderer";
import theme from "prism-react-renderer/themes/nightOwl";

class ExternalContentSyntaxHighlighter extends Component {
constructor(props) {
super(props)

this.state = {
data: null,
spinner: true,
url: props.url.replace('<VERSION>', props.version)
}
}

componentWillMount() {
axios
.get(this.state.url)
.then(response => {
if (response.data) {
this.setState({
data: response.data,
spinner: false
})
} else{
this.setState({
data: null,
spinner: false
})
}
})
.catch(err => {
console.error(err.toString())
this.setState({
data: null,
spinner: false
})
})
}

render() {
if (this.state.spinner) {
return (
<div className="spinnerContainer">
<div id="loading" />
</div>
)
} else {
if (this.state.data) {
return (
<Highlight {...defaultProps} theme={theme} code={this.state.data} language={`${this.props.language}`}>
{({ className, style, tokens, getLineProps, getTokenProps }) => (
<pre className={className} style={style}>
{tokens.map((line, i) => (
<div {...getLineProps({ line, key: i })}>
{line.map((token, key) => (
<span {...getTokenProps({ token, key })} />
))}
</div>
))}
</pre>
)}
</Highlight>
)
} else {
return (
<div>{`Schema model not found for version ${this.props.version}`}</div>
)
}
}
}
}

export default ExternalContentSyntaxHighlighter
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, { Component } from 'react'

let _window;
if (typeof window !== "undefined") {
_window = window
} else if (typeof global !== "undefined") {
_window = global
} else if (typeof self !== "undefined"){
_window = self
} else {
_window = {
location: {}
}
}

class GetCurrentVersion extends Component {
constructor(props) {
super(props)

const regex = /[\d].[\d].x/ // search for value between "/docs/" and the following "/" to get the version
let extractedVersion = null
if (_window && _window.location) {
extractedVersion = _window.location.href.match(regex)
}

let actualVersion = 'master'
if (extractedVersion) {
actualVersion = `v${extractedVersion[0].replace('x', '0')}`
}

this.state = {
version: actualVersion
}
}

render() {
return (
<div>
{React.cloneElement(this.props.children, { version: this.state.version })}
</div>
)
}
}

export default GetCurrentVersion
Empty file.
189 changes: 189 additions & 0 deletions versioned_docs/version-7.1.x/api/audits/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
---
id: create
title: Create Audit
sidebar_label: Create
keywords:
- OpenHIM
- API
- Audit
- Create
description: Create an OpenHIM Audit via the API
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## Create audit

To create a new audit record you will need to make a TLS request to the OpenHIM API for the below method and endpoint and supply the JSON object for the audit record.

```curl
Method: POST
Endpoint: {openhim_url}:8080/audits
Payload: JSON object of the audit record
```

## Example

<Tabs
defaultValue="lang"
values={[
{ label: 'Languages', value: 'lang' },
{ label: 'Sample Data', value: 'sample' }
]}
>
<TabItem value="lang">
Before we can send our request to the OpenHIM API we need to ensure that we construct our valid HTTP headers to successfully authenticate with the OpenHIM API.

<Tabs
defaultValue="nodejs"
values={[
{ label: 'NodeJS', value: 'nodejs' },
{ label: 'Bash', value: 'bash' }
]
}>
<TabItem value="nodejs">

Copy the below code at the bottom of your nodejs script that handles the authentication of the OpenHIM headers as described in the [authentication section](../introduction/authentication).

Replace the `openhimOptions` values with the correct implementation details and supply the `SampleData` payload to submit

```javascript
// append below code to the "openhim-api.js" script containing the authentication methods.
// This is described within the authentication section

(async () => {
const openhimOptions = {
apiURL: 'https://localhost:8080',
apiEndpoint: '/audits',
username: '[email protected]',
password: 'openhim-password',
rejectUnauthorized: false
}
const SampleData = 'SampleData'

const headers = await genAuthHeaders(openhimOptions)

const options = {
method: 'POST',
url: `${openhimOptions.apiURL}${openhimOptions.apiEndpoint}`,
rejectUnauthorized: openhimOptions.rejectUnauthorized,
headers: headers,
body: SampleData,
json: true
}

request(options, (error, response, body) => {
if (error) throw new Error(error)

console.log({
statusCode: response.statusCode,
body
})
})
})()
```

Execute the below command in your terminal to run the nodejs script

```bash
node openhim-api.js
```

</TabItem>
<TabItem value="bash">

Ensure that you have created your bash script to construct the HTTP authentication headers and send the request to the OpenHIM API as described in the [authentication section](../introduction/authentication).

Execute the below command in your terminal where the file is located with the required arguments. Replace the placeholder arguments with the correct implementation details and ensure your `SampleData.json` file exists with the audit object.

```curl
./openhim-api.sh [email protected] openhim-password -v https://localhost:8080/audits -d @SampleData.json -H "Content-Type:application/json"
```

</TabItem>
</Tabs>

The response status code will be `201` if successful.

</TabItem>
<TabItem value="sample">

```js
{
"rawMessage": "This will be the raw ATNA message that gets received to be used as a backup reference",
"eventIdentification": {
"eventDateTime": "2019-12-12T15:38:25.282+02:00",
"eventOutcomeIndicator": "0",
"eventActionCode": "R",
"eventID": {
"code": "222",
"displayName": "Read",
"codeSystemName": "DCM"
},
"eventTypeCode": {
"code": "ITI-9",
"displayName": "PIX Read",
"codeSystemName": "IHE Transactions"
}
},
"activeParticipant": [
{
"userID": "pix|pix",
"alternativeUserID": "2100",
"userIsRequestor": "false",
"networkAccessPointID": "localhost",
"networkAccessPointTypeCode": "1",
"roleIDCode": {
"code": "110152",
"displayName": "Destination",
"codeSystemName": "DCM"
}
}, {
"userID": "pix|pix",
"alternativeUserID": "2100",
"userIsRequestor": "false",
"networkAccessPointID": "localhost",
"networkAccessPointTypeCode": "1",
"roleIDCode": {
"code": "110152",
"displayName": "Destination",
"codeSystemName": "DCM"
}
}
],
"auditSourceIdentification": {
"auditSourceID": "openhim"
},
"participantObjectIdentification": [
{
"participantObjectID": "975cac30-68e5-11e4-bf2a-04012ce65b02^^^ECID&amp;ECID&amp;ISO",
"participantObjectTypeCode": "1",
"participantObjectTypeCodeRole": "1",
"participantObjectIDTypeCode": {
"code": "2",
"displayName": "PatientNumber",
"codeSystemName": "RFC-3881"
}
}, {
"participantObjectID": "dca6c09e-cc92-4bc5-8741-47bd938fa405",
"participantObjectTypeCode": "2",
"participantObjectTypeCodeRole": "24",
"participantObjectIDTypeCode": {
"code": "ITI-9",
"displayName": "PIX Query",
"codeSystemName": "IHE Transactions"
},
"participantObjectQuery": "TVNIfF5+XCZ8b3BlbmhpbXxvcGVuaGltLW1lZGlhdG9yLW9oaWUteGRzfHBpeHxwaXh8MjAxNTAyMjAxNTM4MjUrMDIwMHx8UUJQXlEyM15RQlBfUTIxfDEwMDQxYWQ5LTkyNDAtNDEyNS04ZDMwLWZiYzczNGEwOTMwMXxQfDIuNQ1RUER8SUhFIFBJWCBRdWVyeXw1OTRhNDVkYS0zOTY5LTQzOTAtODE2Ni01MjhkZDFmNWU0ZTF8NzZjYzc2NWE0NDJmNDEwXl5eJjEuMy42LjEuNC4xLjIxMzY3LjIwMDUuMy43JklTT15QSXxeXl5FQ0lEJkVDSUQmSVNPXlBJDVJDUHxJDQ==",
"participantObjectDetail": {
"type": "MSH-10",
"value": "MTAwNDFhZDktOTI0MC00MTI1LThkMzAtZmJjNzM0YTA5MzAx"
}
}
]
}
```

</TabItem>
</Tabs>
31 changes: 31 additions & 0 deletions versioned_docs/version-7.1.x/api/audits/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
id: overview
title: Audits overview
sidebar_label: Overview
keywords:
- OpenHIM
- API
- Audit
- Overview
description: An overview of the OpenHIM Audits
---

import ExternalContentSyntaxHighlighter from '../../_react_components/ExternalContentSyntaxHighlighter.jsx';
import GetCurrentVersion from '../../_react_components/GetCurrentVersion.jsx';

Allows for the management of OpenHIM audits.

The OpenHIM will generate audit events on application start/stop, as well as user authentication. These events can either be sent to the OpenHIM’s own internal audit repository, or to an external repository.

## ATNA Audit

The OpenHIM provides full support as an Audit Repository actor in the IHE [ATNA](https://wiki.ihe.net/index.php/Audit_Trail_and_Node_Authentication) profile.

## Schema Model

<GetCurrentVersion>
<ExternalContentSyntaxHighlighter
url="https://raw.githubusercontent.com/jembi/openhim-core-js/<VERSION>/src/model/audits.js"
language="javascript"
/>
</GetCurrentVersion>
Loading

0 comments on commit 1f2ae7a

Please sign in to comment.