Skip to content

Instantly share code, notes, and snippets.

View kaicode's full-sized avatar

Kai Kewley kaicode

View GitHub Profile
function getMonday() {
var date = new Date();
// Set date to Monday just gone
var day = date.getDay()
date.setDate(date.getDate() - (day == 0 ? -6:1));
// Zero time
date.setHours(0);
date.setMinutes(0);
@kaicode
kaicode / gist:8fca9cb32147728e3538
Created June 27, 2014 09:39
SnomedCT_Release_INT_20140131.zip table of contents
SnomedCT_Release_INT_20140131/
SnomedCT_Release_INT_20140131/Documentation/
SnomedCT_Release_INT_20140131/Documentation/doc_Icd10MapTechnicalGuideExemplars_Current-en-US_INT_20140131.xlsx
SnomedCT_Release_INT_20140131/Documentation/doc_SnomedCTReleaseNotes_Current-en-US_INT_20140131.pdf
SnomedCT_Release_INT_20140131/Readme_en_20140131.txt
SnomedCT_Release_INT_20140131/Resources/
SnomedCT_Release_INT_20140131/Resources/OrderedTypeReferenceSetExemplar/
SnomedCT_Release_INT_20140131/Resources/OrderedTypeReferenceSetExemplar/zres2_icRefset_OrderedTypeFull_INT_20110731.txt
SnomedCT_Release_INT_20140131/Resources/OrderedTypeReferenceSetExemplar/zres2_icRefset_OrderedTypeSnapshot_INT_20110731.txt
SnomedCT_Release_INT_20140131/Resources/StatedRelationshipsToOwlKRSS/
@kaicode
kaicode / gist:9d3deec4d626d789345c
Last active August 29, 2015 14:07
Counts of new Concept states per effective time from the July 2014 SNOMED CT International Release in RF2 format
Count EffectiveDate
326016 20020131
15338 20020731
14770 20030131
11061 20030731
6766 20040131
10706 20040731
8488 20050131
5014 20050731
8389 20060131
@kaicode
kaicode / gist:6c19db54b0438666787b
Created March 18, 2015 10:01
GNU Terry Pratchett
kaikewley:~$ curl -I browser.ihtsdotools.org
HTTP/1.1 200 OK
Server: nginx/1.1.19
Date: Wed, 18 Mar 2015 10:01:19 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 70878
Last-Modified: Thu, 12 Mar 2015 08:17:31 GMT
Connection: keep-alive
X-Clacks-Overhead: GNU Terry Pratchett
Accept-Ranges: bytes
@kaicode
kaicode / gist:aa20e3502c79a4a39f86
Created September 1, 2015 14:17
Active FSN parenthesis in Snomed CT July 2015 Release
select distinct SUBSTRING_INDEX(term, '(', -1) from description_s as d left join concept_s as c on d.conceptid = c.id where d.typeid = 900000000000003001 and d.active = 1 and c.active = 1 limit 1000;
+--------------------------------+
| SUBSTRING_INDEX(term, '(', -1) |
+--------------------------------+
| finding) |
| body structure) |
| disorder) |
| procedure) |
| morphologic abnormality) |
| regime/therapy) |
@kaicode
kaicode / traceability-branch-deletion.sql
Last active April 4, 2016 13:28
Delete branch traceability data (Updated to use variable)
set @branch='MAIN/WRPTEST/WRPTEST-336'
delete from component_change where concept_change_id in (select id from concept_change where activity_id in (select id from activity where branch = (select id from branch where branch_path=@branch)));
delete from concept_change where activity_id in (select id from activity where branch = (select id from branch where branch_path=@branch));
delete from activity where branch = (select id from branch where branch_path=@branch);
delete from branch where branch_path=@branch;
@kaicode
kaicode / RequestHeaderAuthenticationDecorator.java
Created November 8, 2016 14:16
AuthenticationDecorator takes username and roles from request header and puts them into the spring security context.
import java.io.IOException;
import java.util.List;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.authentication.AbstractAuthenticationToken;
@kaicode
kaicode / _etc_nginx_conf.d_termserver.conf
Created October 5, 2018 13:40
Snomed International, Authoring Platform Nginx Configuration Example
map $http_cookie $ihtsdo_cookie { default ""; "~(;\s|^)dev-ims-ihtsdo=(?<token>[^\;]+)" "dev-ims-ihtsdo=$token"; }
server {
server_name _;
listen 80;
rewrite ^ https://$host$request_uri permanent;
#endofhttpServer
}
server {
library(httr)
library(jsonlite)
# ECL examples here https://confluence.ihtsdotools.org/display/DOCECL/6.+Examples
# Can test them in the browser here:
ecl <- "< 404684003 |Clinical finding|:
363698007 |Finding site| = << 39057004 |Pulmonary valve structure|,
116676008 |Associated morphology| = << 415582006 |Stenosis|"
@kaicode
kaicode / snomed-owl-conversion.log
Created February 28, 2020 13:46
SNOMED CT to OWL Ontology file conversion using https://github.com/IHTSDO/snomed-owl-toolkit
$ java -Xms6g -jar snomed-owl-toolkit*executable.jar -rf2-to-owl -rf2-snapshot-archives SnomedCT_InternationalRF2_PRODUCTION_20200131T120000Z.zip -version 20200131
Creating Ontology using the following options:
Snapshot archives: [SnomedCT_InternationalRF2_PRODUCTION_20200131T120000Z.zip]
Delta archive: -none-
Ontology URI: http://snomed.info/sct/900000000000207008
Ontology Version: 20200131
Include Description Annotations: true
2020-02-28 13:44:00,759 [INFO ] [main] org.snomed.otf.owltoolkit.conversion.RF2ToOWLService - Loading RF2 files