Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo-Hafsaoui committed Sep 6, 2024
1 parent b95a330 commit 4343b38
Show file tree
Hide file tree
Showing 15 changed files with 190 additions and 51 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Binaries for programs and plugins
anemon
*.exe
*.exe~
*.dll
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
run:
echo "Not yet complete"

build:
go build

lint:
golangci-lint run ./...

Expand Down
48 changes: 48 additions & 0 deletions cmd/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package cmd

import (
"anemon/internal/parser"
"anemon/internal/walker"
"errors"
"os"
"github.com/spf13/cobra"
)

var generateCmd = &cobra.Command{
Use: "generate",
Short: "Generate a CV",
Long: `Generate a CV using the CV at the current work directory`,
RunE: func(cmd *cobra.Command, args []string) error{
dir, err := os.Getwd()
if err != nil{
return err
}
cv_path := dir+"/cv"
_, err = os.Stat(cv_path)
if err != nil{
if os.IsNotExist(err) { return errors.New("No `cv` directory found at:"+cv_path) }
return err
}
result, err := walker.WalkCV(cv_path)
if err != nil{
return err
}
println(result["eng"]["work"])
for lang := range result{
err := parser.Init_output(lang+"-CV",dir)
if err != nil{
return err
}
for sec := range result[lang]{
println(result[lang][sec])
//Create section
//apply section to output file
}
}
return nil
},
}

func init() {
rootCmd.AddCommand(generateCmd)
}
19 changes: 19 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"os"
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "anemon",
Short: "a CV genrator",
Long: `This CLI tool, written in Go, automates the generation of customized CVs from Markdown files based on a specified configuration. It parses CV sections in
multiple languages, prioritizes key skills or features as defined in an output.yml file, and outputs LaTeX files for each CV version, ready for compilation.`,
}

