Skip to content

Commit

Permalink
Merge pull request #18 from joerivandervelde/main
Browse files Browse the repository at this point in the history
Inclusion criteria lookup and better Markdown documentation
  • Loading branch information
joerivandervelde authored Jan 11, 2021
2 parents 8cdd825 + 81a7e2e commit a5446b4
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 37 deletions.
4 changes: 2 additions & 2 deletions fair-genomes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ modules:
description: The age at which death occurred.
ontology: NCIT:C135383 [http://purl.obolibrary.org/obo/NCIT_C135383]
values: Integer
- name: Inclusion criterion
- name: Inclusion criteria
description: An inclusion criterion defines and states a condition which, if met, makes an entity suitable for a given task or participation in a given process.
ontology: OBI:0500027 [http://purl.obolibrary.org/obo/OBI_0500027]
values: Text
values: LookupMany [lookups/InclusionCriteria.txt]
- name: Primary affiliated institute
description: The most significant institute for medical consultation and/or study inclusion in context of the genetic disease of a person.
ontology: SIO:000688 [https://semanticscience.org/resource/SIO_000688.rdf]
Expand Down
12 changes: 12 additions & 0 deletions lookups/InclusionCriteria.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
value description codesystem code iri
Health status Health status MIABIS-2.0-22 inclusion-criteria#Health status https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Health status
Hospital patient Hospital patient MIABIS-2.0-22 inclusion-criteria#Hospital patient https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Hospital patient
Use of medication Use of medication MIABIS-2.0-22 inclusion-criteria#Use of medication https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Use of medication
Gravidity Gravidity MIABIS-2.0-22 inclusion-criteria#Gravidity https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Gravidity
Age group Age group MIABIS-2.0-22 inclusion-criteria#Age group https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Age group
Familial status Familial status MIABIS-2.0-22 inclusion-criteria#Familial status https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Familial status
Sex Sex MIABIS-2.0-22 inclusion-criteria#Sex https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Sex
Country of residence Country of residence MIABIS-2.0-22 inclusion-criteria#Country of residence https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Country of residence
Ethnic origin Ethnic origin MIABIS-2.0-22 inclusion-criteria#Ethnic origin https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Ethnic origin
Population representative sampling Population representative sampling MIABIS-2.0-22 inclusion-criteria#Population representative sampling https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Population representative sampling
Lifestyle/Exposure Lifestyle/Exposure MIABIS-2.0-22 inclusion-criteria#Lifestyle/Exposure https://github.com/BBMRI-ERIC/miabis/blob/master/Structured-data-and-lists.md#inclusion-criteria#Lifestyle/Exposure
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public String valueTypeToMarkDown()
return "[" + lookup.srcFile.getName().replace(".txt", "") + "](../../lookups/"+lookup.srcFile.getName()+") lookup (" + lookup.lookups.size() + " choices)";
}else if(isReference())
{
return "Reference to "+ referenceTo +" module";
return "Reference to instances of "+ referenceTo;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,13 @@ public String toString() {
", elements=" + elements +
'}';
}

/**
* Helper function to convert name into a Markdown anchor
* @return
*/
public String toMarkdownAnchor()
{
return "#module-" + name.replace(" ", "-").toLowerCase();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.fairgenomes.transformer.datastructures.Element;
import org.fairgenomes.transformer.datastructures.FAIRGenomes;
import org.fairgenomes.transformer.datastructures.Lookup;
import org.fairgenomes.transformer.datastructures.Module;

import java.io.BufferedWriter;
Expand Down Expand Up @@ -30,9 +31,23 @@ public ToMD(FAIRGenomes fg, File outputFolder) throws Exception {
}

public void go() throws IOException {
int totalNrOfElements = 0;
for (Module m : fg.modules) {
totalNrOfElements += m.elements.size();
}

FileWriter fw = new FileWriter(new File(outputFolder, "fairgenomes-semantic-model.md"));
BufferedWriter bw = new BufferedWriter(fw);
bw.write("# FAIR Genomes semantic metadata model" + RN + RN);
bw.write(fg.description + " Version "+fg.version + ", "+fg.date+". This model consists of __" + fg.modules.size() + " modules__ that contain __" + totalNrOfElements + " metadata elements__ in total." + RN + RN);

bw.write("## Module overview" + RN + RN);
bw.write("| Name | Description | Ontology | Nr. of elements |" + RN);
bw.write("|---|---|---|---|" + RN);
for (Module m : fg.modules) {
bw.write("| ["+m.name+"](" + m.toMarkdownAnchor() + ") | " + m.description + " | [" + m.codeSystem + ":" + m.code + "](" + m.iri + ") | " + m.elements.size() + " |" + RN);
}
bw.write(RN);

for (Module m : fg.modules) {
bw.write("## Module: " + m.name + RN);
Expand All @@ -48,12 +63,13 @@ public void go() throws IOException {
}

bw.write("## Null flavors" + RN);
bw.write("Each lookup in FAIR Genomes is supplemented with so-called 'null flavors' from HL7. These can be used to indicate precisely why a particular value could not be entered into the system, providing substantially more insight than simply leaving a field empty. The null flavors are:" + RN + RN);
bw.write("| Value | Description |" + RN);
bw.write("|---|---|" + RN);
bw.write("Each lookup in FAIR Genomes is supplemented with so-called 'null flavors' from HL7. These can be used to indicate precisely why a particular value could not be entered into the system, providing substantially more insight than simply leaving a field empty." + RN + RN);
bw.write("| Value | Description | Ontology |" + RN);
bw.write("|---|---|---|" + RN);
for(String key: fg.lookupGlobalOptionsInstance.lookups.keySet())
{
bw.write("| " + key.substring(0,key.indexOf("(")-1) + " | " + fg.lookupGlobalOptionsInstance.lookups.get(key).description + " |" + RN);
Lookup nf = fg.lookupGlobalOptionsInstance.lookups.get(key);
bw.write("| " + key.substring(0,key.indexOf("(")-1) + " | " + nf.description + " | " + "[" + nf.codesystem + ":" + nf.code + "](" + nf.iri + ") |" + RN);
}
bw.write(RN);

Expand Down
Loading

0 comments on commit a5446b4

Please sign in to comment.