func Execute() {
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}
12 changes: 8 additions & 4 deletions cv/eng/education.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
- [Master's in Computer Science, Software and Data Engineering](https://www.univ-tln.fr/Master-Informatique-parcours-Developpement-et-Ingenierie-des-Donnees.html)
- University of Toulon, 2024
# Master's in Computer Science, Software and Data Engineering
## https://www.univ-tln.fr/Master-Informatique-parcours-Developpement-et-Ingenierie-des-Donnees.html
### University of Toulon
#### 2024

- [Bachelor's in Computer Science](https://www.univ-tln.fr/Licence-Informatique-parcours-Informatique.html)
- University of Toulon, 2022
# Bachelor's in Computer Science
## https://www.univ-tln.fr/Licence-Informatique-parcours-Informatique.html
### University of Toulon
#### 2024
13 changes: 6 additions & 7 deletions cv/eng/project.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
**Agenda**
*Java, JavaFX, PostgreSQL, Github [GitHub Repository](https://github.com/MasterDID2022/sopra-project-LHD)*

# Agenda
## Java, JavaFX, PostgreSQL, Github
### https://github.com/MasterDID2022/sopra-project-LHD
- Developed in Java and JavaFX, using PostgreSQL for database management.
- Project executed in an agile environment, emphasizing GitHub Flow, Pull Requests, Kanban, and Continuous Integration for effective collaboration.


**Epigraphy Tools**
*Java, Hibernate, Docker, REST, JWT [GitHub Repository](https://github.com/MasterDID2022/epicTool)*

# Epigraphy Tools
## Java, Hibernate, Docker, REST, JWT
### https://github.com/MasterDID2022/epicTool
- Designed and developed an epigraphy annotation tool for deep learning using Java, Docker, REST, and JWT.
- Separated the front-end and back-end using Docker with container orchestration via Docker-Compose.
- Established secure communication between the front-end and back-end through a RESTful API with JWT tokens.
- Worked as a team in an agile context, utilizing the SCRUM method and applying DevOps practices for efficient and collaborative development.

28 changes: 14 additions & 14 deletions cv/eng/work.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
**Back-End Intern**
*February 2024 -- August 2024*
[Qonto](https://qonto.com/en)
*End of studies internship*

# Back-End Intern
## February 2024 -- August 2024
### [Qonto](https://qonto.com/en)
#### End of studies internship
- Contributed within a Cross Functional Team (CFT) to the standardization and extension of the onboarding process for four new markets (Austria, Netherlands, Belgium, Portugal). From design to implementation, in coordination with stakeholders (Risk, AML, Product), to ensure a smooth and compliant integration, with deployment scheduled for August.
- Led the extraction of back-office logic from a *Ruby* monolith into a microservice, deploying in a trunk-based development environment. Collaborated closely with the Ops teams throughout the process. Monitored production using **Grafana, Sentry, ArgoCD, and Kibana** to ensure quality and reliability, enhancing system maintainability by decoupling microservices.
- Led the extraction of back-office logic from a Ruby monolith into a microservice, deploying in a trunk-based development environment. Collaborated closely with the Ops teams throughout the process. Monitored production using Grafana, Sentry, ArgoCD, and Kibana to ensure quality and reliability, enhancing system maintainability by decoupling microservices.
- Improved the reliability and observability of microservices by completing the tracing mechanisms and implementing Service Level Objectives (SLOs).

**Full Stack Developer**
*June 2023 -- September 2023*
[Coexel](https://www.coexel.com/en)
*Internship then Fixed-Term Contract*
# Full Stack Developer
## June 2023 -- September 2023
### [Coexel](https://www.coexel.com/en)
#### Internship then Fixed-Term Contract

- Designed and developed a Python service for Named Entity Recognition (**NER**) using spaCy to efficiently identify named entities in 92M+ documents. Utilization of **Elasticsearch** for storage and optimized document search, enabling users to gain further insights into monitored themes.
- Rewrote an old website monitoring system created in Java to **Python**, enhancing maintainability and system performance.
- Implemented a **RESTful** API in Python using **FastAPI**, providing increased flexibility and scalability for data management and requests.
- Created a deployment pipeline with **Docker** and Github Actions, streamlining the deployment process and enabling faster and more robust updates.
- Designed and developed a Python service for Named Entity Recognition (NER) using spaCy to efficiently identify named entities in 92M+ documents. Utilization of Elasticsearch for storage and optimized document search, enabling users to gain further insights into monitored themes.
- Rewrote an old website monitoring system created in Java to Python, enhancing maintainability and system performance.
- Implemented a RESTful API in Python using FastAPI, providing increased flexibility and scalability for data management and requests.
- Created a deployment pipeline with Docker and Github Actions, streamlining the deployment process and enabling faster and more robust updates.
- Significantly improved performance by reducing the number of GET requests from 5 to 1, resulting in an 85% faster display

7 changes: 6 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ module anemon

go 1.22.0

require github.com/google/go-cmp v0.6.0 // indirect
require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
18 changes: 14 additions & 4 deletions internal/parser/latex.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,31 @@ type SectionName string


//Read the template file in the assets directory
func read_template()(string,error) {
file, err := os.ReadFile("../../assets/latex/template/template.tex")
func read_template(path string)(string,error) {
file, err := os.ReadFile(path+"/assets/latex/template/template.tex")
if err != nil {
return "", err
}
return string(file), nil
}

//Write the template file in the assets directory
func writeTemplate(template string, name string)error{
err := os.WriteFile("../../assets/latex/output/"+name+".tex",
func writeTemplate(path string, template string, name string)error{
err := os.WriteFile(path+"/assets/latex/output/"+name+".tex",
[]byte(template), 0644)
return err
}

//Create a new empty template in the output dir
func Init_output(name string, root_path string)error{
template,err := read_template(root_path)
if err != nil {
return err
}
err = writeTemplate(root_path, template, name)
return err
}

//Apply a section to a section type on a latex template
func applyToSection(section Section, section_type string)(string,error){
replacements := []string{section.first, section.second, section.third, section.fourth}
Expand Down
9 changes: 6 additions & 3 deletions internal/parser/latex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import (
"github.com/google/go-cmp/cmp"
)

func TestReadLatex(t *testing.T) {

func TestIO(t *testing.T) {
t.Run("Count returns 1 lines with just one line", func (t *testing.T) {
dir := filepath.Join("../../assets", "latex", "template")
templateFile := filepath.Join(dir, "template.tex")
backupFile := filepath.Join(dir, "save.tex")
Expand All @@ -22,7 +24,7 @@ func TestReadLatex(t *testing.T) {
if err != nil {
t.Fatalf("Failed to write file: %v", err)
}
content, err := read_template()
content, err := read_template("../../")
if err != nil {
t.Fatalf("Failed to read file: %v", err)
}
Expand All @@ -39,10 +41,11 @@ func TestReadLatex(t *testing.T) {
t.Fatalf("Failed to rename save.tex back to template.tex: %v", err)
}
}
})
}

func TestWriteLatex(t *testing.T) {
err := writeTemplate("Hello, world", "hello")
err := writeTemplate("../../","Hello, world", "hello")
if err != nil {
t.Fatalf("Failed to write file: %v", err)
}
Expand Down
8 changes: 7 additions & 1 deletion internal/parser/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package parser

import (
"errors"
"regexp"
"regexp"
"fmt"
"strings"
)

Expand All @@ -17,6 +18,11 @@ type Section struct {
description []string
}

func (s Section) String() string {
return fmt.Sprintf("1: %s\n2: %s\n3: %s\n4: %s\nitems: %v",
s.first,s.second,s.third,s.fourth,s.description)
}

/*
Parse parses a Markdown-like `paragraph` into a `Section`, extracting headings and description based on the number of leading hashtags. Returns an error if the format is invalid.
*/
Expand Down
18 changes: 13 additions & 5 deletions internal/walker/cv.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"strings"
)

// walkCV traverses the directory tree starting at root and returns a map where
// the keys are the relative paths without the .md extension and the values are
// the contents of the markdown files.
func walkCV(root string) (map[string]string, error) {
// walkCV traverses the directory tree starting at root and returns a map of map where
// the keys are first the language folowed by the second key which is the section
// the values are the contents of the markdown files.
func WalkCV(root string) (map[string]map[string]string, error) {
fileMap := make(map[string]string)
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
if err != nil {
Expand All @@ -28,5 +28,13 @@ func walkCV(root string) (map[string]string, error) {
if err != nil {
return nil, err
}
return fileMap, nil
md_per_language := make(map[string]map[string]string)
for k := range fileMap{
k_split := strings.Split(k,"/")
if md_per_language [k_split[0]] == nil {
md_per_language[k_split[0]]= make(map[string]string)
}
md_per_language[k_split[0]][k_split[1]]=fileMap[k]
}
return md_per_language, nil
}
38 changes: 26 additions & 12 deletions internal/walker/cv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,41 @@ func TestWalkCV(t *testing.T) {
}
}

result, err := walkCV(rootDir)
result, err := WalkCV(rootDir)
if err != nil {
t.Fatalf("walkCV failed: %v", err)
}

expected := map[string]string{
"eng/education": "Education",
"eng/project": "Project",
"fr/education": "Education",
"fr/work": "Work",
expected := map[string]map[string]string{
"eng": {
"education": "Education",
"project": "Project",
},
"fr": {
"education": "Education",
"work": "Work",
},
}

for key, expectedValue := range expected {
if result[key] != expectedValue {
t.Errorf("Expected %s to be %q, got %q", key, expectedValue, result[key])
for lang, expectedFiles := range expected {
if resultFiles, ok := result[lang]; ok {
for file, expectedContent := range expectedFiles {
if resultContent, ok := resultFiles[file]; ok {
if resultContent != expectedContent {
t.Errorf("Expected %s/%s to be %q, got %q", lang, file, expectedContent, resultContent)
}
} else {
t.Errorf("Expected file %s/%s not found in result", lang, file)
}
}
} else {
t.Errorf("Expected language %s not found in result", lang)
}
}

for key := range result {
if _, found := expected[key]; !found {
t.Errorf("Unexpected key found: %s", key)
for lang := range result {
if _, found := expected[lang]; !found {
t.Errorf("Unexpected language found: %s", lang)
}
}
}
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import (
"anemon/cmd"
)

func main() {
cmd.Execute()
}

0 comments on commit 4343b38

Please sign in to comment.